Pluralisation support

More
9 years 3 months ago #953 by EvilRabbit
I don't see any mention of support for dealing with plurals - is this coming? How are people getting around this at the moment?

Please Log in or Create an account to join the conversation.

More
9 years 3 months ago #961 by Frank
Replied by Frank on topic Pluralisation support
Hi,
The plugin doesn't have support for plurals yet.
I started working on that and added part of the inspector for supporting editing plurals. It will work as the Normal/Touch modes, where you set the translation variant for each of the plural forms: (not all forms are needed on every language)

See on the following image that there are tabs for "Zero", "One", "Few", "Many", etc (but currently they are not fully functional)



I'm releasing 2.6.0 tomorrow, so Plurals will not be included there.
However, I'm currently working on adding Parameters to the Localize component, so that they can be used as the source values for the Plurals. I will try having that finished for 2.7.0.


At the moment, whenever I need plurals I manually update the text, like in:
public void OnModifyLocalization()    // This is set as a callback in the Localize component
{
      if (string.IsNullOrEmpty(Localize.MainTranslation))
          return;
 
     int Score = GameManager.Instance.CurrentScore;

     if (Score==0) 
          Localize.MainTranslation = ScriptLocalization.Get("Score_Zero");   // "You got no points"
     else 
     if (Score==1) 
          Localize.MainTranslation = ScriptLocalization.Get("Score_One");   // "You got 1 point"
     else 
     {
          Localize.MainTranslation = ScriptLocalization.Get("Score_Many");   // "You got {SCORE} points"
          Localize.MainTranslation = Localize.MainTranslation.Replace("{SCORE}", Score);
     }
}

Hope that helps
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
7 years 7 months ago - 7 years 7 months ago #2229 by SweatyChair
Replied by SweatyChair on topic Pluralisation support
It will be great if I2 can complete it, since Smart Localization for Unity3D seems already supported it year ago....

Always remember you're unique, just like everyone else.
Last edit: 7 years 7 months ago by SweatyChair.

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds
Template by JoomlaShine