Translation

EZ Flutter supports the usage of multiple languages for a app.

Basics

Translation is handled by different .json files that contain the translation for each language supported by the app. The translation files are automatically loaded by the EzRunner at startup. Create a .json file with the pattern locale_$loacle.json under the locale folder for each supported language.

Example: locale_en.json && locale_de.json

//locale_en.json
{
  "some_message": "This is some message!"
}
//locale_de.json
{
  "some_message": "Dies ist eine Nachricht!"
}

Usage

Define supported languages

Add all supported locales to the EzRunner at startup.

EzRunner.run(CustomWidget(), [Locale('en'), Locale('de'), Locale('en')]);

Access translation

Access the translation within your app via the EzTranslator.

EzTranslator.of(context).text("some_message");