Last active
December 14, 2015 10:19
-
-
Save kiurchv/5071666 to your computer and use it in GitHub Desktop.
CoffeeScript implementation of pluralize method for russian language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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