Author Topic: Localization system  (Read 80365 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization system
« Reply #60 on: January 27, 2015, 04:48:04 AM »
Yes, reference fonts. Look into that feature. You'll create an empty font prefab set to be a Reference, pointing to an actual font with data in it. All your labels will be using this Reference Font prefab. When loading your game, Resources.Load the appropriate font with data in it and set the reference font's value to point to it, thus automatically making your labels use the newly loaded font.

emile_d

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Localization system
« Reply #61 on: January 27, 2015, 07:47:58 AM »
Yes, reference fonts. Look into that feature. You'll create an empty font prefab set to be a Reference, pointing to an actual font with data in it. All your labels will be using this Reference Font prefab. When loading your game, Resources.Load the appropriate font with data in it and set the reference font's value to point to it, thus automatically making your labels use the newly loaded font.

Yes! It works. It recalls me that UIAtlas also has the reference function. Thank you for the support and this handy GUI kit.

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: Localization system
« Reply #62 on: May 02, 2016, 06:14:25 PM »
What workflow to you recommend for doing:

  1. string.Format("Example {0}, {1}", param_a, param_b);

Would you do something like:

  1. label.text = string.Format(label.text, param_a, param_b);

or

  1. label.text = string.Format(Localization.Get(key), param_a, param_b);

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization system
« Reply #63 on: May 03, 2016, 01:50:37 PM »
  1. label.text = Localization.Format(key, param_a, param_b);

hollym16

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Localization system
« Reply #64 on: June 07, 2016, 05:37:13 AM »
Hi, I've been using your system to add multiple languages to my App. Thus far it has been the user selecting a language via a button.
However, is there a way to detect the current language the device is set to and apply that to the App?
Many Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization system
« Reply #65 on: June 09, 2016, 02:51:56 PM »
You can change the Localization.language at any time, such as in a script's Start() function when your app loads up.

hollym16

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Localization system
« Reply #66 on: June 16, 2016, 07:00:23 AM »
Hi,
Is there a way of linking specific audio files to the localised text?
For example, two different audio files are available, one a voice over in English, another a voice over in German.
If English is the selected language, then the English voice over plays.
Is there a way of incorporating it into the CSV file? I need to do this with a number of scenes

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization system
« Reply #67 on: June 18, 2016, 05:11:58 AM »
CSV file is just text. You can only put text in there -- such as the name of your audio file. Then create a script similar to UILocalize that would have an OnLocalize function and would do a
  1. GetComponent<AudioSource>().clip = Resources.Load<AudioClip>(Localization.Get(key));

hollym16

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Localization system
« Reply #68 on: June 20, 2016, 09:39:52 AM »
Would I have to create a CSV file separate from my current one that changes text?
I tried to change the TextLocalize script to specify audio rather than text but I get errors saying 'Cannot implicitly convert type `string' to `UnityEngine.AudioClip'
Sorry, I'm not familiar with such complex coding, could you please explain a little more please?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Localization system
« Reply #69 on: June 24, 2016, 01:50:51 AM »
I posted you the code you need that loads the clip and converts it from text, assigning it to your audio source... Literally everything you need is that one line.