Localized String Anywhere?

More
5 years 7 months ago - 5 years 7 months ago #3244 by mikethemike
Morning all,

We're considering switching our localization solution from what we have now (inefficient) to I2, but one thing isn't made clear by documentation or your videos:

Can we add a simple localizable string member to a serializable class and have your UI handle the property drawer drawing of it in the editor UI?

Ex: we have structures with "Friendly Name" (m_friendlyName) entries. These friendly names are not directly tied to any specific UI element and can be referenced all over in our code. We'd like for m_friendlyName to be of type LocalizedString (just an example - type name would be whatever your API calls it) and for the editor UI to handle the view of this properly. And then at runtime, when referencing the contents of m_friendlyName, we'd say something like m_friendlyName.Translate() or whatever to get out the actual localized string value.

If this is something that's currently supported, please let me know and i'll be an instant buyer. Thanks!

P.S. I realize this seems like a no-brainer feature to support but you'd be surprised...
Last edit: 5 years 7 months ago by mikethemike.

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

More
5 years 7 months ago #3246 by Frank
Replied by Frank on topic Localized String Anywhere?
Hi,
I2 Localization has a LocalizedString class that its exactly that.
inter-illusion.com/assets/I2Localization...ocalizedStrings.html

It works as a regular string, but when you get its value it always returns the translation to the current language.

For instance, if you have a term named "Term2" with translations to English and Spanish, you can do this:
LocalizedString locString = "Term2";

LocalizationManager.CurrentLanguage = "English";
string translation = locString;   // returns the translation of Term2 to English (e.g. 'This is an example')

LocalizationManager.CurrentLanguage = "Spanish";
string translation = locString;   // returns the translation of Term2 to Spanish (e.g. 'Este es un ejemplo')


The LocalizedString also has a custom inspector that allows selecting the term from a popup.
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.

Time to create page: 0.134 seconds
Template by JoomlaShine