Last active
December 19, 2015 01:38
-
-
Save pfried/5876966 to your computer and use it in GitHub Desktop.
polyglot.js example
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
$(document).ready(function() { | |
var phrases = { | |
"car" : "%{smart_count} Auto |||| %{smart_count} Autos" | |
}; | |
var polyglot = new Polyglot({phrases : phrases, locale : "de"}); | |
// Zero form | |
console.log(polyglot.t("car",{ "smart_count" : 0})); | |
// Singular form | |
console.log(polyglot.t("car",{ "smart_count" : 1})); | |
// Plural form | |
console.log(polyglot.t("car",{ "smart_count" : 11})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment