i18n-node icon indicating copy to clipboard operation
i18n-node copied to clipboard

write blueprint on i18n.__n() to json for new phrases

Open mashpie opened this issue 9 years ago • 0 comments

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 кошка

mashpie avatar Feb 28 '16 12:02 mashpie