Changing text with 2D Toolkit
- JHoffstein
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
10 years 2 months ago #278
by JHoffstein
Changing text with 2D Toolkit was created by JHoffstein
Hello again! I'm using I2 Localization with 2D Toolkit. In my scenes I frequently update the text in the tk2d TextMesh, but I'm not sure how to get this to update the localized text as well. For example:
TextMesh reads "KEY A", which gets localized to "This is Key A". I then update the TextMesh to "KEY B". It now reads "KEY B", instead of being properly localized to "This is Key B."
How can I do this? Do I need to have individual TextMesh objects for every different string I want to localize?
Thanks,
Jenna
TextMesh reads "KEY A", which gets localized to "This is Key A". I then update the TextMesh to "KEY B". It now reads "KEY B", instead of being properly localized to "This is Key B."
How can I do this? Do I need to have individual TextMesh objects for every different string I want to localize?
Thanks,
Jenna
Please Log in or Create an account to join the conversation.
10 years 2 months ago #279
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Changing text with 2D Toolkit
To change the term at runtime, you only need to get the Localize component you added to your TextMesh, assign the new Term to the MainTranslation (thats the primary term) and call OnLocalize.
Thanks,
Frank
I2.Loc.Localize LocalizeCp = TextMeshGO.GetComponent<I2.Loc.Localize>();
LocalizeCp.MainTranslation = "KEY B";
LocalizeCp.OnLocalize();
Thanks,
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.
- JHoffstein
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
10 years 2 months ago #283
by JHoffstein
Replied by JHoffstein on topic Changing text with 2D Toolkit
For anyone using Playmaker with 2d Toolkit, here's how I was able to accomplish this:
1) Use the "Set Property" action to set the new term (aka localization key) that you want. Drag the localize script on your textmesh into the "Target Object" field, and select "mTerm" as your Property. Type in whatever you want your new key to be.
2) Use the "Call Method" action to call OnLocalize. Again, drag the localize script on your textmesh into "Behavior", then type "OnLocalize" (without the quotes) into the Method Name field. You don't need any parameters.
Here's what my state looks like:
1) Use the "Set Property" action to set the new term (aka localization key) that you want. Drag the localize script on your textmesh into the "Target Object" field, and select "mTerm" as your Property. Type in whatever you want your new key to be.
2) Use the "Call Method" action to call OnLocalize. Again, drag the localize script on your textmesh into "Behavior", then type "OnLocalize" (without the quotes) into the Method Name field. You don't need any parameters.
Here's what my state looks like:
Attachment Loc.png not found
Attachments:
Please Log in or Create an account to join the conversation.
Time to create page: 0.195 seconds