Bug detected

More
4 years 9 months ago #511 by Garcia
Bug detected was created by Garcia
Hi,

I've been having an issue when using the last version of I2.

At the beginning of the execution I2 puts the term correctly in the text field of the NGUI label, but later when I change the term in my code using SetTerm() it doesn't change the text field of the label.

The error appears to be because of a new if statement in Localize.cs, line 115:

if (string.IsNullOrEmpty(FinalTerm) || string.IsNullOrEmpty(FinalSecondaryTerm))
GetFinalTerms( out FinalTerm, out FinalSecondaryTerm );

if I comment that if statement and leave it as it was in previous versions of the plugin (GetFinalTerms(...) alone) it works.

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

More
4 years 9 months ago #512 by Frank
Replied by Frank on topic Bug detected
Hi,
Thanks for reporting this issue.

Reverting the lines you shown are not a good idea as those lines are the one that allows the plugin to get the term from the Label's text but only if no term was specified.

A better solution is to hint the plugin that it shouldn't get the default value if you called a SetTerm(xx).
To do this, you should replace the SetTerm function by the following one:

Localize.cs line 252:
		public void SetTerm (string primary, string secondary=null)
		{
			if (!string.IsNullOrEmpty(primary))
				FinalTerm = Term = primary;
			if (!string.IsNullOrEmpty(secondary))
				FinalSecondaryTerm = SecondaryTerm = secondary;

			OnLocalize ();
		}

I'm including this changes in 2.4.3 f1

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.

More
4 years 9 months ago #518 by Garcia
Replied by Garcia on topic Bug detected
Thank you for the code it works great!!

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

Time to create page: 0.114 seconds
Template by JoomlaShine