i18n_extension_core
library
Extensions
-
Localization
on String
-
String extension which allows you to add plural modifiers to a string.
Functions
-
convertToIntegerModifier(Object? modifierObj)
→ int
-
See rules stated in localizePlural's documentation.
IMPORTANT: This function is visible for testing purposes only.
-
localize(String key, Translations translations, {String? locale})
→ String
-
Use the localize method to localize a "translatable string" to the given
locale.
You must provide the key (which is usually the string you want to translate)
and the translations object which holds the translations.
-
localizeAllVersions(String key, Translations translations, {String? locale})
→ Map<String?, String>
-
Use the localizeAllVersions method to return a Map of all translated strings,
where modifiers are the keys. In special, the unversioned text is indexed with a
null key.
-
localizeFill(String text, List<Object> params)
→ String
-
Does an
sprintf on the text with the params.
This is implemented with the sprintf package: https://pub.flutter-io.cn/packages/sprintf
-
localizePlural(Object? modifier, String key, Translations translations, {String? locale})
→ String
-
Returns the translated version for the plural
modifier.
After getting the version, substring %d will be replaced with the modifier.
-
localizeVersion(Object modifier, String key, Translations translations, {String? locale})
→ String
-
Use the localizeVersion method to localize a "translatable string" to the given
locale.
You must provide the key (which is usually the string you want to translate),
a modifier, and the translations object which holds the translations.
-
recordMissingKey(String key)
→ String
-
Function recordMissingKey simply records the given key as a missing
translation with unknown locale. It returns the same
key provided,
unaffected.