Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: breakmachine on November 07, 2013, 05:42:32 AM

Title: Dynamic Localization / Language
Post by: breakmachine on November 07, 2013, 05:42:32 AM
Hi

In my game I download the latest language file from a server and store it using streamwriter. But I don't seem to be able to combine this with Localization.cs without rewriting it. So for the wishlist it would be nice to be able to load languages dynamically. Either by passing a url, a local path or string.

What do you think?
Title: Re: Dynamic Localization / Language
Post by: ArenMook on November 07, 2013, 05:57:33 AM
Sounds useful. You can add the following function to the Localization class:
  1.         /// <summary>
  2.         /// Load the specified asset and activate the localization.
  3.         /// </summary>
  4.  
  5.         public void Set (string languageName, Dictionary<string, string> dictionary)
  6.         {
  7. #if SHOW_REPORT
  8.                 mUsed.Clear();
  9. #endif
  10.                 mLanguage = languageName;
  11.                 PlayerPrefs.SetString("Language", mLanguage);
  12.                 mDictionary = dictionary;
  13.                 UIRoot.Broadcast("OnLocalize", this);
  14.         }
You will also see it in the next update.
Title: Re: Dynamic Localization / Language
Post by: breakmachine on November 11, 2013, 06:00:35 AM
Thanks!