Dropdowns

More
8 years 8 months ago #1352 by Caligari
Dropdowns was created by Caligari
So, I'm new to this great product!

1. My first task was to set up a Dropdown to allow the language to be selected, from those defined. Is there such an object/prefab already around? It seemed like something that many people would end up creating for themselves (unless they wanted to create separate buttons).

2. After that I went on to work out how to localize another Dropdown in my UI (I guess I'm using a lot of them at the moment). This dropdown is (also) populated at runtime, based on project data. I'm not overly familiar with Dropdowns, but in the end I found myself creating a LocalizedDropdown script with its own interface to allow for procedural creation and on-the-fly localization. Is there existing experience with dealing with Dropdowns and localization? In the end I have bypassed the Localize scripts entirely, which I'm surprised was necessary. That said, it wasn't difficult to create something functional in a very short time, which I take as a very good sign. :)

My first impressions have easily measured up to my (high) expectations! Impressive work!

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

More
8 years 8 months ago #1353 by Frank
Replied by Frank on topic Dropdowns
Hi,

1. My first task was to set up a Dropdown to allow the language to be selected, from those defined. Is there such an object/prefab already around?


There is no built-in scripts to show the languages in a dropdown using NGUI or UnityUI dropdowns. I guess most games are using buttons for changing languages. so I haven't ever had (as far as I remember) a request for those.
But I see it as a useful, I will add that to my todo list and see if I can include a separated version of the Localize component for Dropdowns and lists.

Said that, there are a few scripts to show query the languages and terms and place them in a dropdown (but those are for the Editor inspectors using the unity immediate mode UI).
see SetLanguage.cs and SetLanguageInspector.cs
also TermsPopup_Drawer.cs for showing all terms in a dropdown

2. After that I went on to work out how to localize another Dropdown in my UI


For localizing a dropdown with I2L, my suggestion is to have a list of the terms that will be included in the dropdown.
Then, in the Start method, subscribe an event to LocalizationManager.OnLocalizeEvent that will make the function you register be called whenever the language changes or there is a need to update the localizations.

Then, whenever you get called, iterate over the list of terms and get their translations using ScriptLocalization.Get(term)

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
8 years 8 months ago #1354 by Caligari
Replied by Caligari on topic Dropdowns
That's not too far from what I did, in both cases - for language selection I looked through the editor and in-game code and found it was not too hard to put what I needed in place; for the other Dropdown I think I set things up manually, rather than subscribing to the event in code, but functionally my solution sounds similar.

It's a joy to use stuff that just works, and is well-engineered! Thanks!

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

Time to create page: 0.134 seconds
Template by JoomlaShine