i18n_extension 11.0.0-dev.1
i18n_extension: ^11.0.0-dev.1 copied to clipboard
Translation and Internationalization (i18n) for Flutter. Easy to use for both large and small projects. Uses Dart extensions to reduce boilerplate.
11.0.0-dev.1 #
-
BREAKING CHANGE: Replace the previous
Translations()constructor withTranslations.byText(). Like before, it supportsStringas translation keys, organized per key. -
The previous
Translations.byLocale()works just as before. Like before, it supportsStringas translation keys, organized per locale. -
Now you can use ANY object type as translation keys. Before, it was only possible to use strings as translation keys. You can now use
Translations.byId<T>()and provide the typeTof your identifier. YourTcan be anything, includingString,int,double,DateTime, or even your own custom object types, as long as they implement==andhashCode. If you useObjectorObject?/dynamicthen anything can be translated. Don't forget that your extensions, like.i18n, will need to be on your type. For example, if you useintas your key type, then you will need to declareextension Localization on int { ... }. -
If you want to provide translations as a const map, and
Stringas translation keys, use theconst ConstTranslations()constructor.To sum up:
Translations.byText()supportsStringas translation keys, organized per key.Translations.byLocale()supportsStringas translation keys, organized per locale.Translations.byId<T>()supports any object of typeTas translation keys.const ConstTranslations()supports defining translations with aconstMap, andStringas translation keys.
-
Now the core features of the i18n_extension package are available as a standalone Dart-only package: https://pub.dev/packages/i18n_extension_core. You may use that core package when you are developing a Dart server (backend) with Celest, or when developing your own Dart-only package that does not depend on Flutter.
For Flutter applications nothing changes. You don't need to import the core package directly. You should continue to use this i18n_extension package, which already exports the core code plus the
I18nwidget that you use to wrap your widget tree.
10.0.3 #
-
The importer library developed by Johann Bauer is now independently available as a standalone package. You can find it at https://pub.dev/packages/i18n_extension_importer. This new package offers capabilities for importing translations in both
.POand.JSONformats. It also includes theGetStringsexporting utility, which is a useful script designed to automate the export of all translatable strings from your project. -
Removed unused packages that were previously used by the removed importer.
9.0.2 #
-
Flutter 3.10 e Dart 3.0.0
-
Removed the importer library developed by Johann Bauer, so that users of i18n_extension don't need to import the analyzer and other unnecessary dependencies. See version [10.0.2] above.
8.0.0 #
- Breaking change: Removed dependency on analyzer and gettext_parser. The getStrings doesn't work in this version.
6.0.0 #
- Analyzer and sprintf version bump.
5.0.1 #
- Analyzer version bump.
5.0.0 #
- Flutter 3.0
4.2.1 #
- The
localizePluralmethod now accepts any object (not only an integer anymore). It will convert that object into an integer, and use that result. Se the method documentation for more information. To make use of it, you may declare yourplural()methods asString plural(value) => localizePlural(value, this, _t);from now on. Example:'This is one item'.plural(2)is now the same as writing'This is one item'.plural('2').
4.1.3 #
- Bump version. Docs improvement.
4.1.1 #
.poimporter fix.
4.1.0 #
- Removed useless
uses-material-design: true. - Bumped dependencies versions (in special args: ^2.0.0).
4.0.3 #
- Plural support for the
.POimporter.
4.0.2 #
- Downgraded args: 1.6.0 to be compatible with flutter_driver.
- Better NNBD.
4.0.0 #
- Now allows both string-keys (like
"Hello there".i18nas shown in theexample1dir) and identifier-keys ( likegreetings.i18nas shown in theexample2dir). - Breaking change: If some translation did not exist in some language, it would show the translation key itself as the missing translation. This worked well with string-keys, but not with identifier-keys. Now, if some translation is missing, it first tries to show the untranslated string, and only if that is missing too it shows the key as the translation. This change is unlikely to be noticed by anyone, but still a breaking change.
3.0.3 #
- Nullsafety.
- Breaking change: During app initialization, the system locale may be
nullfor a few moments. During this time, in prior version 2.0.0 it would use theTranslationsdefault locale. Now, in version 3.0.0, it will use the global locale defined inI18n.defaultLocale, which by default isLocale("en", "US"). You can change this default in your app's main method. - New
Translations.from()constructor, which responds better to hot reload. - Fixed the PO importer to ignore empty keys.
- The docs now explain better how to add plurals with translations by locale.
2.0.0 #
- Plural modifiers:
zeroOne(for 0 or 1 elements), andoneOrMore(for 1 and more elements). - Fix for when no applicable plural modifier is found. It now correctly defaults to the unversioned string.
1.5.1 #
.POand.JSONimporters contributed by Johann Bauer.
1.4.6 #
- Sprintf version bump to 5.0.0.
1.4.5 #
- Added
keyandidtoI18nwidget constructor.
1.4.3 #
- Better error message for
I18n.of.
1.4.2 #
- Bumped
sprintfto version4.1.0, which adds compatibility for future Dart features that require a Dart SDK constraint with a lower bound that is>=2.0.0.
1.4.1 #
- Allow multi-line statements in getstrings utility.
1.4.0 #
- More plural modifiers:
three,four,five,six, andten. - For Czech language:
twoThreeFourplural modifier.
1.3.9 #
- GetStrings exporting utility.
1.3.5 #
- Added fill() method to default.i18n.dart.
1.3.4 #
- Don't record unnecessary missing translations with the Translation.byLocale constructor.
1.3.3 #
- Commented unnecessary tests.
1.3.2 #
- Added localizationsDelegates and supportedLocales to the docs.
1.3.0 #
-
I18n.observeLocale() can be used to observe locale changes.
-
Breaking change: Accepts Locale("en", "US"), but not Locale("en_US") anymore, which was wrong. See "A quick recap of Dart locales" in the docs, for more details.
1.2.0 #
- Fill fix. Docs improvement.
1.1.3 #
- Interpolation.
1.1.1 #
- Better fallback.
1.0.9 #
- Default import records keys.
1.0.3 #
- First working version.
0.0.1 #
- Initial commit on Oct 19, 2019.