Welcome, Guest
Username: Password: Remember me

TOPIC: SetTerm won't update

SetTerm won't update 3 years 3 weeks ago #893

  • adamliu
  • adamliu's Avatar
  • Offline
  • New Member
  • Posts: 14
  • Karma: 0
Hi, I need to change the term in the script but according to this post, the SetTerm() should update the translation automatically. But after I called the SetTerm(), i can only see the change updated in the editor, in the game view nothing changes. How can I solve this issue? Thanks!
The administrator has disabled public write access.

SetTerm won't update 3 years 3 weeks ago #894

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1112
  • Thank you received: 234
  • Karma: 68
Hi,
Thanks for reporting this issue.

If this is happening to you in version 2.6.0, then its because of a regression introduced by the optimizations made to not localize multiple times when the language changes.
I just uploaded a new beta (2.6.0 b5) that corrects the issue.

You can also fix the issue by replacing the SetTerm function (file Localize.cs, line 269-277) with this one:
		public void SetTerm (string primary, string secondary=null)
		{
			if (!string.IsNullOrEmpty(primary))
				FinalTerm = Term = primary;
			if (!string.IsNullOrEmpty(secondary))
				FinalSecondaryTerm = SecondaryTerm = secondary;

			OnLocalize (true);   //   this was changed to add the <true>
		}

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
The administrator has disabled public write access.

SetTerm won't update 3 years 3 weeks ago #895

  • adamliu
  • adamliu's Avatar
  • Offline
  • New Member
  • Posts: 14
  • Karma: 0
Thanks Frank. I'll try the solution and see it fixes my problem. Also, I was using version 2.6.0 b4, and actually the version displayed in the plugin is 2.3.0 b4 which is also a mistake in case you didn't notice it.Frank wrote:
Hi,
Thanks for reporting this issue.

If this is happening to you in version 2.6.0, then its because of a regression introduced by the optimizations made to not localize multiple times when the language changes.
I just uploaded a new beta (2.6.0 b5) that corrects the issue.

You can also fix the issue by replacing the SetTerm function (file Localize.cs, line 269-277) with this one:
		public void SetTerm (string primary, string secondary=null)
		{
			if (!string.IsNullOrEmpty(primary))
				FinalTerm = Term = primary;
			if (!string.IsNullOrEmpty(secondary))
				FinalSecondaryTerm = SecondaryTerm = secondary;

			OnLocalize (true);   //   this was changed to add the <true>
		}

Hope that helps
Frank
The administrator has disabled public write access.

SetTerm won't update 3 years 2 weeks ago #897

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1112
  • Thank you received: 234
  • Karma: 68
I was using version 2.6.0 b4, and actually the version displayed in the plugin is 2.3.0 b4

Haha, nice catch!
I was testing that the update notifications could be disabled and forgot to reset the version to the latest!

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
The administrator has disabled public write access.

SetTerm won't update 3 years 2 weeks ago #907

  • Stiv
  • Stiv's Avatar
  • Offline
  • New Member
  • Posts: 17
  • Karma: 0
Hi Frank, I'm also having problems with SetTerm but I'm using the latest 2.6.0 b5 build.

It works most of the time, but doesn't seem to work on my prefabs where I SetTerm before displaying it. I've tried toggling the "Pre-Localize on Awake" option but neither setting helped. Any suggestions? Is there any way to force it to do the translation? Although I guess that's what "OnLocalize (true)" should be doing.
The administrator has disabled public write access.

SetTerm won't update 3 years 2 weeks ago #915

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1112
  • Thank you received: 234
  • Karma: 68
Hi,
I tried reproducing the issue with instantiating a prefab and calling SetTerm but it is working for me. I tried executing the following code:
			var go = GameObject.Instantiate( prefabText ) as GameObject;
			go.transform.parent = CanvasGO.transform; // only did this because prefabText was an UGUI text

			var loc = go.GetComponent<Localize>();
			loc.SetTerm("Otro");

I tried running that code when I clicked a button, then on the Start() method and finally on the Awake() method of a custom script.
No matter where, it was always working for me.
Just notice that if the prefab have Unity New UI texts, and you execute on the Awake, the text changes, but the RectTransform may collapse if its not set anchored correctly.

Can you tell me what steps I can do to reproduce your issue and if you can show me a section of the instantiation code you are using, I can try reproducing it over here.

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
The administrator has disabled public write access.
Time to create page: 0.222 seconds
Colors