app_localizer library
Classes
- AppLocalizer
- Manages the active locale used for translations.
- Countries
-
All countries from
country.csv.dart - Country
- Country data according to ISO-3166.
- CountryChooser
- Currencies
-
Contains all currencies from
currency.csv.dart. Columns are: alpha-3,name,minor,symbol,country - Currency
- Currency data according to ISO 4217:2015.
- CurrencyChooser
- DisplayItem
- Displays a single item from a choosers selection list or the selected item itself.
- Language
- Language data according to ISO-639.
- LanguageChooser
- Languages
-
Contains all languages from
language.csv.dart - LocalizedCountryDisplayItem
- Displays a localized country name with its flag image. Resolves locale to a supported locale (see AppLocalizer.supportedLocales) for translation of countryCode.
- LocalizedLanguageDisplayItem
- Displays a localized language name with its flag image.
- Translator
- Translates strings to a target language through string extension. Following extensions can be used:
- TranslatorException
Enums
Extensions
- Plural on String
- Plural extensions must be prepared inside the translation file like:
Functions
-
sprintf(
String template, List values) → String -
Replaces
%dand%sintemplatewith values -
translate(
String key, Translator translator, {String? langCode, bool fallback = true}) → String -
Translates given
keytolangCode(default: Translator.langCode or Translator.activeLanguageCode). -
translateFill(
String key, Translator translator, List values, {String? langCode, bool fallback = true}) → String -
Calls translate() then sprintf() to replace parameters with
values. -
translateOrNull(
String key, Translator translator, {String? langCode, bool fallback = true}) → String? -
Like translate but returns
nullinstead ofkey. Use it for optional texts where a missing key is a valid case: -
translatePlural(
String key, Translator translator, int plural, {String? langCode, bool fallback = true}) → String - Translates into plural specific texts (see Plural).