sindresorhus / plur

Pluralize a word
MIT License
248 stars 21 forks source link

multiple languages? #1

Closed Haroenv closed 9 years ago

Haroenv commented 9 years ago

It seems useful that this doesn't just work in English

arthurvr commented 9 years ago

Well the word + 's' trick indeed won't work in multiple languages. Although like this it does work:

plur('pony', 'ponies', 2);
//=> 'ponies'

I guess if you want better support for multiple languages that's kinda out of scope for this module.

arthurvr commented 9 years ago

Well the word + 's' trick indeed won't work in multiple languages.

That said, it's actually like this in quite a bit of languages other than English.

Haroenv commented 9 years ago

If there were somehow a way to input the language, this would also work in Dutch, providing that this rule is followed:

De apostrof wordt gebruikt bij de meervouds-s van woorden die eindigen op a, e, i, o, u of y, voorafgegaan door een medeklinkerletter of lettergreepgrens.

Which means that there should be an apostrof after a vowel (some other intricacies, but this would be close enough)

sindresorhus commented 9 years ago

There are many better modules that a more feature rich. I just needed a quick super naive one.

whitneyit commented 9 years ago

FYI. The php library inflector offers a very comprehensive english pluralisation class. It takes into account @arthurvr's ponies example as well as many others.