0

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?

P/s: I need to find a solution combined with GetX

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

If I use GetX do you have any other solution?
2

You can access the official flutter documentation about internationalising your flutter application here:
i18n | Flutter.

As already mentioned, there is other packages that can do the work, it depends on your needs.

2 Comments

If I use GetX do you have any other solution?
Sorry I don't understand how GetX is linked to your issue
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.

2 Comments

If I use GetX do you have any other solution?
The linked solution is universal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.