@intlayer/core
Version:
Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.
31 lines (29 loc) • 899 B
JavaScript
import { PLURAL, formatNodeType } from "@intlayer/types/nodeType";
//#region src/transpiler/plural/plural.ts
/**
* Function intended to be used to build intlayer dictionaries.
*
* Allow to pick a content based on a quantity using CLDR pluralization rules
* (`Intl.PluralRules`). The selected category depends on the active locale.
*
* Supported categories: `zero`, `one`, `two`, `few`, `many`, `other`.
* `other` is required as the fallback.
*
* The string content can include a `{{count}}` placeholder, which is
* automatically replaced with the provided count.
*
* Usage:
*
* ```ts
* plural({
* one: '{{count}} вакансия',
* few: '{{count}} вакансии',
* many: '{{count}} вакансий',
* other: '{{count}} вакансий',
* });
* ```
*/
const plural = (content) => formatNodeType(PLURAL, content);
//#endregion
export { plural };
//# sourceMappingURL=plural.mjs.map