Welcome, Guest
Username: Password: Remember me

TOPIC: Localized String Anywhere?

Localized String Anywhere? 3 weeks 5 days ago #3244

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: 3 weeks 5 days ago by mikethemike.
The administrator has disabled public write access.

Localized String Anywhere? 3 weeks 4 days ago #3246

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1129
  • Thank you received: 241
  • Karma: 70
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
The administrator has disabled public write access.
Time to create page: 0.209 seconds
Colors