Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: ajgr on September 18, 2014, 06:38:43 PM

Title: Vanishing Localization Mystery
Post by: ajgr on September 18, 2014, 06:38:43 PM
We have a Mac OS project that uses NGui for localization via CSV file. Works great. For the same project we also use Mac App Store Toolkit. The symptom - after applying the toolkit, no more localization. Everything is in English (default language for my locale). We have one class (MainMenu.cs) that sets up localization. Here is the code executed from Awake ():

Localization.language = "English";

if (Localization.knownLanguages != null) {
   for (int i = 0, imax = Localization.knownLanguages.Length; i < imax; ++i) {
      if (string.Equals (Application.systemLanguage.ToString(), Localization.knownLanguages)) {
         Localization.language = Application.systemLanguage.ToString();
         break;
      }
   }
}

If we attach MainMenu.cs to MainCamera and build - localization works. Once we apply Mac App Store Toolkit, no more localization.

If we attach to UIRoot(2D) and build - localization works. If we apply Mac App Store Toolkit, localization still works.

I worked all afternoon with the author of the toolkit trying to fix the broken localization. Only by accident did we find out, that it mattered where MainMenu.cs was attached. Since the toolkit has no runtime component, this shift in execution was unexpected.

Now it is fairly trivial for me to just attach the localization setup differently for our upcoming release. But it would be good to know what the heck is going on. Here are some params:

Mac OS 10.9.4, latest UT Pro version, NGui 3.7.0 - 3.7.2, current Mac App Store Toolkit

I have a demo project if needed.



Title: Re: Vanishing Localization Mystery
Post by: ajgr on September 19, 2014, 01:18:55 PM
[Solved - kind of]

When the app is built by UT it behaves like an app on Mac OS 10.7 and reads a regular preferences list. As soon as the app is signed via Mac App Store Toolkit, the container is created if there was none or updated otherwise. In the first case the Preferences file is then copied from Preferences. The whole thing is ridiculously complex and stupid. But - none of this has anything to do with NGui :-)

Anyhow, just switching the language in the Mac's System Preferences and relaunching the app, doesn't work on a signed binary. One has to restart the entire machine!

It is an issue that a Unity app will behave differently in this way than a regular Mac OS app and many would call that a bug. It should switch languages when System Preferences are changed. But - in 90% of the cases users don't switch their languages on the fly. And for those who do and have a problem, for now we can just tell them to reboot.