One string with multiple terms

More
7 years 8 months ago #2143 by JOY
Hi,

I'd like to use one new string which contains multiple terms from translated one. Ex:
key_1 +"and" + key2

Is it possible? Or I have to create a new term?

Thanks,
Anh

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

More
7 years 8 months ago - 7 years 8 months ago #2146 by Frank
You should use callbacks for that: ( inter-illusion.com/assets/I2LocalizationManual/Callbacks.html )

Create a term like:
MainTerm (English: "{TERM1} and {TERM2}", Spanish "{TERM1} y {TERM2}")

Then, set a callback with a script similar to this:
public void OnModifyLocalization()
{
       if (string.IsNullOrEmpty(Localize.MainTranslation))
               return;
                       
       string term1 = LocalizationManager.GetTermTranslation( "MyTerm1" );
       string term2 = LocalizationManager.GetTermTranslation( "MyTerm2" );
       
       Localize.MainTranslation = Localize.MainTranslation.Replace("{TERM1}", term1);
       Localize.MainTranslation = Localize.MainTranslation.Replace("{TERM2}", term2);
}

Depending on what MyTerm1 and MyTerm2 are, you can also use parameters ( inter-illusion.com/assets/I2LocalizationManual/Parameters.html )

Callbacks are needed if you need the translated MyTerm1, while Parameters are used if you want to set the text "MyTerm1" directly (i.e. a name or a number)

Hope that help,
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: 7 years 8 months ago by Frank.

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

More
7 years 8 months ago #2163 by JOY
Replied by JOY on topic One string with multiple terms
Hi,

Using script is another story. What I suggest is using the spreadsheet itself. It will be much easier for the "none-code" member to work on the translation.

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

More
7 years 8 months ago #2164 by 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.170 seconds
Template by JoomlaShine