Author Topic: Dynamic Localization / Language  (Read 3607 times)

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile
Dynamic Localization / Language
« 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?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Dynamic Localization / Language
« Reply #1 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.

breakmachine

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 71
    • View Profile
Re: Dynamic Localization / Language
« Reply #2 on: November 11, 2013, 06:00:35 AM »
Thanks!