Getting all available languages translated

More
8 years 2 months ago #1251 by Pendantic
Hey I've been really enjoying this plugin but I've had one issue I haven't found a solution to. I'm trying to have a drop down list that displays each language for the players to choose from. So far I've been able to get all the languages I have by doing LocalizationManager.GetAllLanguages () the only problem I have with this is that this seems to give back all the languages in English so the list ends up looking something like this

English
French
Spanish

Where I would like it to be translated into their respective languages so like

English
Français
Espanol

Besides making a hard-written list is there anyway this could be accomplished?

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

More
8 years 2 months ago - 8 years 2 months ago #1254 by Frank
Hi,
That seems like an interesting list to get by default. I will see if I can get the list of all languages in their own languages and add that to the plugin as well.

In the meantime, the easiest way to accomplish that its to setting a term named "LanguagesList" o something like that.
Then the translation to each language its the name of that language.

e.g. Term: LanguageList
English: English
Spanish: Espanol

Then in the script you can get the full term data by calling:
var termData = I2.Loc.LocalizationManager.Sources[0].GetTermData("LanguageList");
var languagesList = new List<string>();
for (int i=0; i<termData.Languages.Length; ++i)
    languagesList.Add( termData.GetTranslation(i) );

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
Last edit: 8 years 2 months ago by Frank.
The following user(s) said Thank You: Pendantic

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

More
8 years 2 months ago #1269 by Pendantic
Thanks that worked! still would be cool to see an integrated list provided by the API but this is great.

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

Time to create page: 0.133 seconds
Template by JoomlaShine