Skip to content

[General] "Countable" translation #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eraffaelli opened this issue Jan 22, 2016 · 4 comments
Closed

[General] "Countable" translation #291

eraffaelli opened this issue Jan 22, 2016 · 4 comments

Comments

@eraffaelli
Copy link

Following #289, is it possible to make countable translation? To be able to use plural when needed?

For example (in english) :

Showing 1 file/Showing X files

Another example from symfony project :

{0} There are no apples|{1} There is one apple|]1,Inf[ There are %count% apples

(from http://symfony.com/doc/current/book/translation.html)

@andersevenrud
Copy link
Member

It'd be nice, but that example looks very gnarly! Maybe a programatic approach is nicer ? Ex:

'LBL_APPLES': function(arg1) {
  if ( arg1 <= 0 ) {
    return 'There are no apples';
  } else if ( arg1 === 1 ) {
    return 'There is one apple';
  }
  return 'There are {0} apples';
}
var label = _('LBL_APPLES', count);

@eraffaelli
Copy link
Author

Well, the way to do it doesn't really matter ^^ It was just an understanding example that I know.
But in many languages the way to write words need that count, so it would be nice to have it.

You want to put that example in the locales.js files? Or in the "main" files and the locales doesn't change?
Because if we change that, all related translation will need an upgrade.

@andersevenrud
Copy link
Member

The example was generic, it fits in all usecases.

@andersevenrud andersevenrud changed the title "Countable" translation [General] "Countable" translation Jan 25, 2016
@andersevenrud andersevenrud added this to the 2.0.0-beta1 milestone Jan 25, 2016
@andersevenrud
Copy link
Member

#304 superseeds this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants