i18n-node
i18n-node copied to clipboard
write blueprint on i18n.__n() to json for new phrases
a code like
res.setLocale('ru');
res.__n('%s cat', 1);
should result in a structure like, when "%s cat" is missing in json file
{
"%s cat": {
"one": "%s cat",
"few": "%s cat",
"many": "%s cat",
"other": "%s cat",
}
}
which can than be translated in json like so:
{
"%s cat": {
"one": "%d кошка",
"few": "%d или",
"many": "%d кошек",
"other": "%d кошка",
}
}
to get the output of
res.__n('%s cat', 0); // --> 0 кошек
res.__n('%s cat', 1); // --> 1 кошка
res.__n('%s cat', 2); // --> 2 или
res.__n('%s cat', 5); // --> 5 кошек
res.__n('%s cat', 6); // --> 6 кошек
res.__n('%s cat', 21); // --> 21 кошка