\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 usar `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## Configurando Conteúdo Plural\n\nPara configurar o conteúdo plural no seu projeto Intlayer, crie um módulo de conteúdo que use o auxiliar `plural`. A categoria `other` é obrigatória e é usada como fallback quando uma localidade não define uma categoria mais específica.\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 pt: plural({\n one: \"{{count}} vaga\",\n other: \"{{count}} vagas\",\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 \"pt\": {\n \"nodeType\": \"plural\",\n \"plural\": {\n \"one\": \"{{count}} vaga\",\n \"other\": \"{{count}} vagas\"\n }\n }\n }\n }\n }\n}\n```\n\n> As categorias suportadas são `zero`, `one`, `two`, `few`, `many`, `other`. Você só precisa declarar as categorias que seu idioma de destino usa, o Intlayer volta para `other` quando nenhuma categoria específica corresponde.\n>\n> O marcador `{{count}}` é substituído automaticamente pela contagem que você passa em tempo de execução. Você também pode incluir outros marcadores (veja [Marcadores personalizados](#custom-placeholders) abaixo).\n\n## Usando Conteúdo Plural com React Intlayer\n\nPara usar conteúdo plural dentro de um componente React, recupere-o através do hook `useIntlayer` e chame-o com uma contagem. A localidade ativa e a contagem são combinadas para escolher a categoria CLDR correspondente.\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 {/* Em inglês: */}\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\nVocê pode chamar a função retornada de duas maneiras equivalentes:\n\n```tsx\ntotalOpenings(21); // atalho: apenas contagem\ntotalOpenings({ count: 21 }); // forma explícita\n```\n\n## Marcadores personalizados\n\nStrings plurais podem incluir marcadores diferentes de `{{count}}`. Passe-os na forma de objeto junto com `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}}, você tem {{count}} nova mensagem\",\n other: \"{{name}}, você tem {{count}} novas mensagens\",\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, você tem 1 nova mensagem\"\n\nsummary({ count: 7, name: \"Alice\" });\n// → \"Alice, você tem 7 novas mensagens\"\n```\n\n## Categorias CLDR em um relance\n\nDiferentes idiomas usam diferentes subconjuntos das categorias CLDR. Alguns casos comuns:\n\n| Idioma | Categorias usadas |\n| ---------------- | -------------------------------------------- |\n| Inglês (`en`) | `one`, `other` |\n| Francês (`fr`) | `one`, `many`, `other` |\n| Russo (`ru`) | `one`, `few`, `many`, `other` |\n| Polonês (`pl`) | `one`, `few`, `many`, `other` |\n| Árabe (`ar`) | `zero`, `one`, `two`, `few`, `many`, `other` |\n| Japonês / Chinês | apenas `other` |\n\nVocê não precisa memorizar isso, declare as categorias para as quais você tem traduções, e o Intlayer voltará para `other` quando necessário.\n\n## Limitação\n\nEm comparação com outros nós, o `plural` ainda não pode ser aninhado com nós filhos.\n\nExemplo:\n\nVálido:\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\nInválido:\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## Recursos Adicionais\n\nPara informações mais detalhadas sobre configuração e uso, consulte os seguintes recursos:\n\n- [Documentação de Enumeração](/pt/doc/concept/content/enumeration)\n- [Documentação de Inserção](/pt/doc/concept/content/insertion)\n- [Documentação da CLI do Intlayer](/pt/doc/concept/cli)\n- [Documentação do React Intlayer](/pt/doc/environment/create-react-app)\n- [Documentação do Next Intlayer](/pt/doc/environment/nextjs/15)\n\nEstes recursos oferecem mais insights sobre a configuração e o uso do Intlayer em vários ambientes e frameworks.\n","description":"Descubra como declarar e usar conteúdo plural sensível à localidade (baseado em CLDR) em seu site multilíngue. Siga as etapas nesta documentação on-line para configurar seu projeto em poucos minutos.","url":"https://intlayer.org/pt/doc/concept/content/plural","datePublished":"2026-05-04","dateModified":"2026-05-04","version":"8.8.0","keywords":"Plural, Pluralização, CLDR, Internacionalização, Documentação, Intlayer, Next.js, JavaScript, React","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"Desenvolvedores, Gerentes de Conteúdo"}}
    Autor:
    Criação:2026-05-04Última atualização:2026-05-04

    Conteúdo Plural / Plural no Intlayer

    Como o Plural Funciona

    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 usar 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;

    Configurando Conteúdo Plural

    Para configurar o conteúdo plural no seu projeto Intlayer, crie um módulo de conteúdo que use o auxiliar plural. A categoria other é obrigatória e é usada como fallback quando uma localidade não define uma categoria mais específica.

    **/*.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",
          }),
          pt: plural({
            one: "{{count}} vaga",
            other: "{{count}} vagas",
          }),
        }),
      },
    } satisfies Dictionary;
    
    export default openingsContent;

    As categorias suportadas são zero, one, two, few, many, other. Você só precisa declarar as categorias que seu idioma de destino usa, o Intlayer volta para other quando nenhuma categoria específica corresponde.

    O marcador {{count}} é substituído automaticamente pela contagem que você passa em tempo de execução. Você também pode incluir outros marcadores (veja Marcadores personalizados abaixo).

    Usando Conteúdo Plural com React Intlayer

    Para usar conteúdo plural dentro de um componente React, recupere-o através do hook useIntlayer e chame-o com uma contagem. A localidade ativa e a contagem são combinadas para escolher a categoria CLDR correspondente.

    **/*.tsx
    import type { FC } from "react";
    import { useIntlayer } from "react-intlayer";
    
    const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
      const { totalOpenings } = useIntlayer("total_openings");
    
      return (
        <div>
          {/* Em inglês:                                  */}
          {/*  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;

    Você pode chamar a função retornada de duas maneiras equivalentes:

    tsx
    totalOpenings(21); // atalho: apenas contagemtotalOpenings({ count: 21 }); // forma explícita

    Marcadores personalizados

    Strings plurais podem incluir marcadores diferentes de {{count}}. Passe-os na forma de objeto junto com count:

    **/*.content.ts
    import { plural, type Dictionary } from "intlayer";
    
    const inboxContent = {
      key: "inbox_summary",
      content: {
        summary: plural({
          one: "{{name}}, você tem {{count}} nova mensagem",
          other: "{{name}}, você tem {{count}} novas mensagens",
        }),
      },
    } satisfies Dictionary;
    
    export default inboxContent;
    **/*.tsx
    const { summary } = useIntlayer("inbox_summary");
    
    summary({ count: 1, name: "Alice" });
    // → "Alice, você tem 1 nova mensagem"
    
    summary({ count: 7, name: "Alice" });
    // → "Alice, você tem 7 novas mensagens"

    Categorias CLDR em um relance

    Diferentes idiomas usam diferentes subconjuntos das categorias CLDR. Alguns casos comuns:

    Idioma Categorias usadas
    Inglês (en) one, other
    Francês (fr) one, many, other
    Russo (ru) one, few, many, other
    Polonês (pl) one, few, many, other
    Árabe (ar) zero, one, two, few, many, other
    Japonês / Chinês apenas other

    Você não precisa memorizar isso, declare as categorias para as quais você tem traduções, e o Intlayer voltará para other quando necessário.

    Limitação

    Em comparação com outros nós, o plural ainda não pode ser aninhado com nós filhos.

    Exemplo:

    Válido:

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

    Inválido:

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

    Recursos Adicionais

    Para informações mais detalhadas sobre configuração e uso, consulte os seguintes recursos:

    Estes recursos oferecem mais insights sobre a configuração e o uso do Intlayer em vários ambientes e frameworks.