Get translation/asset with specified language

More
6 years 4 months ago #2639 by OrangyTang
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.

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

More
6 years 4 months ago #2642 by Frank
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

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

Time to create page: 0.136 seconds
Template by JoomlaShine