\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## Quando usare `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## Configurazione del contenuto plurale\n\nPer configurare il contenuto plurale nel tuo progetto Intlayer, crea un modulo di contenuto che utilizzi l'helper `plural`. La categoria `other` è obbligatoria e viene utilizzata come fallback quando una locale non definisce una categoria più specifica.\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 it: plural({\n one: \"{{count}} posizione aperta\",\n other: \"{{count}} posizioni aperte\",\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 \"it\": {\n \"nodeType\": \"plural\",\n \"plural\": {\n \"one\": \"{{count}} posizione aperta\",\n \"other\": \"{{count}} posizioni aperte\"\n }\n }\n }\n }\n }\n}\n```\n\n> Le categorie supportate sono `zero`, `one`, `two`, `few`, `many`, `other`. Devi solo dichiarare le categorie utilizzate dalla tua lingua di destinazione, Intlayer torna a `other` quando nessuna categoria specifica corrisponde.\n>\n> Il segnaposto `{{count}}` viene sostituito automaticamente con il conteggio passato in fase di esecuzione. Puoi includere anche altri segnaposto (vedi [Segnaposto personalizzati](#custom-placeholders) sotto).\n\n## Utilizzo del contenuto plurale con React Intlayer\n\nPer utilizzare il contenuto plurale all'interno di un componente React, recuperalo tramite l'hook `useIntlayer` e chiamalo con un conteggio. La locale attiva e il conteggio vengono combinati per scegliere la categoria CLDR corrispondente.\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 inglese: */}\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\nPuoi chiamare la funzione restituita in due modi equivalenti:\n\n```tsx\ntotalOpenings(21); // abbreviato: solo conteggio\ntotalOpenings({ count: 21 }); // forma esplicita\n```\n\n## Segnaposto personalizzati\n\nLe stringhe plurali possono includere segnaposto diversi da `{{count}}`. Passali sotto forma di oggetto insieme a `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}}, hai {{count}} nuovo messaggio\",\n other: \"{{name}}, hai {{count}} nuovi messaggi\",\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, hai 1 nuovo messaggio\"\n\nsummary({ count: 7, name: \"Alice\" });\n// → \"Alice, hai 7 nuovi messaggi\"\n```\n\n## Categorie CLDR a colpo d'occhio\n\nLingue diverse utilizzano diversi sottoinsiemi delle categorie CLDR. Alcuni casi comuni:\n\n| Lingua | Categorie utilizzate |\n| ------------------- | -------------------------------------------- |\n| Inglese (`en`) | `one`, `other` |\n| Francese (`fr`) | `one`, `many`, `other` |\n| Russo (`ru`) | `one`, `few`, `many`, `other` |\n| Polacco (`pl`) | `one`, `few`, `many`, `other` |\n| Arabo (`ar`) | `zero`, `one`, `two`, `few`, `many`, `other` |\n| Giapponese / Cinese | solo `other` |\n\nNon è necessario memorizzarlo, dichiara le categorie per le quali hai traduzioni e Intlayer tornerà a `other` quando necessario.\n\n## Limitazione\n\nA differenza di altri nodi, il nodo `plural` non può ancora essere nidificato con nodi figli.\n\nEsempio:\n\nValido:\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\nNon valido:\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## Risorse aggiuntive\n\nPer informazioni più dettagliate sulla configurazione e l'utilizzo, fare riferimento alle seguenti risorse:\n\n- [Documentazione sull'enumerazione](/it/doc/concept/content/enumeration)\n- [Documentazione sull'inserimento](/it/doc/concept/content/insertion)\n- [Documentazione della CLI Intlayer](/it/doc/concept/cli)\n- [Documentazione React Intlayer](/it/doc/environment/create-react-app)\n- [Documentazione Next Intlayer](/it/doc/environment/nextjs/15)\n\nQueste risorse offrono ulteriori approfondimenti sulla configurazione e l'utilizzo di Intlayer in vari ambienti e framework.\n","description":"Scopri come dichiarare e utilizzare contenuti plurali basati sulla localizzazione (basati su CLDR) nel tuo sito web multilingue. Segui i passaggi in questa documentazione online per configurare il tuo progetto in pochi minuti.","url":"https://intlayer.org/it/doc/concept/content/plural","datePublished":"2026-05-04","dateModified":"2026-05-04","version":"8.8.0","keywords":"Plurale, Pluralizzazione, CLDR, Internazionalizzazione, Documentazione, Intlayer, Next.js, JavaScript, React","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"Sviluppatori, Manager dei contenuti"}}
    Autore:
    Creazione:2026-05-04Ultimo aggiornamento:2026-05-04

    Contenuto Plurale / Il plurale in Intlayer

    Come funziona il plurale

    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;

    Quando usare 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;

    Configurazione del contenuto plurale

    Per configurare il contenuto plurale nel tuo progetto Intlayer, crea un modulo di contenuto che utilizzi l'helper plural. La categoria other è obbligatoria e viene utilizzata come fallback quando una locale non definisce una categoria più specifica.

    **/*.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",
          }),
          it: plural({
            one: "{{count}} posizione aperta",
            other: "{{count}} posizioni aperte",
          }),
        }),
      },
    } satisfies Dictionary;
    
    export default openingsContent;

    Le categorie supportate sono zero, one, two, few, many, other. Devi solo dichiarare le categorie utilizzate dalla tua lingua di destinazione, Intlayer torna a other quando nessuna categoria specifica corrisponde.

    Il segnaposto {{count}} viene sostituito automaticamente con il conteggio passato in fase di esecuzione. Puoi includere anche altri segnaposto (vedi Segnaposto personalizzati sotto).

    Utilizzo del contenuto plurale con React Intlayer

    Per utilizzare il contenuto plurale all'interno di un componente React, recuperalo tramite l'hook useIntlayer e chiamalo con un conteggio. La locale attiva e il conteggio vengono combinati per scegliere la categoria CLDR corrispondente.

    **/*.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 inglese:                                   */}
          {/*  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;

    Puoi chiamare la funzione restituita in due modi equivalenti:

    tsx
    totalOpenings(21); // abbreviato: solo conteggiototalOpenings({ count: 21 }); // forma esplicita

    Segnaposto personalizzati

    Le stringhe plurali possono includere segnaposto diversi da {{count}}. Passali sotto forma di oggetto insieme a count:

    **/*.content.ts
    import { plural, type Dictionary } from "intlayer";
    
    const inboxContent = {
      key: "inbox_summary",
      content: {
        summary: plural({
          one: "{{name}}, hai {{count}} nuovo messaggio",
          other: "{{name}}, hai {{count}} nuovi messaggi",
        }),
      },
    } satisfies Dictionary;
    
    export default inboxContent;
    **/*.tsx
    const { summary } = useIntlayer("inbox_summary");
    
    summary({ count: 1, name: "Alice" });
    // → "Alice, hai 1 nuovo messaggio"
    
    summary({ count: 7, name: "Alice" });
    // → "Alice, hai 7 nuovi messaggi"

    Categorie CLDR a colpo d'occhio

    Lingue diverse utilizzano diversi sottoinsiemi delle categorie CLDR. Alcuni casi comuni:

    Lingua Categorie utilizzate
    Inglese (en) one, other
    Francese (fr) one, many, other
    Russo (ru) one, few, many, other
    Polacco (pl) one, few, many, other
    Arabo (ar) zero, one, two, few, many, other
    Giapponese / Cinese solo other

    Non è necessario memorizzarlo, dichiara le categorie per le quali hai traduzioni e Intlayer tornerà a other quando necessario.

    Limitazione

    A differenza di altri nodi, il nodo plural non può ancora essere nidificato con nodi figli.

    Esempio:

    Valido:

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

    Non valido:

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

    Risorse aggiuntive

    Per informazioni più dettagliate sulla configurazione e l'utilizzo, fare riferimento alle seguenti risorse:

    Queste risorse offrono ulteriori approfondimenti sulla configurazione e l'utilizzo di Intlayer in vari ambienti e framework.