\n\n\n```\n\n \n \n\nTo use plural content in Svelte components, retrieve it via the `useIntlayer` hook and call it with a count. The store is accessed with `$`. Here's an example:\n\n```svelte fileName=\"**/*.svelte\"\n\n\n
\n

{$content.totalOpenings(count)}

\n
\n```\n\n
\n \n\nTo use plural content in Preact components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\nimport type { FC } from \"preact\";\nimport { useIntlayer } from \"preact-intlayer\";\n\nconst OpeningsComponent: FC<{ count: number }> = ({ count }) => {\n const { totalOpenings } = useIntlayer(\"total_openings\");\n\n return (\n
\n

{totalOpenings(count)}

\n
\n );\n};\n\nexport default OpeningsComponent;\n```\n\n
\n \n\nTo use plural content in SolidJS components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\nimport type { Component } from \"solid-js\";\nimport { useIntlayer } from \"solid-intlayer\";\n\nconst OpeningsComponent: Component<{ count: number }> = (props) => {\n const { totalOpenings } = useIntlayer(\"total_openings\");\n\n return (\n
\n

{totalOpenings(props.count)}

\n
\n );\n};\n\nexport default OpeningsComponent;\n```\n\n
\n \n\nTo use plural content in Angular components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```typescript fileName=\"app.component.ts\" codeFormat=\"typescript\"\nimport { Component, Input } from \"@angular/core\";\nimport { useIntlayer } from \"angular-intlayer\";\n\n@Component({\n selector: \"app-openings\",\n template: `\n
\n

{{ content().totalOpenings(count) }}

\n
\n `,\n})\nexport class OpeningsComponent {\n @Input() count!: number;\n\n content = useIntlayer(\"total_openings\");\n}\n```\n\n
\n \n\nTo use plural content with `vanilla-intlayer`, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```typescript fileName=\"**/*.ts\" codeFormat={[\"typescript\", \"esm\"]}\nimport { installIntlayer, useIntlayer } from \"vanilla-intlayer\";\n\ninstallIntlayer();\n\nconst content = useIntlayer(\"total_openings\").onChange((newContent) => {\n document.getElementById(\"openings\")!.textContent =\n newContent.totalOpenings(5);\n});\n\n// Initial render\ndocument.getElementById(\"openings\")!.textContent = content.totalOpenings(5);\n```\n\n \n\n## When to Use `plural` vs `enu`\n\n\n \n\nTo use plural content inside a React component, retrieve it via the `useIntlayer` hook and call it with a count. The active locale and the count are combined to pick the matching CLDR category.\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\nimport type { FC } from \"react\";\nimport { useIntlayer } from \"react-intlayer\";\n\nconst OpeningsComponent: FC<{ count: number }> = ({ count }) => {\n const { totalOpenings } = useIntlayer(\"total_openings\");\n\n return (\n
\n

{totalOpenings(count)}

\n
\n );\n};\n\nexport default OpeningsComponent;\n```\n\n
\n \n\nTo use plural content in Next.js Client Components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\n\"use client\";\n\nimport type { FC } from \"react\";\nimport { useIntlayer } from \"next-intlayer\";\n\nconst OpeningsComponent: FC<{ count: number }> = ({ count }) => {\n const { totalOpenings } = useIntlayer(\"total_openings\");\n\n return (\n
\n

{totalOpenings(count)}

\n
\n );\n};\n\nexport default OpeningsComponent;\n```\n\n
\n \n\nTo use plural content in Vue components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```vue fileName=\"**/*.vue\"\n\n\n\n```\n\n \n \n\nTo use plural content in Svelte components, retrieve it via the `useIntlayer` hook and call it with a count. The store is accessed with `$`. Here's an example:\n\n```svelte fileName=\"**/*.svelte\"\n\n\n
\n

{$content.totalOpenings(count)}

\n
\n```\n\n
\n \n\nTo use plural content in Preact components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\nimport type { FC } from \"preact\";\nimport { useIntlayer } from \"preact-intlayer\";\n\nconst OpeningsComponent: FC<{ count: number }> = ({ count }) => {\n const { totalOpenings } = useIntlayer(\"total_openings\");\n\n return (\n
\n

{totalOpenings(count)}

\n
\n );\n};\n\nexport default OpeningsComponent;\n```\n\n
\n \n\nTo use plural content in SolidJS components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\nimport type { Component } from \"solid-js\";\nimport { useIntlayer } from \"solid-intlayer\";\n\nconst OpeningsComponent: Component<{ count: number }> = (props) => {\n const { totalOpenings } = useIntlayer(\"total_openings\");\n\n return (\n
\n

{totalOpenings(props.count)}

\n
\n );\n};\n\nexport default OpeningsComponent;\n```\n\n
\n \n\nTo use plural content in Angular components, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```typescript fileName=\"app.component.ts\" codeFormat=\"typescript\"\nimport { Component, Input } from \"@angular/core\";\nimport { useIntlayer } from \"angular-intlayer\";\n\n@Component({\n selector: \"app-openings\",\n template: `\n
\n

{{ content().totalOpenings(count) }}

\n
\n `,\n})\nexport class OpeningsComponent {\n @Input() count!: number;\n\n content = useIntlayer(\"total_openings\");\n}\n```\n\n
\n \n\nTo use plural content with `vanilla-intlayer`, retrieve it via the `useIntlayer` hook and call it with a count. Here's an example:\n\n```typescript fileName=\"**/*.ts\" codeFormat={[\"typescript\", \"esm\"]}\nimport { installIntlayer, useIntlayer } from \"vanilla-intlayer\";\n\ninstallIntlayer();\n\nconst content = useIntlayer(\"total_openings\").onChange((newContent) => {\n document.getElementById(\"openings\")!.textContent =\n newContent.totalOpenings(5);\n});\n\n// Initial render\ndocument.getElementById(\"openings\")!.textContent = content.totalOpenings(5);\n```\n\n \n
\n\n## Setting Up Plural Content\n\nTo set up plural content in your Intlayer project, create a content module that uses the `plural` helper. The `other` category is required and is used as the fallback when a locale doesn't define a more specific category.\n\n```typescript fileName=\"**/*.content.ts\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\nimport { plural, t, type Dictionary } from \"intlayer\";\n\nconst openingsContent = {\n key: \"total_openings\",\n content: {\n totalOpenings: t({\n en: plural({\n one: \"{{count}} opening\",\n other: \"{{count}} openings\",\n }),\n ru: plural({\n one: \"{{count}} вакансия\",\n few: \"{{count}} вакансии\",\n many: \"{{count}} вакансий\",\n other: \"{{count}} вакансий\",\n }),\n }),\n },\n} satisfies Dictionary;\n\nexport default openingsContent;\n```\n\n```json fileName=\"**/*.content.json\" contentDeclarationFormat=\"json\"\n{\n \"$schema\": \"https://intlayer.org/schema.json\",\n \"key\": \"total_openings\",\n \"content\": {\n \"totalOpenings\": {\n \"nodeType\": \"translation\",\n \"translation\": {\n \"en\": {\n \"nodeType\": \"plural\",\n \"plural\": {\n \"one\": \"{{count}} opening\",\n \"other\": \"{{count}} openings\"\n }\n },\n \"ru\": {\n \"nodeType\": \"plural\",\n \"plural\": {\n \"one\": \"{{count}} вакансия\",\n \"few\": \"{{count}} вакансии\",\n \"many\": \"{{count}} вакансий\",\n \"other\": \"{{count}} вакансий\"\n }\n }\n }\n }\n }\n}\n```\n\n> The supported categories are `zero`, `one`, `two`, `few`, `many`, `other`. You only need to declare the categories your target language uses, Intlayer falls back to `other` when no specific category matches.\n>\n> The `{{count}}` placeholder is automatically replaced with the count you pass at runtime. You can include other placeholders too (see [Custom placeholders](#custom-placeholders) below).\n\n## Using Plural Content with React Intlayer\n\nTo use plural content inside a React component, retrieve it via the `useIntlayer` hook and call it with a count. The active locale and the count are combined to pick the matching CLDR category.\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\nimport type { FC } from \"react\";\nimport { useIntlayer } from \"react-intlayer\";\n\nconst OpeningsComponent: FC<{ count: number }> = ({ count }) => {\n const { totalOpenings } = useIntlayer(\"total_openings\");\n\n return (\n
\n {/* In English: */}\n {/* count=0 → \"0 openings\" (other) */}\n {/* count=1 → \"1 opening\" (one) */}\n {/* count=2 → \"2 openings\" (other) */}\n {/* count=21 → \"21 openings\" (other) */}\n

{totalOpenings(count)}

\n
\n );\n};\n\nexport default OpeningsComponent;\n```\n\nYou can call the returned function in two equivalent ways:\n\n```tsx\ntotalOpenings(21); // shorthand: count only\ntotalOpenings({ count: 21 }); // explicit form\n```\n\n## Custom placeholders\n\nPlural strings can include placeholders other than `{{count}}`. Pass them in the object form alongside `count`:\n\n```typescript fileName=\"**/*.content.ts\" contentDeclarationFormat={[\"typescript\", \"esm\", \"commonjs\"]}\nimport { plural, type Dictionary } from \"intlayer\";\n\nconst inboxContent = {\n key: \"inbox_summary\",\n content: {\n summary: plural({\n one: \"{{name}}, you have {{count}} new message\",\n other: \"{{name}}, you have {{count}} new messages\",\n }),\n },\n} satisfies Dictionary;\n\nexport default inboxContent;\n```\n\n```tsx fileName=\"**/*.tsx\" codeFormat={[\"typescript\", \"esm\"]}\nconst { summary } = useIntlayer(\"inbox_summary\");\n\nsummary({ count: 1, name: \"Alice\" });\n// → \"Alice, you have 1 new message\"\n\nsummary({ count: 7, name: \"Alice\" });\n// → \"Alice, you have 7 new messages\"\n```\n\n## CLDR Categories at a Glance\n\nDifferent languages use different subsets of the CLDR categories. A few common cases:\n\n| Language | Categories used |\n| ------------------ | -------------------------------------------- |\n| English (`en`) | `one`, `other` |\n| French (`fr`) | `one`, `many`, `other` |\n| Russian (`ru`) | `one`, `few`, `many`, `other` |\n| Polish (`pl`) | `one`, `few`, `many`, `other` |\n| Arabic (`ar`) | `zero`, `one`, `two`, `few`, `many`, `other` |\n| Japanese / Chinese | `other` only |\n\nYou don't need to memorise this, declare the categories you have translations for, and Intlayer will fall back to `other` when needed.\n\n## Limitation\n\nIn comparison to other nodes, `plural` cannot be imbricated with children nodes yet.\n\nExample:\n\nValid:\n\n```ts\n totalOpenings: t({\n en: plural({\n one: \"{{count}} opening\",\n other: \"{{count}} openings\",\n }),\n fr: plural({\n one: \"{{count}} offre\",\n other: \"{{count}} offres\",\n }),\n }),\n```\n\nInvalid:\n\n```ts\ntotalOpenings: plural({\n one: t({\n en: \"{{count}} opening\",\n fr: \"{{count}} offre\",\n }),\n other: t({\n en: \"{{count}} openings\",\n fr: \"{{count}} offres\",\n }),\n}),\n```\n\n## Additional Resources\n\nFor more detailed information on configuration and usage, refer to the following resources:\n\n- [Enumeration Documentation](/en-GB/doc/concept/content/enumeration)\n- [Insertion Documentation](/en-GB/doc/concept/content/insertion)\n- [Intlayer CLI Documentation](/en-GB/doc/concept/cli)\n- [React Intlayer Documentation](/en-GB/doc/environment/create-react-app)\n- [Next Intlayer Documentation](/en-GB/doc/environment/nextjs/15)\n\nThese resources offer further insights into the setup and usage of Intlayer across various environments and frameworks.\n","description":"Discover how to declare and use locale-aware plural content (CLDR-based) in your multilingual website. Follow the steps in this online documentation to set up your project in a few minutes.","url":"https://intlayer.org/en-GB/doc/concept/content/plural","datePublished":"2026-05-04","dateModified":"2026-05-04","version":"8.8.0","keywords":"Plural, Pluralisation, CLDR, Internationalisation, Documentation, Intlayer, Next.js, JavaScript, React","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"Developers, Content Managers"}}
    Author:
    Creation:2026-05-04Last update:2026-05-04

    Plural Content / Plural in Intlayer

    How Plural Works

    To use plural content inside a React component, retrieve it via the useIntlayer hook and call it with a count. The active locale and the count are combined to pick the matching CLDR category.

    **/*.tsx
    import type { FC } from "react";
    import { useIntlayer } from "react-intlayer";
    
    const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
    const { totalOpenings } = useIntlayer("total_openings");
    
    return (
      <div>
        <p>{totalOpenings(count)}</p>
      </div>
    );
    };
    
    export default OpeningsComponent;

    When to Use plural vs enu

    To use plural content inside a React component, retrieve it via the useIntlayer hook and call it with a count. The active locale and the count are combined to pick the matching CLDR category.

    **/*.tsx
    import type { FC } from "react";
    import { useIntlayer } from "react-intlayer";
    
    const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
    const { totalOpenings } = useIntlayer("total_openings");
    
    return (
      <div>
        <p>{totalOpenings(count)}</p>
      </div>
    );
    };
    
    export default OpeningsComponent;

    Setting Up Plural Content

    To set up plural content in your Intlayer project, create a content module that uses the plural helper. The other category is required and is used as the fallback when a locale doesn't define a more specific category.

    **/*.content.ts
    import { plural, t, type Dictionary } from "intlayer";
    
    const openingsContent = {
      key: "total_openings",
      content: {
        totalOpenings: t({
          en: plural({
            one: "{{count}} opening",
            other: "{{count}} openings",
          }),
          ru: plural({
            one: "{{count}} вакансия",
            few: "{{count}} вакансии",
            many: "{{count}} вакансий",
            other: "{{count}} вакансий",
          }),
        }),
      },
    } satisfies Dictionary;
    
    export default openingsContent;

    The supported categories are zero, one, two, few, many, other. You only need to declare the categories your target language uses, Intlayer falls back to other when no specific category matches.

    The {{count}} placeholder is automatically replaced with the count you pass at runtime. You can include other placeholders too (see Custom placeholders below).

    Using Plural Content with React Intlayer

    To use plural content inside a React component, retrieve it via the useIntlayer hook and call it with a count. The active locale and the count are combined to pick the matching CLDR category.

    **/*.tsx
    import type { FC } from "react";
    import { useIntlayer } from "react-intlayer";
    
    const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
      const { totalOpenings } = useIntlayer("total_openings");
    
      return (
        <div>
          {/* In English:                                  */}
          {/*  count=0  → "0 openings"   (other)           */}
          {/*  count=1  → "1 opening"    (one)             */}
          {/*  count=2  → "2 openings"   (other)           */}
          {/*  count=21 → "21 openings"  (other)           */}
          <p>{totalOpenings(count)}</p>
        </div>
      );
    };
    
    export default OpeningsComponent;

    You can call the returned function in two equivalent ways:

    tsx
    totalOpenings(21); // shorthand: count onlytotalOpenings({ count: 21 }); // explicit form

    Custom placeholders

    Plural strings can include placeholders other than {{count}}. Pass them in the object form alongside count:

    **/*.content.ts
    import { plural, type Dictionary } from "intlayer";
    
    const inboxContent = {
      key: "inbox_summary",
      content: {
        summary: plural({
          one: "{{name}}, you have {{count}} new message",
          other: "{{name}}, you have {{count}} new messages",
        }),
      },
    } satisfies Dictionary;
    
    export default inboxContent;
    **/*.tsx
    const { summary } = useIntlayer("inbox_summary");
    
    summary({ count: 1, name: "Alice" });
    // → "Alice, you have 1 new message"
    
    summary({ count: 7, name: "Alice" });
    // → "Alice, you have 7 new messages"

    CLDR Categories at a Glance

    Different languages use different subsets of the CLDR categories. A few common cases:

    Language Categories used
    English (en) one, other
    French (fr) one, many, other
    Russian (ru) one, few, many, other
    Polish (pl) one, few, many, other
    Arabic (ar) zero, one, two, few, many, other
    Japanese / Chinese other only

    You don't need to memorise this, declare the categories you have translations for, and Intlayer will fall back to other when needed.

    Limitation

    In comparison to other nodes, plural cannot be imbricated with children nodes yet.

    Example:

    Valid:

    ts
        totalOpenings: t({      en: plural({        one: "{{count}} opening",        other: "{{count}} openings",      }),      fr: plural({        one: "{{count}} offre",        other: "{{count}} offres",      }),    }),

    Invalid:

    ts
    totalOpenings: plural({  one: t({    en: "{{count}} opening",    fr: "{{count}} offre",  }),  other: t({    en: "{{count}} openings",    fr: "{{count}} offres",  }),}),

    Additional Resources

    For more detailed information on configuration and usage, refer to the following resources:

    These resources offer further insights into the setup and usage of Intlayer across various environments and frameworks.