\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
{{ totalOpenings(count) }}
\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 );\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"}}
Copiar el Markdown del documento a la portapapeles
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
Copiar código
Copiar el código al portapapeles
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;
To use plural content in Next.js Client Components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.tsx
Copiar código
Copiar el código al portapapeles
"use client";
import type { FC } from "react";
import { useIntlayer } from "next-intlayer";
const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
const { totalOpenings } = useIntlayer("total_openings");
return (
<div>
<p>{totalOpenings(count)}</p>
</div>
);
};
export default OpeningsComponent;
To use plural content in Vue components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.vue
Copiar código
Copiar el código al portapapeles
<script setup lang="ts">import { useIntlayer } from "vue-intlayer";defineProps<{ count: number }>();const { totalOpenings } = useIntlayer("total_openings");</script><template><div> <p>{{ totalOpenings(count) }}</p></div></template>
To 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:
**/*.svelte
Copiar código
Copiar el código al portapapeles
<script lang="ts">import { useIntlayer } from "svelte-intlayer";export let count: number;const content = useIntlayer("total_openings");</script><div><p>{$content.totalOpenings(count)}</p></div>
To use plural content in Preact components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.tsx
Copiar código
Copiar el código al portapapeles
import type { FC } from "preact";
import { useIntlayer } from "preact-intlayer";
const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
const { totalOpenings } = useIntlayer("total_openings");
return (
<div>
<p>{totalOpenings(count)}</p>
</div>
);
};
export default OpeningsComponent;
To use plural content in SolidJS components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.tsx
Copiar código
Copiar el código al portapapeles
import type { Component } from "solid-js";
import { useIntlayer } from "solid-intlayer";
const OpeningsComponent: Component<{ count: number }> = (props) => {
const { totalOpenings } = useIntlayer("total_openings");
return (
<div>
<p>{totalOpenings(props.count)}</p>
</div>
);
};
export default OpeningsComponent;
To use plural content in Angular components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
app.component.ts
Copiar código
Copiar el código al portapapeles
import { Component, Input } from "@angular/core";import { useIntlayer } from "angular-intlayer";@Component({selector: "app-openings",template: ` <div> <p>{{ content().totalOpenings(count) }}</p> </div>`,})export class OpeningsComponent {@Input() count!: number;content = useIntlayer("total_openings");}
To use plural content with vanilla-intlayer, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
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
Copiar código
Copiar el código al portapapeles
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;
To use plural content in Next.js Client Components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.tsx
Copiar código
Copiar el código al portapapeles
"use client";
import type { FC } from "react";
import { useIntlayer } from "next-intlayer";
const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
const { totalOpenings } = useIntlayer("total_openings");
return (
<div>
<p>{totalOpenings(count)}</p>
</div>
);
};
export default OpeningsComponent;
To use plural content in Vue components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.vue
Copiar código
Copiar el código al portapapeles
<script setup lang="ts">import { useIntlayer } from "vue-intlayer";defineProps<{ count: number }>();const { totalOpenings } = useIntlayer("total_openings");</script><template><div> <p>{{ totalOpenings(count) }}</p></div></template>
To 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:
**/*.svelte
Copiar código
Copiar el código al portapapeles
<script lang="ts">import { useIntlayer } from "svelte-intlayer";export let count: number;const content = useIntlayer("total_openings");</script><div><p>{$content.totalOpenings(count)}</p></div>
To use plural content in Preact components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.tsx
Copiar código
Copiar el código al portapapeles
import type { FC } from "preact";
import { useIntlayer } from "preact-intlayer";
const OpeningsComponent: FC<{ count: number }> = ({ count }) => {
const { totalOpenings } = useIntlayer("total_openings");
return (
<div>
<p>{totalOpenings(count)}</p>
</div>
);
};
export default OpeningsComponent;
To use plural content in SolidJS components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
**/*.tsx
Copiar código
Copiar el código al portapapeles
import type { Component } from "solid-js";
import { useIntlayer } from "solid-intlayer";
const OpeningsComponent: Component<{ count: number }> = (props) => {
const { totalOpenings } = useIntlayer("total_openings");
return (
<div>
<p>{totalOpenings(props.count)}</p>
</div>
);
};
export default OpeningsComponent;
To use plural content in Angular components, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
app.component.ts
Copiar código
Copiar el código al portapapeles
import { Component, Input } from "@angular/core";import { useIntlayer } from "angular-intlayer";@Component({selector: "app-openings",template: ` <div> <p>{{ content().totalOpenings(count) }}</p> </div>`,})export class OpeningsComponent {@Input() count!: number;content = useIntlayer("total_openings");}
To use plural content with vanilla-intlayer, retrieve it via the useIntlayer hook and call it with a count. Here's an example:
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.
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.