flutter_i18n now manage strings that contain parameters; an example can be: "Hello, {user}!" For a correct translation, you must use the third parameter of the translate method, a Map<String, String> where:
- the keys are the placeholders used in the .json file (i.e. user)
- the values are what you want to display
flutter_i18n now supports language change at runtime. To use it, you must invoke the method
await FlutterI18n.refresh(buildContext, languageCode, {countryCode});
NOTE: countryCode is optional.
flutter_i18n now supports plurals. To use it, invoke the method:
FlutterI18n.plural(buildContext, "your.key", pluralValue);
Where pluralValue is the integer value that will be used to determinate the plural form of the translation.
Here is an example of configuration of the .json file:
"clicked": {
"times-0": "You clicked {times} times!",
"times-1": "You clicked {time} time!",
"times-2": "You clicked {times} times!"
}
With this configuration, you must invoke the plural method as follow:
FlutterI18n.plural(buildContext, "clicked.times", pluralValue);
FlutterI18n will choose the right key using the value of pluralValue: it will match the last key with a value <= of pluralValue.
flutter_i18n now supports the basePath
configuration.
The default one is: assets/flutter_i18n
.
To configure it, use the third optional parameter of FlutterI18nDelegate
.
Print in log when a key is not found.
Fix for bug #10.
Exposed new method that return the locale used by the library, as requested in #16:
FlutterI18n.currentLocale();
NOTE: the refresh method now accept a Locale as second parameter, instead of two strings. NOTE: the constructor of FlutterI18nDelegate now accept only named parameter.
Fix for bug #22
Fix for the delegate
Fix for #17
Fix for #41
Fix for #48 and implemented feature for #49. From this version of FlutterI18n, you can use as 4th parameter the forcedLanguage parameter, in order to avoid to call the refresh method on application startup.
Support for yml language files
Improved json and yml loading
Bugfix and code improvement
Library will print debug messages only in development mode
Added a new optional parameter to the translate method: fallbackKey. You can use it when the translation key is not found.
Added stateless widgets in order to avoid to deal with BuildContext.
I18nText("your.key", Text(""))
I18nText("your.key", Text(""), translationParams: {"user": "Flutter lover"})
I18nPlural("clicked.times", 2, Text(""))
New translation mechanism, with different and customizable loaders provided:
- FileTranslationLoader
- NetworkFileTranslationLoader
- E2EFileTranslationLoader
Plural translator improvements
New loader provided: NamespaceFileTranslationLoader
In the I18nText and I18nPlural widgets, the child parameter is now optional.
The default value of the child parameter is now Text("")
Fix for #83.
Fixed immutable warnings.
New feature: file translation decode strategies. New translation strategy provided, able to load XML file.
New feature: missing key are now retrieved from the fallback file.
Full support for supportedLocales
Support for decode strategies on other loaders
Added missing translation handler, according to issue/67
Removed cache parameter from loadString method, resolve issue/116
RTL support. Test fix for issue/115
New loader provided:
- LocalTranslationLoader
Support for Flutter Web. Note: due to dart:io bug, NetworkFileTranslationLoader can't be used.
Removed useless parameter from LocalTranslationLoader and fixed delegate load method.
Plugins and better Flutter Web support.
Removed dart:io for better Flutter Web support.
Better dartdocs
Loading and loaded stream, in order to detect loading translations status
Fix for streams listened twice
Introducing validate and diff actions
Fix for #150
Initial Flutter 2 support:
- intl upgraded to version 0.17.0
- example app upgraded to Android X
- null safe migration
Nullsafe support + static analysis fixes
Dartfmt
Fix for #159
Fix for #167 Dependencies upgrade
Support for script code Support for toml format Fix for #173
Fix for #179
Fix for #184
Fix for #186 Recursively merge the translation map with the fallback map
Fix for #189
Fix for #190
Fix for #197 and #196
Dependencies upgrade
Dependencies upgrade
Support for Dart 3 and Flutter 3.10 Fix for #204
Upgrade [email protected], [email protected], [email protected], [email protected], [email protected] Fix: deprecation warnings
Upgrade [email protected], [email protected], [email protected], [email protected] Fix: deprecation warnings
Change intl version to '>=0.17.0-0 <=0.19.0'
Ability to define custom separator
Fix for #222
Fix for #185 Fix for #216