Author Topic: Localization tutorial  (Read 7544 times)

luisdiv

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Localization tutorial
« on: June 20, 2012, 11:31:10 AM »
Hi,

I've searched the forums and tutorials, but couldn't find a tutorial or step by step guide on how to use Localization. I would like to be able to change languages like in the example http://www.tasharen.com/ngui/example10.html.
I'm very new to NGUI, but already making some progress.. It's an amazing tool!

Is there any guide or link with instructions already? If else, could anybody point me in the right direction?

Thanks in advance...!

Luis

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization tutorial
« Reply #1 on: June 20, 2012, 12:42:03 PM »
Not a whole lot to it. To make a label or a sprite localizeable, just attach UILocalize script to it. You'll need to specify a key to use. The key is pulled from the current language file, so if Localization.currentLanguage = "English", then English.txt file contains something like:
  1. Greeting = Hello World
...then if you set your UILocalize's key to be "Greeting", the value (label's text or sprite name) will come out to be "Hello World".

luisdiv

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Localization tutorial
« Reply #2 on: June 20, 2012, 02:22:55 PM »
Thanks Aren! It now seems way easier.

I have prepared everything, yet choosing a Starting Language in the localization script, doesn't change the value ???. It keeps giving me English when I specify something else. What could I be missing?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization tutorial
« Reply #3 on: June 20, 2012, 02:24:03 PM »
Are you using the latest version? Prior to 2.0.8 the starting language value was overwritten by player prefs.

luisdiv

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Localization tutorial
« Reply #4 on: June 20, 2012, 02:31:07 PM »
I thought I had... We bought NGUI last week I think.. I'm running 2.0.7c
Guess that will solve the problem. If I run against anything else, I will tell.

Thank you very much once again!