l10n 2.0.15

  • README.md
  • Installing
  • Versions
  • 83


Easy to use generator for .arb-Files
Helps if you want to translate your application

l10n >= v2.x

This is a complete rewrite. l10n now fully supports Intl.message and .ARB-Files


  • First install l10n with pub global activate l10n

Now mkl10n should be available on the command-line.

Go to the package you want to translate.

    mkl10n -l de .

Yes - that's it!

Your .arb-Files are in l10n. You should see intl_messages.arb and intl_de.arb

Translate intl_de.arb

    # Run this command again
    mkl10n -l de .

Your generated dart-Files are in lib/_l10. You should see messages_all.dart and messages_de.dart

Import messages_all.dart in your app.

// Include this if you run your app in the browser
import 'package:intl/intl_browser.dart';

// Include this if you run your app on the cmdline
import 'package:intl/intl_standalone.dart';

import 'package:l10n/l10n.dart';
import 'package:<your package>/_l10n/messages_all.dart';

void main() async {
    // Init section
    final shortLocale = await initLanguageSettings(
        () => findSystemLocale(),
        (final String locale) => initializeMessages(locale)

    // App specific code
    // ...
    String message() => Intl.message("First test");
    print(l10n("Second test"));

    [ "Mike", "Gerda", "Sarh"].forEach((name) {
        print(l10n("Good morning [name]",{ "name" : name }));
    // ...

On GitHub you can find a cmdline-example and a browser-example.

Browser-Example Live-Version This is the most simple version of a translated HTML-page I could think of...

More details

As mentioned above Intl.message is fully supported. More infos can be found on pub

Hey but there is more!

In my opinion Intl.message is to complex for most situations so I also support my own l10n syntax.

    // Yup - this prints 'Second test'
    // And after you have translated the intl_de.arb to German it prints 'Zweiter Test' 
    print(l10n("Second test"));

Check out the source on GitHub

But hey - we also have HTML-Files...


<main class="cols">
       <div class="translate">_("Hi Mike")</div>
       <div class="translate">_("My cat's name is 'Pebbles'")</div>

That's how it works in HTML. Wrap the string you want to translate with _(...) You can also wrap it with l10n(...) but I prefer _(...)

It get's even better - if you have a dart-File with HTML-Included like so
it's also fully scanned by mkl10n


This should seamlessly work with Flutter. Should because I haven't tested it with Flutter
If it fails please write file an issue report.

If you have problems


Copyright 2018 Michael Mitterer (office@mikemitterer.at), 
IT-Consulting and Development Limited, Austrian Branch

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, 
software distributed under the License is distributed on an 
either express or implied. See the License for the specific language 
governing permissions and limitations under the License.

Change Log for l10n

Creates translatable PO-Files, strong orientation to xgettext



  • initLanguageSetting shortens the init-section in main 09537d8
  • Easy translation with mkl10n 7c6f264


  • Browser didn't show the right language if Browser-Language was just English a05d0f2
  • Language does not change on client-side 23f6700


  • Browser-Sample got a separate _initLanguageSettings-function cb0734c
  • Typos in README 02c4201

v1.4 - 2018-08-29


v1.3 - 2018-06-06




v1.1.0 - 2017-09-01


  • l10 in String interpolation 3a590dc


v1.0.1 - 2017-08-25


v1.0 - 2017-08-25


  • xgettext is Depreciated - mkl10n writes the POT-File 8727b6e

v0.19.2 - 2017-08-23


v0.19.1 - 2017-08-23


v0.19.0 - 2017-08-23


  • Define settings in Settings-File (.mkl10n.yaml), Sort output by file location 1e18a7e

v0.18.0 - 2017-08-22


v0.17.0 - 2017-08-17


  • External programs are now a subclass of ShellCommand, structure improved 3fc1c82

v0.16.4 - 2016-11-16


  • Strong-Mode support, README improved 5532669

v0.16.2 - 2015-12-16


  • More documentation for translate + sample 3f0445b

v0.16.1 - 2015-12-04


This CHANGELOG.md was generated with Changelog for Dart

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate l10n

2. Use it

The package has the following executables:

$ mkl10n

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  l10n: ^2.0.15

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:l10n/l10n.dart';
Version Uploaded Documentation Archive
2.0.15 Nov 13, 2018 Go to the documentation of l10n 2.0.15 Download l10n 2.0.15 archive
2.0.4 Sep 13, 2018 Go to the documentation of l10n 2.0.4 Download l10n 2.0.4 archive
1.4.0 Aug 29, 2018 Go to the documentation of l10n 1.4.0 Download l10n 1.4.0 archive
1.3.2 Jun 7, 2018 Go to the documentation of l10n 1.3.2 Download l10n 1.3.2 archive
1.2.11 Mar 26, 2018 Go to the documentation of l10n 1.2.11 Download l10n 1.2.11 archive
1.2.9 Dec 13, 2017 Go to the documentation of l10n 1.2.9 Download l10n 1.2.9 archive
1.2.7 Dec 7, 2017 Go to the documentation of l10n 1.2.7 Download l10n 1.2.7 archive
1.2.2 Dec 6, 2017 Go to the documentation of l10n 1.2.2 Download l10n 1.2.2 archive
1.1.1 Oct 20, 2017 Go to the documentation of l10n 1.1.1 Download l10n 1.1.1 archive
1.1.0 Sep 1, 2017 Go to the documentation of l10n 1.1.0 Download l10n 1.1.0 archive

All 57 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:l10n/l10n.dart.

Health suggestions

Format bin/argparser/Config.dart.

Run dartfmt to format bin/argparser/Config.dart.

Format bin/argparser/Options.dart.

Run dartfmt to format bin/argparser/Options.dart.

Format bin/mkl10n.dart.

Run dartfmt to format bin/mkl10n.dart.

Fix additional 20 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/_l10n/messages_all.dart (Run dartfmt to format lib/_l10n/messages_all.dart.)
  • lib/_l10n/messages_de.dart (Run dartfmt to format lib/_l10n/messages_de.dart.)
  • lib/arb.dart (Run dartfmt to format lib/arb.dart.)
  • lib/arb/ARB.dart (Run dartfmt to format lib/arb/ARB.dart.)
  • lib/codegen.dart (Run dartfmt to format lib/codegen.dart.)
  • lib/extractor/HTMLExtraction.dart (Run dartfmt to format lib/extractor/HTMLExtraction.dart.)
  • lib/extractor/L10NMessageExtraction.dart (Run dartfmt to format lib/extractor/L10NMessageExtraction.dart.)
  • lib/extractor/L10NMessageExtractionException.dart (Run dartfmt to format lib/extractor/L10NMessageExtractionException.dart.)
  • lib/interfaces.dart (Run dartfmt to format lib/interfaces.dart.)
  • lib/l10n.dart (Run dartfmt to format lib/l10n.dart.)
  • lib/l10n/L10NImpl.dart (Run dartfmt to format lib/l10n/L10NImpl.dart.)
  • lib/parser/InvalidTokenException.dart (Run dartfmt to format lib/parser/InvalidTokenException.dart.)
  • lib/parser/Lexer.dart (Run dartfmt to format lib/parser/Lexer.dart.)
  • lib/parser/Parser.dart (Run dartfmt to format lib/parser/Parser.dart.)
  • lib/parser/ParserError.dart (Run dartfmt to format lib/parser/ParserError.dart.)
  • lib/parser/Statement.dart (Run dartfmt to format lib/parser/Statement.dart.)
  • lib/parser/Token.dart (Run dartfmt to format lib/parser/Token.dart.)
  • lib/parser/tools.dart (Run dartfmt to format lib/parser/tools.dart.)
  • lib/pot.dart (Run dartfmt to format lib/pot.dart.)
  • lib/utils.dart (Run dartfmt to format lib/utils.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use l10n.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer ^0.32.0 0.32.6 0.34.0
args ^1.4.0 1.5.1
console_log_handler >=1.1.0 <2.0.0 1.1.3
intl ^0.15.0 0.15.7
intl_translation ^0.17.0 0.17.1 0.17.2
logging >=0.11.3 <1.0.0 0.11.3+2
optional ^3.0.0 3.0.0+2
path ^1.0.0 1.6.2
validate ^1.0.0 1.7.0
where ^4.3.0 4.4.0 6.0.0
yaml ^2.1.0 2.1.15
Transitive dependencies
ansicolor 1.0.2
async 2.0.8
build_cli_annotations 1.0.1
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
csslib 0.14.6
dart_style 1.1.3 1.2.1
front_end 0.1.4+2 0.1.7
glob 1.1.7
html 0.13.3+3
kernel 0.3.4+2 0.3.7
matcher 0.12.4
meta 1.1.6
package_config 1.0.5
petitparser 1.7.7 2.0.2
plugin 0.2.0+3
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.4
typed_data 1.1.6
utf 0.9.0+5
watcher 0.9.7+10
Dev dependencies
build_runner any
build_test any
build_web_compilers any
test any