skip to Main Content

When working with Android (Kotlin) there are many strings that are used many times, I package them in a library (carefully translated into many different languages).

When I need to use it, just add that library and use is very easy.

With Flutter how can I do that?

2

Answers


  1. You can create a package for translations with flutter create -t package [package_name] and store translated strings there.

    The package can be imported via path or git repository, see the docs for details.

    Also here is a great piece on implementing l10n in Flutter in a robust way.

    Login or Signup to reply.
  2. check easy_localization package, it allows you to declare your translations in json files matching the languages you want like en.json
    , it.json

    then it provides you with methods to show each string by its JSON key, like:

    final text = Text(("my_string_key".tr());
    

    Which will show the appropriate value on the language which the app is configured to.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search