Support => NGUI 3 Support => Topic started by: Aethelwulf on August 08, 2016, 05:56:18 PM
Title: NGUI Localization and Composite Formatting
Post by: Aethelwulf on August 08, 2016, 05:56:18 PM
Does NGUI UILabel support composite formatting?
For example, if I have a label that says "Hello, the time is {0} and {1}" with UILocalization attached, key set to "TimeLabel" with localization.txt as follows:
Language,English,Français
TimeLabel,Hello, the time is{0} and {1}, Bonjour, le temps est {0} et {1}
Is there a function within NGUI that I can access in a label to catch each position in the curly brackets above to replace rather than replace the entire string? Reason I ask is if the language is changed, I'd have to update each label variable or make separate labels for data vs static labels.
Title: Re: NGUI Localization and Composite Formatting
Post by: ArenMook on August 08, 2016, 06:08:31 PM
Only like this:
void OnLocalize ()
{
GetComponent<UILabel>().text= Localization.Format("TimeLabel", a, b);