Skip to content

Instantly share code, notes, and snippets.

@kiurchv
Last active December 14, 2015 10:19
Show Gist options
  • Save kiurchv/5071666 to your computer and use it in GitHub Desktop.
Save kiurchv/5071666 to your computer and use it in GitHub Desktop.
CoffeeScript implementation of pluralize method for russian language
Number::pluralize = (f1, f2, f3) ->
if this % 10 == 1 && this % 100 != 11
"#{this} #{f1}"
else if this % 10 >= 2 && this % 10 <= 4 && (this % 100 < 10 || this % 100 >= 20)
"#{this} #{f2}"
else
"#{this} #{f3}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment