Welcome, Guest
Username: Password: Remember me

TOPIC: Get translation/asset with specified language

Get translation/asset with specified language 11 months 3 weeks ago #2639

Hello!

I'd like to lookup an ID to a translation and a translated asset, but with a language I specify. eg. something like:

LocalizationManager.TryGetTermTranslation(id, out translatedId, "LanguageID");

Is this possible? I could only find this post from a while back, but I can't see the changes in the source I have locally.

www.inter-illusion.com/forum/i2-localiza...age-parameter-to-get

Thanks.
The administrator has disabled public write access.

Get translation/asset with specified language 11 months 3 weeks ago #2642

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1146
  • Thank you received: 246
  • Karma: 74
Hi,
In the latest release, the GetTranslation and TryGetTranslation functions have a parameter to override the language:
class LocalizationManager
{
.....
        public static string GetTranslation(string Term, bool FixForRTL = true, int maxLineLengthForRTL = 0, bool ignoreRTLnumbers = true, bool applyParameters = false, GameObject localParametersRoot = null, string overrideLanguage = null)
        public static bool TryGetTranslation(string Term, out string Translation, bool FixForRTL = true, int maxLineLengthForRTL = 0, bool ignoreRTLnumbers = true, bool applyParameters = false, GameObject localParametersRoot = null, string overrideLanguage = null)
....
}

To call it, you just need to pass all parameters like in:
LocalizationManager.TryGetTranslation(id, out translatedid, true, 0, true, false, null, "Spanish");

or simply add it as a named parameter
LocalizationManager.TryGetTranslation(id, out translatedid,  overrideLanguage:"Spanish");

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.241 seconds
Template by JoomlaShine