overrideLanguage doesn't work on build

More
5 months 1 week ago - 5 months 1 week ago #4031 by SweatyChair
I wanted to get a term in other lanuage, I use:
I2.Loc.LocalizationManager.GetTranslation("Game", overrideLanguage: "Japanese")

It's working fine in Editor, but not in an Android build, it returns the translation for CURRENT language.

Expected Output: 遊戯
Actual Output: Spiel (currently in Germany language)

Always remember you're unique, just like everyone else.
Last edit: 5 months 1 week ago by SweatyChair.

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

More
5 months 1 week ago - 5 months 1 week ago #4032 by SweatyChair
After running some debug, I can find that the Languages in LanguageSource is empty except the current language:
var index = I2.Loc.LocalizationManager.Sources[0].GetLanguageIndex("Japanese");
print("japanese index=" + index);

var data = I2.Loc.LocalizationManager.Sources[0].GetTermData("Game");
print("data.Languages=" + StringUtils.ArrayToString(data.Languages));

var t = data.GetTranslation(index);
print("t=" + t);

Results in Editor:
japanese index=12
data.Languages=[Game,Juego,Jeu,Gioco,jogos,Spiel,oyun,Gra,Игра,гри,遊戲,游戏,ゲーム,경기,trò chơi,Тоглоом,laro,เกม]
t=Spiel

Results in Android build:
japanese index=12
data.Languages=[,,,,Spiel,,,,,,,,,,,,,,,]
t=

Always remember you're unique, just like everyone else.
Last edit: 5 months 1 week ago by SweatyChair.

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

More
5 months 1 week ago #4033 by Frank
Hi,
To save memory, I2 localization unloads the languages that are not in use, and loads them back when the current language is changed.
If you need to access some of the languages even if they are not the active language, then you need to set them to never unload. That can be done in the Languages tab of the Language source.

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
5 months 1 week ago #4034 by SweatyChair
I see that means sense.

I just need 1 term so it seems not worth doing that, i may just hard code it for now.

Always remember you're unique, just like everyone else.

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

Time to create page: 0.134 seconds
Template by JoomlaShine