NGUI UILabel - can't translate text

More
5 years 3 months ago #3926 by holms
Hello Everyone!
I have a pretty strange problem.

I added the "l2 Localize" component to NGUI UILabel.
While playing an app in Unity Editor the language is changed from the code:

LocalizationManager.CurrentLanguage = "English";

But label's text is not changing.

I noticed, that l2 localize's Target has only one option "Prefab".
I supposed it should also have a Text option, but it doesn't.
Screenshots are attached.

Please, help me to figure out, why label's text is not translating.

I'm using:
- Unity 5.6.5
- l2 localization 2.8.12
- NGUI 3.9.2.

Many thanks in advance.
Attachments:

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

More
5 years 3 months ago #3927 by Frank
Hi,
If you don't have the NGUI Label option in the I2 Localize Target's dropdown, then it means the integration is not set correctly for NGUI.

Can you verify you followed this steps:
inter-illusion.com/assets/I2Localization...lizationTargets.html

and that NGUI is defined in your Scripting Define Symbols

After that, you should be able to see NGUI Label in the dropdown and it should detect automatically any new I2Localize component you add to an NGUI label.

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

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

More
5 years 3 months ago #3928 by holms
Thanks a lot for your quick response.

I've manually added NGUI to "Scripting Define Symbols" and it brings the next compile errors:
Assets/I2/Localization/Scripts/Targets/LocalizeTarget_NGUI_Label.cs(51,17): error CS0246: The type or namespace name `NGUIFont' could not be found. Are you missing an assembly reference?
Assets/I2/Localization/Scripts/Targets/LocalizeTarget_NGUI_Sprite.cs(45,17): error CS0246: The type or namespace name `NGUIAtlas' could not be found. Are you missing an assembly reference?

It seems my version of the NGUI (3.9.2) is too old and have neither NGUIFont nor NGUIAtlas.
So, I've commented out the if-branches from LocalizeTarget_NGUI_Label.cs and LocalizeTarget_NGUI_Sprite.cs.

Then I realized somehow there is no NGUI definition in "Scripting Define Symbols".
I added it again, Unity started compiling something, shown some warnings and again NGUI disappeared from "Scripting Define Symbols". And there is still Prefab only in Targets on UILabel.
What a magic.

What is better to do?
Should I upgrade NGUI to the latest version or there is more cheaper way to fix it?
Thank you.

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

More
5 years 3 months ago #3929 by Frank
Hi,
What looks to be happening, is that how your NGUI is too old, it doens't have the classes that I2 Localization uses for detecting if you have NGUI installed.
So, even if you manually set NGUI into the Script Define Symbols, when the editor compiles, it runs the automatic detection and thinks NGUI is not installed, so, it removes NGUI from the symbols.

If you can't update to a newer NGUI now, you could avoid thet problem by clicking in the menu the "Disable Auto Detection". Then comment the lines you did before to avoid the classes you don't have.

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

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

More
5 years 3 months ago #3930 by holms
You saved my day! Many thanks for the advice. Now everything is working. B)

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

Time to create page: 0.143 seconds
Template by JoomlaShine