wy-ei / vue-filter

:v: A collection of Vue.js filter. [Depressed]
MIT License
353 stars 37 forks source link

Feature request: pluralize #27

Open alfonsobries opened 5 years ago

alfonsobries commented 5 years ago

Pluralize filters:

{{ count | pluralize('comment') }}

Could be simple just add an S at the end, and add optional parameter for custom values like

pluralize(word, [word_in_plural], [word_if_zero])

{{ count | pluralize('comment', 'comments', 'no comments') }}
wy-ei commented 5 years ago

@alfonsobries

This pluralize function may useful in the English world, but I think it is not very common use. I am not sure. Perhaps in the English language environment it is often used.

I recommend you implement this function based on your custom requirement. There are some JavaScript package do this well, and I am not sure I can implement this function well. Sometimes I don't know how to add s , es and y->i + es properly. :(