Need better fallback logic on missing translation
Can you give more details about what exactly is the issue you notice. I mean, does it happens in the devices or also in the Editor? Do you have disabled languages? What are the different variants of the language that fails?
We noticed an issue with fallbacks
For example, if the current language is set to en-GB, but a particular term is blank, when it goes to find the fallback, en-US, the TermData.Language[ ] entry for that fallback is NULL, so the text is not modified. Is it possible for I2 Loc to automatically load fallback languages, or is it a requirement to call LoadAllLanguages in order for fallback to work correct?
There is already code to handle that.
What happens is that when the game starts, it goes over all languages in SaveLanguages function of the LanguageSource and resolves all NULL translations (which are the 'missing' ones).
This is done in the Export_Language_to_Cache function, Then once all translations are resolved, they are saved to file.
That file has no missing translations on any language, unless all the translations of the term are missing.
Then, all languages are unloaded, and only the current one is loaded.
Whenever the language is changed, that file is loaded, and there is no need to load all the other languages, because that file already have all the fallback translations.
Is that no working for you?
If so, can you please, give me a bit more details on how to reproduce this, I have already a Unity Test with lots of cases (Enabled/disabled languages, 0,1,2,3 Variants, Loading randomly, etc) but haven't been able to reproduce any missbehavior.
Thanks for emailing the LanguageSource, I was able to reproduce the issue and added a fix to v2.8.5a2 which I will upload in a moment.
The issue was that fallbacks where saved correctly to the cache, but the initial language was not updated with those fallbacks until you clicked another language and then returned back.
That works fine now.
Also, while checking this, I saw another issue where some missing translations were filled with their fallbacks after exiting playmode. That's fixed now as well
And, another thing that was driving me crazy, but there was always something more important to fix: if the inspector was open, clicking the languages in the game, didn't update the inspector preview until you did something in the inspector buttons/fields that forced repaint on that window. Now that works fine. As you click the languages in game, the inspector shows the current translation (including the fallback if available)
Hope that helps,
Also, while checking this, I saw another issue where some missing translations were filled with their fallbacks after exiting playmode.
I noticed that problem as well. For example I had a localize component in the inspector while the game was running. The term selected had a en-US translation but not an en-GB translation. Then if I changed the language via the game's UI, I would notice all kinds of funny things happening, like the en-GB in the Localize component inspector would show en-US translation (they would swap) and sometimes you'd exit play mode and both en-US and en-GB would contain the en-US translation. When this happens I restart Unity and that seems to reset things. Otherwise if I make a change to the LanguageSource afterwards in the editor, then it saves all the previously empty en-GB translations with a copy of the en-US translations. Anyway, probably fixed by your changes, I just wanted to mention that problem.