i18n-ai-translate
Version:
AI-powered localization CLI, Node library, and GitHub Action. Translate i18next JSON, Gettext PO, Java .properties, and iOS .strings with ChatGPT, Claude, Gemini, or local Ollama models.
84 lines • 2.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PLURAL_RULES = exports.DEFAULT_RULE = void 0;
exports.getPluralRule = getPluralRule;
exports.DEFAULT_RULE = {
categories: ["one", "other"],
forms: "nplurals=2; plural=(n != 1);",
nplurals: 2,
};
exports.PLURAL_RULES = {
ar: {
categories: ["zero", "one", "two", "few", "many", "other"],
forms: "nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);",
nplurals: 6,
},
cs: {
categories: ["one", "few", "other"],
forms: "nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);",
nplurals: 3,
},
de: exports.DEFAULT_RULE,
en: exports.DEFAULT_RULE,
es: exports.DEFAULT_RULE,
fr: {
categories: ["one", "other"],
forms: "nplurals=2; plural=(n > 1);",
nplurals: 2,
},
it: exports.DEFAULT_RULE,
ja: {
categories: ["other"],
forms: "nplurals=1; plural=0;",
nplurals: 1,
},
ko: {
categories: ["other"],
forms: "nplurals=1; plural=0;",
nplurals: 1,
},
nl: exports.DEFAULT_RULE,
pl: {
categories: ["one", "few", "many"],
forms: "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
nplurals: 3,
},
pt: {
categories: ["one", "other"],
forms: "nplurals=2; plural=(n != 1);",
nplurals: 2,
},
ru: {
categories: ["one", "few", "many"],
forms: "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
nplurals: 3,
},
tr: {
categories: ["one", "other"],
forms: "nplurals=2; plural=(n > 1);",
nplurals: 2,
},
uk: {
categories: ["one", "few", "many"],
forms: "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
nplurals: 3,
},
vi: {
categories: ["other"],
forms: "nplurals=1; plural=0;",
nplurals: 1,
},
zh: {
categories: ["other"],
forms: "nplurals=1; plural=0;",
nplurals: 1,
},
};
/**
* @param languageCode - ISO-639-1 code (case-insensitive)
* @returns the plural rule for the language, or `DEFAULT_RULE`
*/
function getPluralRule(languageCode) {
return exports.PLURAL_RULES[languageCode.toLowerCase()] ?? exports.DEFAULT_RULE;
}
//# sourceMappingURL=po_plural_rules.js.map