Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
MIT License
403 stars 118 forks source link

fallback to fallback locale for missing strings in translation file #46

Closed cornerman closed 3 years ago

cornerman commented 4 years ago

Currently, if a translation file is incomplete (i.e. a key is missing), then we will show the key instead of a translation. But for me it would be more intuitive to fallback to the fallbackLocale in these cases.

This allows to iteratively translate an App and if something is forgotten or not yet translated, we have a more meaningful placeholder.

Currently, I just load both translation maps (the chosen locale and the fallback locale) and then fallback during lookup. Another alternative is to merge the maps in the beginning and then just have one translation map.

Let me know, what you think. We could also make this a setting.

diegoveloper commented 4 years ago

any news about this PR?

Teifun2 commented 3 years ago

This would be a really good Feature! Is currently nobody Mainlining this repo?

taniket15 commented 3 years ago

any update??

Teifun2 commented 3 years ago

This is so usefull. I started to use cornerman's repository in my pub now! Thanks for this change!

cornerman commented 3 years ago

@bratan Is there a reason for closing this PR? Do you not want to support fallbacks or is there something to improve?

bratan commented 3 years ago

@cornerman - I consider that keys should not be missing from translation files and if they do I would consider it a bug.

cornerman commented 3 years ago

@bratan That is a valid point of view. Though, I have already worked in different teams, where this was not the case and a fallback was required - until the translations where updated for all languages. Taking into account that there are different approaches to this problem and judging by the reactions to this PR, it might make sense to introduce it as an option. You can opt-in if you need it, or work without a fallback if that is better for you.

bratan commented 3 years ago

Introducing this feature as optional would be alright, however an example needs to be provided as well as updating the documentation.

fdietze commented 3 years ago

FYI: I just rebased this branch on the latest master.

guillaumeboehm commented 2 years ago

Hi, hopefully this is not necroposting too much, but I feel like this feature would be very useful too. Especially for projects with community driven translations where I think it is acceptable to go to production even without every translations completed.

simplenotezy commented 1 year ago

@bratan would love to see this feature too; it's a common strategy for many translation providers.

In a startup like ours, we sometimes would like to release without having job done from all translation teams.