Welcome, Guest
Username: Password: Remember me

TOPIC: Using plural with multiple parameters

Using plural with multiple parameters 1 year 2 days ago #2636

  • Unitybear
  • Unitybear's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
Hey

I just downloaded the new version with plural support and was trying to implement it. I just wanted to be sure if I was running into a limitation or if there's another way to do it.

I have a label like so: You got X in Y tries

This would then have the following keys in English:
You got X in Plural tries
You got X in Singular try
You got X in Zero tries

Now given that X can be a singular or plural number will both X and Y have to be singular for it to be registered as singular?
The administrator has disabled public write access.

Using plural with multiple parameters 1 year 2 days ago #2637

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 1146
  • Thank you received: 246
  • Karma: 74
Hi,
Because of how many combinations can be to correctly handling plurals for several parameters (e.g. You got X (POINT/POINTS) in Y (TRY/TRIES)), the plugin is currently only using the first parameter to determine the plural type.
So, in your case, if you X is plural, you will get 'You got X in Y tries', and 'You got X in Y try' if X is singular, no matter whatever Y is plural or singular.

If you instead want to handle plurals just for the Y and ignore the X, you will have to use a localization callback.

Just make Y the only parameter, and then replace X in your callback.

For example, the translation will be 'You got <X> in {[Y]} tries".
When translating that, the plugin will replace {[Y]} automatically, and then will call the Callback, where you can do:
mainTranslation.Replace("<X>", 5);

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
The administrator has disabled public write access.

Using plural with multiple parameters 1 year 1 day ago #2638

  • Unitybear
  • Unitybear's Avatar
  • Offline
  • New Member
  • Posts: 2
  • Karma: 0
Hey

Yeah, just wanted to make sure.

Thanks
The administrator has disabled public write access.
Time to create page: 0.187 seconds
Template by JoomlaShine