Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: breakmachine on November 15, 2013, 12:19:16 AM

Title: UILocalize: best practice for replacing/inserting variables
Post by: breakmachine on November 15, 2013, 12:19:16 AM
How would you go about inserting dynamic values on a label with UILocalize?

Let's say the text should read: "You got 400 points" where 400 is dynamic.

Would you make a class that replaces text in OnLocalize? Will script order endure it's being called after OnLocaluze in UILocalize?
Title: Re: UILocalize: best practice for replacing/inserting variables
Post by: ArenMook on November 15, 2013, 04:31:48 AM
If your localization string is:
Quote
My Key = You got {0} points
Then you can set the label's text like so:
  1. label.text = string.Format(Localization.Get("My Key"), 400);