This package provides message extraction and code generation from translated messages for the Intl package. It's a separate package so as to not require a dependency on analyzer for all users.
When your program contains messages that need translation, these must be extracted from the program source, sent to human translators, and the results need to be incorporated.
To extract messages, run the
pub run intl_translation:extract_to_arb --output-dir=target/directory my_program.dart more_of_my_program.dart
This will produce a file
intl_messages.arb with the messages from
all of these programs. an [ARB]
format file which can be used for input to translation tools like
Google Translator Toolkit
The resulting translations can be used to generate a set of libraries
This expects to receive a series of files, one per locale.
pub run intl_translation:generate_from_arb --generated-file-prefix=<prefix> <my_dart_files> <translated_ARB_files>
This will generate Dart libraries, one per locale, which contain the
translated versions. Your Dart libraries can import the primary file,
<prefix>messages_all.dart, and then call the initialization
for a specific locale. Once that's done, any
Intl.message calls made in the context of that locale
will automatically print the translated version instead of the
import "my_prefix_messages_all.dart"; ... initializeMessages("dk").then(printSomeMessages);
Once the future returned from the initialization call returns, the message data is available.
Add this to your package's pubspec.yaml file:
dependencies: intl_translation: ^0.16.6
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:intl_translation/extract_messages.dart'; import 'package:intl_translation/generate_localized.dart'; import 'package:intl_translation/transformer.dart';
|0.17.3||Feb 12, 2019|
|0.17.2||Oct 1, 2018|
|0.17.1||Sep 28, 2018|
|0.17.0||Jul 17, 2018|
|0.16.8||Jul 5, 2018|
|0.16.7||May 17, 2018|
|0.16.6||Apr 11, 2018|
|0.16.5||Apr 10, 2018|
|0.16.4||Mar 21, 2018|
|0.16.3||Mar 12, 2018|
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]
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in
The SDK constraint in
pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
dartdoc successfully runs on your package's source files. (-10 points)
Dependencies were not resolved.
|Dart SDK||>=1.12.0 <2.0.0|