Set Language Dropdown

1 month 4 days ago #4120 by BobRiley

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.

Time to create page: 0.169 seconds
Template by JoomlaShine