Set Language Dropdown

More
4 years 6 months ago #4120 by BobRiley
Hello,

So I was integrating a dropdown menu that allows users to switch the language and was playing with the example script "Set Language Dropdown". I noticed something that's kind of detrimental to that script and needs some adjustment.

So what it does is it grabs all the languages on enable, creates those languages for the dropdown and then sets a custom function to call, which cross checks the current languages and the dropdown text.

The issue with this is if i localize the dropdown itself, unless i go in and manually create every variation of the text for that dropdown menu and reference them, the dropdown stops working after changing languages from the core language reference.

This means if i select chinese, the text changes to chinese and tries to use that text to reference the dropdown selection language, which doesn't work.

To combat this i customized that script in a new script and simply saved the languages in the core language type, in a string list and then referenced that list when updating the dropdown value, instead of the dropdown text itself. This ensures that no matter what language the dropdown text is in, it will always change the language appropriately.

So something to consider for the next update/change.

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

More
4 years 5 months ago #4137 by InfiniteMonkey123
What I ended up doing was making sure the font I generated for Chinese had the characters I need to represent the localised name of each other language in it. Then for this dropdown only I don't set the secondary term for the font to use, so it doesn't change on language change.

You could also do it with a separate font that just contains the characters for all the different localised language names, rather than adding them to one of your other language fonts.

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

More
4 years 5 months ago #4140 by BobRiley
Replied by BobRiley on topic Set Language Dropdown
Yea i'm not sure that would solve the issue, the issue is that the system requires the language checked to be in english in script, so it cannot be another language, no matter what font you use.

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

More
4 years 5 months ago #4141 by InfiniteMonkey123
Ah, sorry I misunderstood. We just list the languages in the dropdown in the same order we get them from GetAllLanguages, then use the dropdown value to find the new language, rather than the text:

LocalizationManager.GetAllLanguages()[Languages.value];

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

Time to create page: 0.151 seconds
Template by JoomlaShine