Applying global parameters through code

More
3 years 1 month ago #4216 by Graham
I see an old example here http://inter-illusion.com/forum/i2-localization/748-parameters-isn-t-change-when-i-apply-text-by-code#1973http://inter-illusion.com/forum/i2-localization/748-parameters-isn-t-change-when-i-apply-text-by-code#1973 but it seems outdated. Could I get an up to date example of translating a text and applying global parameters at the same time through code?

Thanks

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

More
3 years 1 month ago #4217 by Graham
I've tried: (where the termKey = The best player was {[WINNER}]!)
string dialogue = LocalizationManager.GetTranslation(termKey);
LocalizationManager.ApplyLocalizationParams(ref dialogue, true);

But it doesn't do anything, I've added the GlobalParametersExample component to the scene.

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

More
3 years 1 month ago #4223 by Frank
There seems to be a typo in the tags: instead of {[ }] use {[ ]} (see the order of ] and })

Also, you can avoid using ApplyLocalizationParams by doing:
string dialogue = LocalizationManager.GetTranslation(termKey, applyParameters:true);

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