\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## Cuándo 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## Configuración del contenido en plural\n\nPara configurar el contenido en plural en tu proyecto Intlayer, crea un módulo de contenido que utilice el ayudante `plural`. La categoría `other` es obligatoria y se utiliza como respaldo cuando una configuración regional no define una categoría más 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 es: plural({\n one: \"{{count}} vacante\",\n other: \"{{count}} vacantes\",\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 \"es\": {\n \"nodeType\": \"plural\",\n \"plural\": {\n \"one\": \"{{count}} vacante\",\n \"other\": \"{{count}} vacantes\"\n }\n }\n }\n }\n }\n}\n```\n\n> Las categorías admitidas son `zero`, `one`, `two`, `few`, `many`, `other`. Solo necesitas declarar las categorías que utiliza tu idioma de destino; Intlayer recurre a `other` cuando no coincide ninguna categoría específica.\n>\n> El marcador de posición `{{count}}` se reemplaza automáticamente con el conteo que pases en runtime. También puedes incluir otros marcadores de posición (consulta [Marcadores de posición personalizados](#custom-placeholders) a continuación).\n\n## Uso de contenido en plural con React Intlayer\n\nPara usar contenido en plural dentro de un componente de React, recupéralo a través del gancho `useIntlayer` y llámalo con un conteo. La configuración regional activa y el conteo se combinan para elegir la categoría CLDR coincidente.\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 {/* En 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\nPuedes llamar a la función devuelta de dos maneras equivalentes:\n\n```tsx\ntotalOpenings(21); // forma abreviada: solo conteo\ntotalOpenings({ count: 21 }); // forma explícita\n```\n\n## Marcadores de posición personalizados\n\nLas cadenas en plural pueden incluir marcadores de posición distintos de `{{count}}`. Pásalos en forma de objeto junto con `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}}, tienes {{count}} mensaje nuevo\",\n other: \"{{name}}, tienes {{count}} mensajes nuevos\",\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, tienes 1 mensaje nuevo\"\n\nsummary({ count: 7, name: \"Alice\" });\n// → \"Alice, tienes 7 mensajes nuevos\"\n```\n\n## Categorías CLDR de un vistazo\n\nDiferentes idiomas utilizan diferentes subconjuntos de las categorías CLDR. Algunos casos comunes:\n\n| Idioma | Categorías utilizadas |\n| --------------- | -------------------------------------------- |\n| Inglés (`en`) | `one`, `other` |\n| Francés (`fr`) | `one`, `many`, `other` |\n| Ruso (`ru`) | `one`, `few`, `many`, `other` |\n| Polaco (`pl`) | `one`, `few`, `many`, `other` |\n| Árabe (`ar`) | `zero`, `one`, `two`, `few`, `many`, `other` |\n| Japonés / Chino | solo `other` |\n\nNo necesitas memorizar esto: declara las categorías para las que tienes traducciones e Intlayer recurrirá a `other` cuando sea necesario.\n\n## Limitación\n\nA diferencia de otros nodos, el nodo `plural` aún no se puede imbricar con nodos hijos.\n\nEjemplo:\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 adicionales\n\nPara obtener información más detallada sobre la configuración y el uso, consulta los siguientes recursos:\n\n- [Documentación de Enumeración](/es/doc/concept/content/enumeration)\n- [Documentación de Inserción](/es/doc/concept/content/insertion)\n- [Documentación de la CLI de Intlayer](/es/doc/concept/cli)\n- [Documentación de React Intlayer](/es/doc/environment/create-react-app)\n- [Documentación de Next Intlayer](/es/doc/environment/nextjs/15)\n\nEstos recursos ofrecen más información sobre la configuración y el uso de Intlayer en diversos entornos y marcos.\n","description":"Descubre cómo declarar y utilizar contenido en plural adaptado a la configuración regional (basado en CLDR) en tu sitio web multilingüe. Sigue los pasos de esta documentación en línea para configurar tu proyecto en unos minutos.","url":"https://intlayer.org/es/doc/concept/content/plural","datePublished":"2026-05-04","dateModified":"2026-05-04","version":"8.8.0","keywords":"Plural, Pluralización, CLDR, Internacionalización, Documentación, Intlayer, Next.js, JavaScript, React","license":"https://raw.githubusercontent.com/aymericzip/intlayer/refs/heads/main/LICENSE","audience":{"@type":"Audience","audienceType":"Desarrolladores, Gestores de Contenido"}}
    Autor:
    Creación:2026-05-04Última actualización:2026-05-04

    Contenido en Plural / El plural en Intlayer

    Cómo funciona el plural

    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;

    Cuándo 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;

    Configuración del contenido en plural

    Para configurar el contenido en plural en tu proyecto Intlayer, crea un módulo de contenido que utilice el ayudante plural. La categoría other es obligatoria y se utiliza como respaldo cuando una configuración regional no define una categoría más 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",
          }),
          es: plural({
            one: "{{count}} vacante",
            other: "{{count}} vacantes",
          }),
        }),
      },
    } satisfies Dictionary;
    
    export default openingsContent;

    Las categorías admitidas son zero, one, two, few, many, other. Solo necesitas declarar las categorías que utiliza tu idioma de destino; Intlayer recurre a other cuando no coincide ninguna categoría específica.

    El marcador de posición {{count}} se reemplaza automáticamente con el conteo que pases en runtime. También puedes incluir otros marcadores de posición (consulta Marcadores de posición personalizados a continuación).

    Uso de contenido en plural con React Intlayer

    Para usar contenido en plural dentro de un componente de React, recupéralo a través del gancho useIntlayer y llámalo con un conteo. La configuración regional activa y el conteo se combinan para elegir la categoría CLDR coincidente.

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

    Puedes llamar a la función devuelta de dos maneras equivalentes:

    tsx
    totalOpenings(21); // forma abreviada: solo conteototalOpenings({ count: 21 }); // forma explícita

    Marcadores de posición personalizados

    Las cadenas en plural pueden incluir marcadores de posición distintos de {{count}}. Pásalos en forma de objeto junto con count:

    **/*.content.ts
    import { plural, type Dictionary } from "intlayer";
    
    const inboxContent = {
      key: "inbox_summary",
      content: {
        summary: plural({
          one: "{{name}}, tienes {{count}} mensaje nuevo",
          other: "{{name}}, tienes {{count}} mensajes nuevos",
        }),
      },
    } satisfies Dictionary;
    
    export default inboxContent;
    **/*.tsx
    const { summary } = useIntlayer("inbox_summary");
    
    summary({ count: 1, name: "Alice" });
    // → "Alice, tienes 1 mensaje nuevo"
    
    summary({ count: 7, name: "Alice" });
    // → "Alice, tienes 7 mensajes nuevos"

    Categorías CLDR de un vistazo

    Diferentes idiomas utilizan diferentes subconjuntos de las categorías CLDR. Algunos casos comunes:

    Idioma Categorías utilizadas
    Inglés (en) one, other
    Francés (fr) one, many, other
    Ruso (ru) one, few, many, other
    Polaco (pl) one, few, many, other
    Árabe (ar) zero, one, two, few, many, other
    Japonés / Chino solo other

    No necesitas memorizar esto: declara las categorías para las que tienes traducciones e Intlayer recurrirá a other cuando sea necesario.

    Limitación

    A diferencia de otros nodos, el nodo plural aún no se puede imbricar con nodos hijos.

    Ejemplo:

    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 adicionales

    Para obtener información más detallada sobre la configuración y el uso, consulta los siguientes recursos:

    Estos recursos ofrecen más información sobre la configuración y el uso de Intlayer en diversos entornos y marcos.