ez_localization 0.1.1 copy "ez_localization: ^0.1.1" to clipboard
ez_localization: ^0.1.1 copied to clipboard

outdated

Setup a localization system in your flutter application quickly and easily.

EzLocalization #

This little package allows you to setup a localization system with ease and in only a few minutes.

Getting started #

It only takes a few steps in order to get EzLocalization to work ! First, go where you define your MaterialApp (usually in main.dart) and add the following code :

EzLocalizationDelegate localizationDelegate = EzLocalizationDelegate(supportedLocales: [Locale('en'), Locale('fr')]); // The first language is your default language.
return MaterialApp(
  // title, theme, etc...
  localizationsDelegates: localizationDelegate.localizationDelegates,
  supportedLocales: localizationDelegate.supportedLocales,
  localeResolutionCallback: localizationDelegate.localeResolutionCallback,
);

Then you create a folder named languages in your assets directory with the defined languages in it. An example structure could be :

assets
|
|------ languages
        |
        |--------- en.json
        |--------- fr.json

Here's an example of what en.json can contain :

{
  "hello": "Hello !"
}

Then you translate it in fr.json :

{
  "hello": "Bonjour !"
}

Oh and don't forget to add these assets in your pubspec.yml :

flutter:
  # uses-material-design, ...
  assets:
    - "assets/languages/"

That's it ! To get your string you only have to call EzLocalization.of(context).get('hello').

Features #

Here are some features :

  • Easy, lightweight, open-source.
  • MIT licensed.
  • Classes can easily be overridden.

Contributions #

You have a lot of options to contribute to this project ! You can :

23
likes
0
pub points
83%
popularity

Publisher

verified publisherskyost.eu

Setup a localization system in your flutter application quickly and easily.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_localizations

More

Packages that depend on ez_localization