Author Topic: Localization prioritization  (Read 3463 times)

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Localization prioritization
« on: May 28, 2012, 01:14:08 PM »
Hey Aren,

I was wondering if the value for "Starting Language" should be higher priority than the playerprefs, since currently it ignores it and goes with what the playerprefs value is. It took me a while to figure out why it choose spanish as my language when I clearly said English should be the Starting Language, but it was because I started testing spanish first so what happened was it stored that value in the playerprefs and the only way to change that value was to either set the language manually or delete the prefs.

Thanks,
Rani

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization prioritization
« Reply #1 on: May 28, 2012, 01:24:37 PM »
The problem is that the Localization may not be present yet when the current language is checked. It's also possible to not have an instance of Localization at all. You can try this: add this Start function:

  1. /// <summary>
  2. /// Start with the specified starting language.
  3. /// </summary>
  4.  
  5. void Start () { if (!string.IsNullOrEmpty(startingLanguage)) currentLanguage = startingLanguage; }

Also add this:

  1. startingLanguage = value;

... right after line 86 (inside the currentLanguage.set).