String text translation with Playmaker?
5 years 9 months ago - 5 years 9 months ago #3553
by Wabby
String text translation with Playmaker? was created by Wabby
Hello,
Just bought your plugin to use in my project (Unity 2018.2 / Playmaker 1.9) and everything works fine with Button, TextMeshPro texts… but also I need a way to use Terms for String variables (for exemple : in my RPG game, there is a log panel which display a lot of messages sended to TextMeshPro objects).
Maybe by using the "Set Term" action? But I Don't understant how!
Can you help me, please?
Just bought your plugin to use in my project (Unity 2018.2 / Playmaker 1.9) and everything works fine with Button, TextMeshPro texts… but also I need a way to use Terms for String variables (for exemple : in my RPG game, there is a log panel which display a lot of messages sended to TextMeshPro objects).
Maybe by using the "Set Term" action? But I Don't understant how!
Can you help me, please?
Last edit: 5 years 9 months ago by Wabby.
Please Log in or Create an account to join the conversation.
5 years 9 months ago - 5 years 9 months ago #3559
by Wabby
Replied by Wabby on topic String text translation with Playmaker?
ok… i'm using the "Set Term" action even if I Don't understant what "Secondary term" means.
Last edit: 5 years 9 months ago by Wabby.
Please Log in or Create an account to join the conversation.
5 years 9 months ago - 5 years 9 months ago #3560
by Frank
All Localize components have 2 terms. The Primary and the Secondary Term.
When the target is a label, the Primary term changes the Text, and the Secondary term changes the Font or material used.
When the target is a UI.Image, the Primary term changes the sprite used, and the Secondary term changes the Atlas,
etc.
And then you use PlayMaker to take the value of MyString and apply it to a TextMeshPro label.
If thats the case, then, yes, you should use SetTerm.
But, the content of MyString should be a term name, not the translation.
What I mean, is that MyString should have a text matching one of your Terms, then, when you take that value and call SetTerm, the plugin will find the Term matching that value, get the translation to the current language and apply that to TextMeshPro label.
To simplify this even more, there is an attribute that converts the string inspector into a Term selection popup. Just change your code to this:
Hope that helps,
Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic String text translation with Playmaker?
i'm using the "Set Term" action even if I Don't understant what "Secondary term" means
All Localize components have 2 terms. The Primary and the Secondary Term.
When the target is a label, the Primary term changes the Text, and the Secondary term changes the Font or material used.
When the target is a UI.Image, the Primary term changes the sprite used, and the Secondary term changes the Atlas,
etc.
If I understood you correctly, you have a class in your code similar to this one:but also I need a way to use Terms for String variables
class LogPanel
{
public string MyString;
}
And then you use PlayMaker to take the value of MyString and apply it to a TextMeshPro label.
If thats the case, then, yes, you should use SetTerm.
But, the content of MyString should be a term name, not the translation.
What I mean, is that MyString should have a text matching one of your Terms, then, when you take that value and call SetTerm, the plugin will find the Term matching that value, get the translation to the current language and apply that to TextMeshPro label.
To simplify this even more, there is an attribute that converts the string inspector into a Term selection popup. Just change your code to this:
class LogPanel
{
[TermsPopup] public string MyString;
}
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
Last edit: 5 years 9 months ago by Frank.
Please Log in or Create an account to join the conversation.
5 years 9 months ago #3561
by Wabby
Replied by Wabby on topic String text translation with Playmaker?
Hello Frank and thank you very much for the clarification, it helps a lot.
In fact, I'm using the "Set Term" action or in other situation, the "Get Translation" to put the result in a String variable and build another variable with it (exemple : a translated term + an int variable).
Anyway, your product is very good and well implemented in my game, now : twitter.com/WabbysLand
In fact, I'm using the "Set Term" action or in other situation, the "Get Translation" to put the result in a String variable and build another variable with it (exemple : a translated term + an int variable).
Anyway, your product is very good and well implemented in my game, now : twitter.com/WabbysLand
Please Log in or Create an account to join the conversation.
Time to create page: 0.168 seconds