HomeSandboxShowcaseAppDocBlog
    • EnglishEnglish
      EN
    • русскийRussian
      RU
    • 日本語Japanese
      JA
    • françaisFrench
      FR
    • 한국어Korean
      KO
    • 中文Chinese
      ZH
    • españolSpanish
      ES
    • DeutschGerman
      DE
    • العربيةArabic
      AR
    • italianoItalian
      IT
    • British EnglishBritish English
      EN-GB
    • portuguêsPortuguese
      PT
    • हिन्दीHindi
      HI
    • TürkçeTurkish
      TR
    • polskiPolish
      PL
    • IndonesiaIndonesian
      ID
    • Tiếng ViệtVietnamese
      VI
    • українськаUkrainian
      UK
    /
    Filter docs by framework
    Alt+←
    Why Intlayer ?
    Get Started
    Concept
    • How Intlayer Works
    • Configuration
    • TestFillBuildWatchExtractLoginPushPullConfigurationListVersionEditorLiveDebugDoc ReviewDoc TranslateSDK
    • Visual Editor
    • CMS
    • CI/CD Integration
    • TranslationPluralEnumerationConditionGenderInsertionFileNestingMarkdownHTMLFunction Fetching
    • Per Locale File
    • Compiler
    • Auto Fill
    • Testing
    • Bundle Optimization
    Environment
    • Next.js 14 and App Router
      Next.js 15
      Next.js no locale path
      Next.js and Page Router
      Compiler
    • Tanstack Start Solid
    • Astro and React
      Astro and Svelte
      Astro and Vue
      Astro and Solid
      Astro and Preact
      Astro and Lit
      Astro and Vanilla JS
    • React Router v7
      React Router v7 (fs-routes)
      Compiler
    • Nuxt and Vue
    • Vite and Solid
    • SvelteKit
    • Vite and Preact
    • Vite and Vanilla JS
    • Vite and Lit
    • Angular 19 (Webpack)
      Analog
    • React CRA
    • React Native and Expo
    • Express.js
      NestJS
      Fastify
      Hono
      Adonis
    • Lynx and React
    Plugins
    • JSON
    • gettext (.po)
    VS Code Extension
    Agent
    • MCP Server
    • Agent skills
    Releases
    • v8
    • v7
    • v6
    Benchmark
    • Next.js
    • TanStack
    • Vue
    • Solid
    • Svelte
    Blog
    Ask a question
    1. Documentation
    2. Concept
    3. Content Declaration
    4. Plural
    Creation:2026-05-04Last update:2026-05-04
    Reference this doc to your favorite AI assistant
    ChatGPT
    Claude
    DeepSeek
    Google AI mode
    Gemini
    Perplexity
    Mistral
    Grok

    Ask your question and get a summary of the document by referencing this page and the AI provider of your choice

    Version History

    1. "Init history"
      v8.8.05/4/2026
    Edit this doc

    If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.

    GitHub link to the documentation
    Copy

    Copy doc Markdown to clipboard

    Plural Content / Plural in Intlayer

    How Plural Works

    In Intlayer, plural content is achieved through the plural function, which maps CLDR plural categories, zero, one, two, few, many, other, to their corresponding content. The correct category is selected automatically based on the active locale and a count value, using the platform's built-in Intl.PluralRules API.

    Unlike enu, which selects content based on numeric ranges you define yourself, plural delegates the selection to CLDR rules. This is what makes it scalable to languages with complex pluralization rules, such as Russian, Polish, Arabic, or Welsh, without having to hand-write modulo logic.

    When to Use plural vs enu

    Show all table content

    Open the table in a modal to view all data content clearly

    Use case Helper
    Locale-aware grammatical plural forms (one apple / two apples / 5 яблок) plural
    Custom numeric ranges (<5, >=10) or non-CLDR buckets enu

    If you only target English (which has just one / other), either works. For any language with few / many / two distinctions, prefer plural.

    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
    Copy code

    Copy the code to the clipboard

    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
    Copy code

    Copy the code to the clipboard

    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
    Copy code

    Copy the code to the clipboard

    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
    Copy code

    Copy the code to the clipboard

    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
    Copy code

    Copy the code to the clipboard

    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:

    Show all table content

    Open the table in a modal to view all data content clearly

    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 memorize 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
    Copy code

    Copy the code to the clipboard

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

    Invalid:

    ts
    Copy code

    Copy the code to the clipboard

    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:

    • Enumeration Documentation
    • Insertion Documentation
    • Intlayer CLI Documentation
    • React Intlayer Documentation
    • Next Intlayer Documentation

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

    Translation
    Enumeration
    Alt+→

    In this page

      Discussions are anonymous and regularly reviewed to address common issues. Feel free to share feature ideas, feedback on the documentation, or anything related to Intlayer, we use this input to shape our roadmap and improve the product.

      totalOpenings(21); // shorthand: count onlytotalOpenings({ count: 21 }); // explicit form
          totalOpenings: t({      en: plural({        one: "{{count}} opening",        other: "{{count}} openings",      }),      fr: plural({        one: "{{count}} offre",        other: "{{count}} offres",      }),    }),
      totalOpenings: plural({  one: t({    en: "{{count}} opening",    fr: "{{count}} offre",  }),  other: t({    en: "{{count}} openings",    fr: "{{count}} offres",  }),}),