Need better fallback logic on missing translation

More
6 years 3 weeks ago #2862 by studenman
Fallback system is nice because you can create translations only for text that needs it, for example:

"The color is blue" (en-US) => "The colour is blue" (en-UK) --- Translation found
"The dog is nice" (en-US) => "" (en-UK) --- This falls back to en-US, which is good, no translation needed.

But for es-MX (Mexico), I would like if it did not fallback to en-US, but to es-ES (Spain, Euro).

I think the Language needs to reference a fallback language code, and then I2.Loc would follow the fallback chain until it finds a translation.

Follow Tiny Bubbles Development:
Twitter | Facebook | Web

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #2863 by Frank
I like that idea.
The current implementation fallback to the base language, and if not found, then fallback to the first language in the list.

e.g. "es-MX" fallback to "es" which fallback to "en" if not found.

What I think maybe wrong, is that if "es" is not found, then it should fallback to another 'es-XX' language.
The code was design with the idea that you will always have a base language ('es', 'en', etc) and only create variants as needed ('es-Mx', 'en-UK'), and only for those terms that change, and allow the fallback to deal with the terms that are similar between variants.

I will start by adding the check, of falling back to the base language or one other 'es-XX' variant if the base is not found, and only if there is no other variant to fallback to, then go to the first language in the list.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #2864 by studenman

Frank wrote: The current implementation fallback to the base language, and if not found, then fallback to the first language in the list.
e.g. "es-MX" fallback to "es" which fallback to "en" if not found.


Thanks Frank. I'm not sure that's the case. Suppose there's both a base language (say 'es') and region defined (say 'es-ES'). If es-ES exists as a language, but the translation isn't defined (or is blank), it will revert to the code in LanguageSource.TryGetTranslation() where it handles the MissingTranslation.Fallback case. This code just seems to look for the first language that is enabled and use that translation. It doesn't try to look for a logical fallback language, like the base 'es' language.

Thanks for looking into this.
-Stu

Follow Tiny Bubbles Development:
Twitter | Facebook | Web

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #2865 by Frank
You are correct. That's a bug for sure.

The fallback process was supposed to use the same as the GetLanguageIndex that allows discarding the language region.
I will correct that.

Thanks for reporting this!
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The following user(s) said Thank You: studenman

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #2866 by studenman
Also I wanted to add that in my game I'd like to use these regional languages for the ones my users can select:

en-US
en-GB
es-ES
es-MX
es-CO
ja
zh-CN
zh-TW
etc...

In other words, the user would have to select English US or English UK: a "base" English or Spanish doesn't really make sense from a user experience standpoint. However, I will be picking one of those regions to be a fallback for the other regions, if that makes sense. That way my localization team can just add translations for the terms that change in the region and leave everything else blank.

Follow Tiny Bubbles Development:
Twitter | Facebook | Web

Please Log in or Create an account to join the conversation.

More
6 years 3 weeks ago #2868 by Frank
BTW, I just uploaded to the beta folder v2.8.5a1 with a fix for this.

In the case you show, if you have a term with the following translations:
en-US:
en-GB: Translation1
es-ES:
es-MX Translation2
es-AR: Translation3
es-CO:
ja
zh-CN
zh-TW: Translation4

the resulting translation using fallbacks are:
en-US: Translation1
en-GB: Translation1
es-ES: Translation2
es-MX Translation2
es-AR: Translation3
es-CO: Translation2
ja: Translation1
zh-CN: Translation4
zh-TW: Translation4

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

Time to create page: 0.205 seconds
Template by JoomlaShine