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.8"
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
flutter packages get.
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.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|
|0.16.2||Mar 9, 2018|
|0.16.1||Nov 23, 2017|
|0.16.0||Oct 19, 2017|
|0.15.0||Jun 5, 2017|
We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
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]
Detected platforms: Flutter, other
Platform components identified in package:
Documentation URL is not helpful.
documentationproperty: create a website about the package or remove it.
Package is pre-v1 release.
While there is nothing inherently wrong with versions of
0.*.*, it usually means that the author is still experimenting with the general direction API.
Maintain an example.
Create a short demo in the
example/directory to show how to use this package. Common file name patterns include:
example.dartor you could also use
Fix analysis and formatting issues.
Analysis or formatting checks reported 2 hints.
Strong-mode analysis of
lib/extract_messages.dartgave the following hint:
line: 182 col: 50
'kind' is deprecated and shouldn't be used.
Strong-mode analysis of
lib/transformer.dartgave the following hint:
line: 9 col: 1
'barback' is deprecated and shouldn't be used.
|Dart SDK||>=1.12.0 <2.0.0|