Last active
December 17, 2015 06:39
-
-
Save najlepsiwebdesigner/5567076 to your computer and use it in GitHub Desktop.
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
/* return pluralized form of input type, with respect to amount | |
* | |
* @param string type - defines type, possible values are: "hodina", "kus", "mesiac" | |
* @return string pluralized type in slovak language | |
*/ | |
function pluralizeAmountSlovak(type, amount){ | |
var dictionary = { | |
hodina : ['hodina', 'hodiny','hodín'], | |
kus : ['kus', 'kusy', 'kusov'], | |
mesiac : ['mesiac', 'mesiace', 'mesiacov'] | |
} | |
if (dictionary[type] != undefined){ | |
if (amount == 1){ | |
return dictionary[type][0]; | |
} | |
else if (amount > 1 && amount < 5) { | |
return dictionary[type][1]; | |
} | |
else { | |
return dictionary[type][2]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment