Add support for fallbackLanguage#181
Add support for fallbackLanguage#181thp wants to merge 1 commit intorubenv:masterfrom thp:fallback-language
Conversation
This is useful for situations where ID-based translations
are used and where a fallback to another language is desirable.
Example:
* Source strings are ID-based, e.g. `LABEL_SOMETHING`
* Strings are translated to English: e.g. "Something"
* Strings are translated to German, but missing some translations
Setting:
```
gettextContext.setCurrentLanguage('de');
gettextContext.setFallbackLanguage('en');
```
Should then return the English string if the German string is not
available (e.g. `LABEL_SOMETHING` returns "Something" in German).
|
I'm not sure I want to encourage ID-based translations. One of the main reasons I built this library is because ID-based translation systems are just a pain in the ass (and wrong). If you want to do ID-based translations, I suggest you look into a framework that is built for it (e.g. angular a translate). |
|
Ok, maybe ID-based translations was the wrong argument for this feature addition. Assume the source strings are "Engineering English" and there is a "US English" translation and a "German" translation, and instead of falling back to the source strings, a missing string in the "German" translation should fall back to the "US English" translation:
Now, with |
This is useful for situations where ID-based translations
are used and where a fallback to another language is desirable.
Example:
LABEL_SOMETHINGSetting:
Should then return the English string if the German string is not
available (e.g.
LABEL_SOMETHINGreturns "Something" in German).