Few suggestions

  • Mouser
  • Topic Author
  • Visitor
  • Visitor
7 years 10 months ago #1538 by Mouser
Few suggestions was created by Mouser
The asset is really great and helpful, thanks for that!

My game works with NGUI and while integration you plugin I faced with some bugs and missed features.
So I decide to post them here to help someone else or (hopefully) to found solutions in fututre updates.

1. CharSet tool is very usefull stuff. But it aggregates characters only from given translations. In my project I use string modifications a lot (like ToTitle or ToUpper), so it would be great to have possibility to include characters in all cases. Also I've changed textArea with result characters to be EditorGUILayout.TextArea instead of GUILayout.TextArea to be able to select and copy.

2. I use UIFonts and faced with some error while loading resources. In DoLocalize_UILabel method of LocalizeNGUI for some reason plugin tries to load UnityEngine.Font first and after null result load UIFont. Checking SecondaryTerm type before loading could fix the problem. Like that:
			if (LocalizationManager.GetTermData(SecondaryTerm).TermType == eTermType.Font)
			{
				Font newFont = GetSecondaryTranslatedObj<Font>(ref MainTranslation, ref SecondaryTranslation);
				if (newFont != null)
				{
					if (newFont != mTarget_UILabel.ambigiousFont)
						mTarget_UILabel.ambigiousFont = newFont;
				}
			}
			else
			{
				UIFont newUIFont = GetSecondaryTranslatedObj<UIFont>(ref MainTranslation, ref SecondaryTranslation);
				if (newUIFont != null && mTarget_UILabel.ambigiousFont != newUIFont)
					mTarget_UILabel.ambigiousFont = newUIFont;
			}

3. That probably would be obsolete after releasing plurar forms but now string with parameters should be changed with using LocalizeCallBack. It uses SendMessage that could only reach active gameObject. It could be changed with C# event or UnityEvent.

That's all I've met. The whole rest localization was like a charm. It's really great to have so powerfull stuff in project like I2 localization.

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

More
7 years 10 months ago - 7 years 10 months ago #1539 by Frank
Replied by Frank on topic Few suggestions
Hi

Thanks a lot for the suggestions!

1. CharSet tool is very usefull stuff. But it aggregates characters only from given translations. In my project I use string modifications a lot (like ToTitle or ToUpper), so it would be great to have possibility to include characters in all cases. Also I've changed textArea with result characters to be EditorGUILayout.TextArea instead of GUILayout.TextArea to be able to select and copy.


I like that idea a lot, so I went and added that to 2.6.6 a6.



(when case-sensitive is off, it will add the lower and uppercase chars of every character it finds, when case-sensitive is on, it will only add the characters is finds)
I will upload that beta tomorrow to the beta folder!

2. I use UIFonts and faced with some error while loading resources. In DoLocalize_UILabel method of LocalizeNGUI for some reason plugin tries to load UnityEngine.Font first and after null result load UIFont. Checking SecondaryTerm type before loading could fix the problem. Like that:


I double checked that changing UIFonts works correctly in my test scenes. The example NGUI scene changes UIFonts based on the language (check the center paragraph).

What problem are you experiencing? The fonts don't change? You get a null pointer exception or any other error?

Could it be that you have a regular font with the same name as the UIFont, and the plugin is finding the regular font instead of the UIFont?
If so, check that the regular font is not in the Resources folder, and is not added to the I2Languages.prefab Assets tab, nor the Localize component "Assets References" section.

3. That probably would be obsolete after releasing plurar forms but now string with parameters should be changed with using LocalizeCallBack. It uses SendMessage that could only reach active gameObject. It could be changed with C# event or UnityEvent.


Callbacks were implemented before Unity 4.6, so I have to roll my own method, instead of using UnityEvents, and C# events doesn't play well with the inspector :-(
However, now that I only support unity 4.6 and newer, I was thinking in using UnityEvents instead.

Problem is that if I change, all projects using callbacks will be broken, so I have to write a wrapper that automatically do the transition. I already have a nice way of doing that, its just that there are some bugs and features I need to finish before this :-( (Ohhh, why the day has so few hours!!!!) But, its in the roadmap!!!


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
Attachments:
Last edit: 7 years 10 months ago by Frank.

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

  • Mouser
  • Topic Author
  • Visitor
  • Visitor
7 years 10 months ago #1540 by Mouser
Replied by Mouser on topic Few suggestions
Hello, Frank.

Very nice to see how fast you are answering!

About the second one: I've weird errors at
obj = Resources.Load<T>(Path)
in ResourceManager. Error was about type casting. For that moment I have not any unity fonts in my project. May be that was some bug with unity caching or smth like that.

But I looked through stack on that DoLocalize_UILabel and have not understand for what reason it's better to try to load one unity font and then try to load UIFont, despite that we alredy know at this point about term type.

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

Time to create page: 0.544 seconds
Template by JoomlaShine