Dynamic text

More
2 years 7 months ago #4388 by JmPrsh
Dynamic text was created by JmPrsh
So i spanw in a text gameobject which changes its whole line depending on the language. Any idea how i can dynamically control this? controlling static text is easy but text that i change seems a pain

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

More
2 years 7 months ago #4389 by Frank
Replied by Frank on topic Dynamic text
Hi,
Instead of changing the text, change the term.

so, instead of doing:
go.text = "Level Completed";
go.text = "Level Failed";

you should create a term for each text you want to set (so that they could be translated).

and then do:
go.GetComponent<I2Localize>().SetTerm("Level Completed");
go.GetComponent<I2Localize>().SetTerm("Level Failed");

The SetTerm will find the translation of the "Level Completed" to the current language and set the .text with that translation.

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.

More
2 years 7 months ago #4391 by JmPrsh
Replied by JmPrsh on topic Dynamic text
So i found out how to do it in a specific way before i reply to your comment. I basically use this ... go.text = LocalizationManager.GetTranslation("Level complete"); and then fail... although looking through the code it looks like it would have to go through a foreach loop each time so maybe your suggesting would be better instead

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

More
2 years 7 months ago #4392 by JmPrsh
Replied by JmPrsh on topic Dynamic text
Also i use the get component etc but I2Localize cannot be found for some reason

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

Time to create page: 0.154 seconds
Template by JoomlaShine