@intlayer/docs 8.10.0 → 8.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common.cjs +3 -1
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +39 -19
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/common.mjs +3 -1
- package/dist/esm/common.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +39 -19
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -1
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/benchmark/nextjs.md +1 -1
- package/docs/ar/benchmark/solid.md +1 -1
- package/docs/ar/benchmark/svelte.md +1 -1
- package/docs/ar/benchmark/tanstack.md +1 -1
- package/docs/ar/dictionary/markdown.md +340 -14
- package/docs/ar/interest_of_intlayer.md +1 -1
- package/docs/ar/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/ar/intlayer_with_angular_21.md +412 -0
- package/docs/bn/interest_of_intlayer.md +1 -1
- package/docs/bn/intlayer_with_angular_21.md +412 -0
- package/docs/cs/interest_of_intlayer.md +1 -1
- package/docs/cs/intlayer_with_angular_21.md +412 -0
- package/docs/de/benchmark/nextjs.md +1 -1
- package/docs/de/benchmark/solid.md +1 -1
- package/docs/de/benchmark/svelte.md +1 -1
- package/docs/de/benchmark/tanstack.md +1 -1
- package/docs/de/dictionary/markdown.md +340 -14
- package/docs/de/interest_of_intlayer.md +1 -1
- package/docs/de/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/de/intlayer_with_angular_21.md +412 -0
- package/docs/en/benchmark/nextjs.md +1 -1
- package/docs/en/benchmark/solid.md +1 -1
- package/docs/en/benchmark/svelte.md +1 -1
- package/docs/en/benchmark/tanstack.md +1 -1
- package/docs/en/dictionary/markdown.md +326 -15
- package/docs/en/interest_of_intlayer.md +1 -1
- package/docs/en/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/en/intlayer_with_angular_21.md +412 -0
- package/docs/en-GB/benchmark/nextjs.md +1 -1
- package/docs/en-GB/benchmark/solid.md +1 -1
- package/docs/en-GB/benchmark/svelte.md +1 -1
- package/docs/en-GB/benchmark/tanstack.md +1 -1
- package/docs/en-GB/dictionary/markdown.md +336 -7
- package/docs/en-GB/interest_of_intlayer.md +1 -1
- package/docs/en-GB/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/en-GB/intlayer_with_angular_21.md +412 -0
- package/docs/es/benchmark/nextjs.md +1 -1
- package/docs/es/benchmark/solid.md +1 -1
- package/docs/es/benchmark/svelte.md +1 -1
- package/docs/es/benchmark/tanstack.md +1 -1
- package/docs/es/dictionary/markdown.md +340 -14
- package/docs/es/interest_of_intlayer.md +1 -1
- package/docs/es/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/es/intlayer_with_angular_21.md +412 -0
- package/docs/fr/benchmark/nextjs.md +1 -1
- package/docs/fr/benchmark/solid.md +1 -1
- package/docs/fr/benchmark/svelte.md +1 -1
- package/docs/fr/benchmark/tanstack.md +1 -1
- package/docs/fr/dictionary/markdown.md +340 -14
- package/docs/fr/interest_of_intlayer.md +1 -1
- package/docs/fr/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/fr/intlayer_with_angular_21.md +412 -0
- package/docs/hi/benchmark/nextjs.md +1 -1
- package/docs/hi/benchmark/solid.md +1 -1
- package/docs/hi/benchmark/svelte.md +1 -1
- package/docs/hi/benchmark/tanstack.md +1 -1
- package/docs/hi/dictionary/markdown.md +340 -14
- package/docs/hi/interest_of_intlayer.md +1 -1
- package/docs/hi/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/hi/intlayer_with_angular_21.md +412 -0
- package/docs/id/benchmark/nextjs.md +1 -1
- package/docs/id/benchmark/solid.md +1 -1
- package/docs/id/benchmark/svelte.md +1 -1
- package/docs/id/benchmark/tanstack.md +1 -1
- package/docs/id/dictionary/markdown.md +340 -14
- package/docs/id/interest_of_intlayer.md +1 -1
- package/docs/id/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/id/intlayer_with_angular_21.md +412 -0
- package/docs/it/benchmark/nextjs.md +1 -1
- package/docs/it/benchmark/solid.md +1 -1
- package/docs/it/benchmark/svelte.md +1 -1
- package/docs/it/benchmark/tanstack.md +1 -1
- package/docs/it/dictionary/markdown.md +340 -14
- package/docs/it/interest_of_intlayer.md +1 -1
- package/docs/it/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/it/intlayer_with_angular_21.md +412 -0
- package/docs/ja/benchmark/nextjs.md +1 -1
- package/docs/ja/benchmark/solid.md +1 -1
- package/docs/ja/benchmark/svelte.md +1 -1
- package/docs/ja/benchmark/tanstack.md +1 -1
- package/docs/ja/interest_of_intlayer.md +1 -1
- package/docs/ja/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/ja/intlayer_with_angular_21.md +412 -0
- package/docs/ko/benchmark/nextjs.md +1 -1
- package/docs/ko/benchmark/solid.md +1 -1
- package/docs/ko/benchmark/svelte.md +1 -1
- package/docs/ko/benchmark/tanstack.md +1 -1
- package/docs/ko/dictionary/markdown.md +340 -14
- package/docs/ko/interest_of_intlayer.md +1 -1
- package/docs/ko/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/ko/intlayer_with_angular_21.md +412 -0
- package/docs/nl/interest_of_intlayer.md +1 -1
- package/docs/nl/intlayer_with_angular_21.md +412 -0
- package/docs/pl/benchmark/nextjs.md +1 -1
- package/docs/pl/benchmark/solid.md +1 -1
- package/docs/pl/benchmark/svelte.md +1 -1
- package/docs/pl/benchmark/tanstack.md +1 -1
- package/docs/pl/dictionary/markdown.md +340 -14
- package/docs/pl/interest_of_intlayer.md +1 -1
- package/docs/pl/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/pl/intlayer_with_angular_21.md +412 -0
- package/docs/pt/benchmark/nextjs.md +1 -1
- package/docs/pt/benchmark/solid.md +1 -1
- package/docs/pt/benchmark/svelte.md +1 -1
- package/docs/pt/benchmark/tanstack.md +1 -1
- package/docs/pt/dictionary/markdown.md +340 -14
- package/docs/pt/interest_of_intlayer.md +1 -1
- package/docs/pt/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/pt/intlayer_with_angular_21.md +412 -0
- package/docs/ru/benchmark/nextjs.md +1 -1
- package/docs/ru/benchmark/solid.md +1 -1
- package/docs/ru/benchmark/svelte.md +1 -1
- package/docs/ru/benchmark/tanstack.md +1 -1
- package/docs/ru/dictionary/markdown.md +445 -3
- package/docs/ru/interest_of_intlayer.md +1 -1
- package/docs/ru/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/ru/intlayer_with_angular_21.md +412 -0
- package/docs/tr/benchmark/nextjs.md +1 -1
- package/docs/tr/benchmark/solid.md +1 -1
- package/docs/tr/benchmark/svelte.md +1 -1
- package/docs/tr/benchmark/tanstack.md +1 -1
- package/docs/tr/dictionary/markdown.md +340 -14
- package/docs/tr/interest_of_intlayer.md +1 -1
- package/docs/tr/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/tr/intlayer_with_angular_21.md +412 -0
- package/docs/uk/benchmark/nextjs.md +1 -1
- package/docs/uk/benchmark/solid.md +1 -1
- package/docs/uk/benchmark/svelte.md +1 -1
- package/docs/uk/benchmark/tanstack.md +1 -1
- package/docs/uk/dictionary/markdown.md +340 -14
- package/docs/uk/interest_of_intlayer.md +1 -1
- package/docs/uk/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/uk/intlayer_with_angular_21.md +412 -0
- package/docs/ur/interest_of_intlayer.md +1 -1
- package/docs/ur/intlayer_with_angular_21.md +412 -0
- package/docs/vi/benchmark/nextjs.md +1 -1
- package/docs/vi/benchmark/solid.md +1 -1
- package/docs/vi/benchmark/svelte.md +1 -1
- package/docs/vi/benchmark/tanstack.md +1 -1
- package/docs/vi/dictionary/markdown.md +340 -14
- package/docs/vi/interest_of_intlayer.md +1 -1
- package/docs/vi/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/vi/intlayer_with_angular_21.md +412 -0
- package/docs/zh/benchmark/nextjs.md +1 -1
- package/docs/zh/benchmark/solid.md +1 -1
- package/docs/zh/benchmark/svelte.md +1 -1
- package/docs/zh/benchmark/tanstack.md +1 -1
- package/docs/zh/dictionary/markdown.md +340 -14
- package/docs/zh/interest_of_intlayer.md +1 -1
- package/docs/zh/{intlayer_with_angular.md → intlayer_with_angular_19.md} +8 -7
- package/docs/zh/intlayer_with_angular_21.md +412 -0
- package/docs/zh-TW/interest_of_intlayer.md +1 -1
- package/docs/zh-TW/intlayer_with_angular_21.md +412 -0
- package/package.json +7 -7
- package/src/common.ts +12 -6
- package/src/generated/docs.entry.ts +39 -19
|
@@ -66,13 +66,10 @@ Puede declarar contenido Markdown usando la función `md` o simplemente como una
|
|
|
66
66
|
Ejemplo de estructura de archivos:
|
|
67
67
|
|
|
68
68
|
```text
|
|
69
|
-
content
|
|
70
|
-
├── en
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
│ └── markdown-file.fr.content.md
|
|
74
|
-
└── es/
|
|
75
|
-
└── markdown-file.es.content.md
|
|
69
|
+
content
|
|
70
|
+
├── markdown-file.en.content.md
|
|
71
|
+
├── markdown-file.fr.content.md
|
|
72
|
+
└── markdown-file.es.content.md
|
|
76
73
|
```
|
|
77
74
|
|
|
78
75
|
Puede agregar en el front-matter cualquier propiedad definida en la [Definición del Diccionario](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/content_file.md)
|
|
@@ -130,8 +127,6 @@ Puede declarar contenido Markdown usando la función `md` o simplemente como una
|
|
|
130
127
|
</Tab>
|
|
131
128
|
</Tabs>
|
|
132
129
|
|
|
133
|
-
---
|
|
134
|
-
|
|
135
130
|
## Renderización de Markdown
|
|
136
131
|
|
|
137
132
|
Intlayer proporciona dos formas independientes de renderizar Markdown:
|
|
@@ -147,7 +142,7 @@ La renderización de Markdown admite **MDX** — use cualquier componente JSX/fr
|
|
|
147
142
|
### 1. Renderización Automática (a través de `useIntlayer`)
|
|
148
143
|
|
|
149
144
|
<Tabs group="framework">
|
|
150
|
-
<Tab label="React
|
|
145
|
+
<Tab label="React" value="react">
|
|
151
146
|
Los nodos Markdown se pueden renderizar directamente como JSX.
|
|
152
147
|
|
|
153
148
|
```tsx fileName="App.tsx"
|
|
@@ -197,6 +192,57 @@ La renderización de Markdown admite **MDX** — use cualquier componente JSX/fr
|
|
|
197
192
|
{myMarkdownContent.metadata.title}
|
|
198
193
|
```
|
|
199
194
|
|
|
195
|
+
</Tab>
|
|
196
|
+
<Tab label="Next.js" value="nextjs">
|
|
197
|
+
Los nodos Markdown se pueden renderizar directamente como JSX.
|
|
198
|
+
|
|
199
|
+
```tsx fileName="App.tsx"
|
|
200
|
+
import { useIntlayer } from "next-intlayer";
|
|
201
|
+
import { MarkdownProvider } from "next-intlayer/markdown";
|
|
202
|
+
|
|
203
|
+
const AppContent = () => {
|
|
204
|
+
const { myMarkdownContent } = useIntlayer("app");
|
|
205
|
+
|
|
206
|
+
return <div>{myMarkdownContent}</div>;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const App = () => (
|
|
210
|
+
<MarkdownProvider
|
|
211
|
+
components={{
|
|
212
|
+
h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
|
|
213
|
+
MyButton: (props) => <button {...props} />, // Componente MDX
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
<AppContent />
|
|
217
|
+
</MarkdownProvider>
|
|
218
|
+
);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
> Si `MarkdownProvider` no está presente, Intlayer renderizará el markdown usando el analizador por defecto de Markdown a JSX.
|
|
222
|
+
|
|
223
|
+
También puede proporcionar anulaciones locales para nodos específicos utilizando el método `.use()`:
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
{myMarkdownContent.use({
|
|
227
|
+
h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
|
|
228
|
+
})}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Puede recuperar el Markdown como cadena:
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
{myMarkdownContent.value}
|
|
235
|
+
{String(myMarkdownContent)}
|
|
236
|
+
{myMarkdownContent.toString()}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Y puede acceder a los metadatos de su markdown así:
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
{myMarkdownContent.metadata}
|
|
243
|
+
{myMarkdownContent.metadata.title}
|
|
244
|
+
```
|
|
245
|
+
|
|
200
246
|
</Tab>
|
|
201
247
|
<Tab label="Vue" value="vue">
|
|
202
248
|
En Vue, el contenido Markdown se puede renderizar usando la etiqueta incorporada `component` o directamente como un nodo.
|
|
@@ -441,7 +487,7 @@ La renderización de Markdown admite **MDX** — use cualquier componente JSX/fr
|
|
|
441
487
|
Estas utilidades renderizan **únicamente cadenas Markdown puras** y son independientes de `useIntlayer`. Úselas cuando necesite renderizar Markdown de fuentes que no sean sus diccionarios.
|
|
442
488
|
|
|
443
489
|
<Tabs group="framework">
|
|
444
|
-
<Tab label="React
|
|
490
|
+
<Tab label="React" value="react">
|
|
445
491
|
|
|
446
492
|
#### Componente `<MarkdownRenderer />`
|
|
447
493
|
|
|
@@ -479,6 +525,45 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
479
525
|
const jsx = renderMarkdown("# Mi Título", { forceBlock: true });
|
|
480
526
|
```
|
|
481
527
|
|
|
528
|
+
</Tab>
|
|
529
|
+
<Tab label="Next.js" value="nextjs">
|
|
530
|
+
|
|
531
|
+
#### Componente `<MarkdownRenderer />`
|
|
532
|
+
|
|
533
|
+
Renderiza una cadena Markdown con opciones específicas.
|
|
534
|
+
|
|
535
|
+
```tsx
|
|
536
|
+
import { MarkdownRenderer } from "next-intlayer/markdown";
|
|
537
|
+
|
|
538
|
+
<MarkdownRenderer forceBlock={true} tagfilter={true}>
|
|
539
|
+
{"# Mi Título"}
|
|
540
|
+
</MarkdownRenderer>
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
#### Hook `useMarkdownRenderer()`
|
|
544
|
+
|
|
545
|
+
Obtenga una función de renderizado preconfigurada.
|
|
546
|
+
|
|
547
|
+
```tsx
|
|
548
|
+
import { useMarkdownRenderer } from "next-intlayer/markdown";
|
|
549
|
+
|
|
550
|
+
const renderMarkdown = useMarkdownRenderer({
|
|
551
|
+
forceBlock: true,
|
|
552
|
+
components: { h1: (props) => <h1 {...props} className="custom" /> }
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
return renderMarkdown("# Mi Título");
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
#### Utilidad `renderMarkdown()`
|
|
559
|
+
Utilidad independiente para renderizar fuera de los componentes.
|
|
560
|
+
|
|
561
|
+
```tsx
|
|
562
|
+
import { renderMarkdown } from "next-intlayer/markdown";
|
|
563
|
+
|
|
564
|
+
const jsx = renderMarkdown("# Mi Título", { forceBlock: true });
|
|
565
|
+
```
|
|
566
|
+
|
|
482
567
|
</Tab>
|
|
483
568
|
<Tab label="Vue" value="vue">
|
|
484
569
|
|
|
@@ -608,14 +693,12 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
608
693
|
</Tab>
|
|
609
694
|
</Tabs>
|
|
610
695
|
|
|
611
|
-
---
|
|
612
|
-
|
|
613
696
|
## Configuración Global con `MarkdownProvider`
|
|
614
697
|
|
|
615
698
|
`MarkdownProvider` (o su equivalente en el framework) configura el proceso de renderización Markdown para toda su aplicación. Esto se aplica tanto a la renderización automática de `useIntlayer` como a las utilidades auxiliares. Las opciones configuradas aquí son las predeterminadas — `.use()` las anula a nivel de nodo.
|
|
616
699
|
|
|
617
700
|
<Tabs group="framework">
|
|
618
|
-
<Tab label="React
|
|
701
|
+
<Tab label="React" value="react">
|
|
619
702
|
|
|
620
703
|
```tsx fileName="AppProvider.tsx"
|
|
621
704
|
import { MarkdownProvider } from "react-intlayer/markdown";
|
|
@@ -633,6 +716,7 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
633
716
|
);
|
|
634
717
|
```
|
|
635
718
|
|
|
719
|
+
|
|
636
720
|
> MDX es compatible — cualquier nombre de componente usado dentro de su Markdown (ej. `<MyCustomJSXComponent />`) se resuelve contra el mapeo de `components`.
|
|
637
721
|
|
|
638
722
|
También puede usar su propio renderizador de markdown:
|
|
@@ -655,6 +739,48 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
655
739
|
|
|
656
740
|
> Importar su renderizador de Markdown dinámicamente es una buena manera de reducir el tamaño del paquete de su aplicación.
|
|
657
741
|
|
|
742
|
+
</Tab>
|
|
743
|
+
<Tab label="Next.js" value="nextjs">
|
|
744
|
+
|
|
745
|
+
```tsx fileName="AppProvider.tsx"
|
|
746
|
+
import { MarkdownProvider } from "next-intlayer/markdown";
|
|
747
|
+
|
|
748
|
+
export const AppProvider = ({ children }) => (
|
|
749
|
+
<MarkdownProvider
|
|
750
|
+
components={{
|
|
751
|
+
h1: (props) => <h1 style={{color: 'green'}} {...props} />,
|
|
752
|
+
a: ({ href, ...props }) => <a style={{color: 'red'}} {...props} />,
|
|
753
|
+
MyCustomJSXComponent: (props) => <span style={{color: 'red'}} {...props} />,
|
|
754
|
+
}}
|
|
755
|
+
>
|
|
756
|
+
{children}
|
|
757
|
+
</MarkdownProvider>
|
|
758
|
+
);
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
> MDX es compatible — cualquier nombre de componente usado dentro de su Markdown (ej. `<MyCustomJSXComponent />`) se resuelve contra el mapeo de `components`.
|
|
763
|
+
|
|
764
|
+
También puede usar su propio renderizador de markdown:
|
|
765
|
+
|
|
766
|
+
```tsx fileName="AppProvider.tsx"
|
|
767
|
+
import { MarkdownProvider } from "next-intlayer/markdown";
|
|
768
|
+
|
|
769
|
+
export const AppProvider = ({ children }) => (
|
|
770
|
+
<MarkdownProvider
|
|
771
|
+
renderMarkdown={async (md) => {
|
|
772
|
+
// Use dynamic import to reduce the bundle size of your application
|
|
773
|
+
const { renderMarkdown } = await import('next-intlayer/markdown');
|
|
774
|
+
return renderMarkdown(md);
|
|
775
|
+
}}
|
|
776
|
+
>
|
|
777
|
+
{children}
|
|
778
|
+
</MarkdownProvider>
|
|
779
|
+
);
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
> Importar su renderizador de Markdown dinámicamente es una buena manera de reducir el tamaño del paquete de su aplicación.
|
|
783
|
+
|
|
658
784
|
</Tab>
|
|
659
785
|
<Tab label="Vue" value="vue">
|
|
660
786
|
|
|
@@ -680,6 +806,9 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
680
806
|
app.mount("#app");
|
|
681
807
|
```
|
|
682
808
|
|
|
809
|
+
|
|
810
|
+
> MDX es compatible — cualquier nombre de componente usado dentro de su Markdown (ej. `<MyCustomJSXComponent />`) se resuelve contra el mapeo de `components`.
|
|
811
|
+
|
|
683
812
|
También puede usar su propio renderizador de markdown:
|
|
684
813
|
|
|
685
814
|
```typescript fileName="main.ts"
|
|
@@ -721,6 +850,9 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
721
850
|
</MarkdownProvider>
|
|
722
851
|
```
|
|
723
852
|
|
|
853
|
+
|
|
854
|
+
> MDX es compatible — cualquier nombre de componente usado dentro de su Markdown (ej. `<MyCustomJSXComponent />`) se resuelve contra el mapeo de `components`.
|
|
855
|
+
|
|
724
856
|
También puede usar su propio renderizador de markdown:
|
|
725
857
|
|
|
726
858
|
```svelte fileName="App.svelte"
|
|
@@ -757,6 +889,9 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
757
889
|
);
|
|
758
890
|
```
|
|
759
891
|
|
|
892
|
+
|
|
893
|
+
> MDX es compatible — cualquier nombre de componente usado dentro de su Markdown (ej. `<MyCustomJSXComponent />`) se resuelve contra el mapeo de `components`.
|
|
894
|
+
|
|
760
895
|
También puede usar su propio renderizador de markdown:
|
|
761
896
|
|
|
762
897
|
```tsx fileName="AppProvider.tsx"
|
|
@@ -793,6 +928,9 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
793
928
|
);
|
|
794
929
|
```
|
|
795
930
|
|
|
931
|
+
|
|
932
|
+
> MDX es compatible — cualquier nombre de componente usado dentro de su Markdown (ej. `<MyCustomJSXComponent />`) se resuelve contra el mapeo de `components`.
|
|
933
|
+
|
|
796
934
|
También puede usar su propio renderizador de markdown:
|
|
797
935
|
|
|
798
936
|
```tsx fileName="AppProvider.tsx"
|
|
@@ -836,3 +974,191 @@ Estas utilidades renderizan **únicamente cadenas Markdown puras** y son indepen
|
|
|
836
974
|
|
|
837
975
|
</Tab>
|
|
838
976
|
</Tabs>
|
|
977
|
+
|
|
978
|
+
## Suspense
|
|
979
|
+
|
|
980
|
+
El renderizador de Markdown de Intlayer se carga dinámicamente. Aunque está optimizado, el fragmento (chunk) del analizador subyacente es de aproximadamente 55 kb. Cargar esto sincrónicamente retrasa la representación inicial de la página y degrada el First Contentful Paint (FCP).
|
|
981
|
+
|
|
982
|
+
Para evitar el bloqueo de la interfaz de usuario, Intlayer se integra con la API Suspense de React. Recupera el analizador en segundo plano y arroja una Promesa durante la descarga.
|
|
983
|
+
|
|
984
|
+
Envuelva cualquier componente que represente Intlayer Markdown en un límite `<Suspense>`. Esto muestra un estado de retroceso localizado mientras se descarga el fragmento, permitiendo que el resto de su DOM se represente de inmediato.
|
|
985
|
+
|
|
986
|
+
Advertencia: Si no proporciona un límite `<Suspense>`, React suspenderá en el nivel raíz o bloqueará la representación de todo el árbol de componentes hasta que el fragmento de 55 kb esté completamente cargado.
|
|
987
|
+
|
|
988
|
+
<Tabs>
|
|
989
|
+
<Tab label="Next.js" value="nextjs">
|
|
990
|
+
|
|
991
|
+
En Next.js App Router, puede usar React `Suspense` para componentes del cliente o un archivo `loading.tsx` para componentes del servidor.
|
|
992
|
+
|
|
993
|
+
**Componente de cliente:**
|
|
994
|
+
|
|
995
|
+
```tsx fileName="components/MyComponent.tsx"
|
|
996
|
+
"use client";
|
|
997
|
+
import { useIntlayer } from "next-intlayer";
|
|
998
|
+
import { Suspense } from "react";
|
|
999
|
+
|
|
1000
|
+
const MyComponent = () => {
|
|
1001
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1002
|
+
|
|
1003
|
+
return (
|
|
1004
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1005
|
+
);
|
|
1006
|
+
};
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
**Componente de servidor con `loading.tsx`:**
|
|
1010
|
+
|
|
1011
|
+
```tsx fileName="app/loading.tsx"
|
|
1012
|
+
export default function Loading() {
|
|
1013
|
+
return <div>Loading...</div>;
|
|
1014
|
+
}
|
|
1015
|
+
```
|
|
1016
|
+
|
|
1017
|
+
```tsx fileName="app/page.tsx"
|
|
1018
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
1019
|
+
|
|
1020
|
+
const MyPage = () => {
|
|
1021
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1022
|
+
return <div>{markdownContent}</div>;
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
export default MyPage;
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
</Tab>
|
|
1029
|
+
|
|
1030
|
+
<Tab label="React" value="react">
|
|
1031
|
+
|
|
1032
|
+
```tsx
|
|
1033
|
+
import { useIntlayer } from "react-intlayer";
|
|
1034
|
+
import { Suspense } from "react";
|
|
1035
|
+
|
|
1036
|
+
const MyComponent = () => {
|
|
1037
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1038
|
+
|
|
1039
|
+
return (
|
|
1040
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1041
|
+
);
|
|
1042
|
+
};
|
|
1043
|
+
```
|
|
1044
|
+
|
|
1045
|
+
</Tab>
|
|
1046
|
+
|
|
1047
|
+
<Tab label="Vue" value="vue">
|
|
1048
|
+
|
|
1049
|
+
Vue tiene un componente `<Suspense>` incorporado. Envuelva el componente que representa contenido Markdown en un límite `<Suspense>`.
|
|
1050
|
+
|
|
1051
|
+
```vue fileName="MyComponent.vue"
|
|
1052
|
+
<script setup>
|
|
1053
|
+
import { useIntlayer } from "vue-intlayer";
|
|
1054
|
+
|
|
1055
|
+
const { markdownContent } = useIntlayer("my-markdown");
|
|
1056
|
+
</script>
|
|
1057
|
+
|
|
1058
|
+
<template>
|
|
1059
|
+
<Suspense>
|
|
1060
|
+
<component :is="markdownContent" />
|
|
1061
|
+
<template #fallback>
|
|
1062
|
+
<div>Loading...</div>
|
|
1063
|
+
</template>
|
|
1064
|
+
</Suspense>
|
|
1065
|
+
</template>
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
</Tab>
|
|
1069
|
+
<Tab label="Svelte" value="svelte">
|
|
1070
|
+
|
|
1071
|
+
Svelte no tiene un equivalente a la API Suspense. Utilice un bloque `{#await}` para manejar la representación asíncrona del contenido Markdown.
|
|
1072
|
+
|
|
1073
|
+
```svelte fileName="MyComponent.svelte"
|
|
1074
|
+
<script lang="ts">
|
|
1075
|
+
import { useIntlayer } from "svelte-intlayer";
|
|
1076
|
+
|
|
1077
|
+
const content = useIntlayer("my-markdown");
|
|
1078
|
+
</script>
|
|
1079
|
+
|
|
1080
|
+
{#await $content.markdownContent}
|
|
1081
|
+
<div>Loading...</div>
|
|
1082
|
+
{:then rendered}
|
|
1083
|
+
{@html rendered}
|
|
1084
|
+
{/await}
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
</Tab>
|
|
1088
|
+
<Tab label="Preact" value="preact">
|
|
1089
|
+
|
|
1090
|
+
Preact admite la API Suspense de React a través de `preact/compat`.
|
|
1091
|
+
|
|
1092
|
+
```tsx fileName="MyComponent.tsx"
|
|
1093
|
+
import { useIntlayer } from "preact-intlayer";
|
|
1094
|
+
import { Suspense } from "preact/compat";
|
|
1095
|
+
|
|
1096
|
+
const MyComponent = () => {
|
|
1097
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1098
|
+
|
|
1099
|
+
return (
|
|
1100
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1101
|
+
);
|
|
1102
|
+
};
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
</Tab>
|
|
1106
|
+
<Tab label="Solid" value="solid">
|
|
1107
|
+
|
|
1108
|
+
Solid tiene su propio componente `<Suspense>` de `solid-js`.
|
|
1109
|
+
|
|
1110
|
+
```tsx fileName="MyComponent.tsx"
|
|
1111
|
+
import { useIntlayer } from "solid-intlayer";
|
|
1112
|
+
import { Suspense } from "solid-js";
|
|
1113
|
+
|
|
1114
|
+
const MyComponent = () => {
|
|
1115
|
+
const { markdownContent } = useIntlayer("my-markdown");
|
|
1116
|
+
|
|
1117
|
+
return (
|
|
1118
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1119
|
+
);
|
|
1120
|
+
};
|
|
1121
|
+
```
|
|
1122
|
+
|
|
1123
|
+
</Tab>
|
|
1124
|
+
<Tab label="Angular" value="angular">
|
|
1125
|
+
|
|
1126
|
+
Angular no tiene una API Suspense. Utilice las vistas diferibles de Angular (`@defer`) para manejar contenido Markdown cargado de forma diferida (requiere Angular 17+).
|
|
1127
|
+
|
|
1128
|
+
```typescript fileName="my.component.ts"
|
|
1129
|
+
import { Component } from "@angular/core";
|
|
1130
|
+
import { useIntlayer } from "angular-intlayer";
|
|
1131
|
+
|
|
1132
|
+
@Component({
|
|
1133
|
+
selector: "app-my",
|
|
1134
|
+
template: `
|
|
1135
|
+
@defer {
|
|
1136
|
+
<div [innerHTML]="content().markdownContent"></div>
|
|
1137
|
+
} @loading {
|
|
1138
|
+
<div>Loading...</div>
|
|
1139
|
+
}
|
|
1140
|
+
`,
|
|
1141
|
+
})
|
|
1142
|
+
export class MyComponent {
|
|
1143
|
+
content = useIntlayer("my-markdown");
|
|
1144
|
+
}
|
|
1145
|
+
```
|
|
1146
|
+
|
|
1147
|
+
</Tab>
|
|
1148
|
+
</Tabs>
|
|
1149
|
+
|
|
1150
|
+
---
|
|
1151
|
+
|
|
1152
|
+
## Referencia de opciones
|
|
1153
|
+
|
|
1154
|
+
Estas opciones se pueden pasar a `MarkdownProvider`, `MarkdownRenderer`, `useMarkdownRenderer` y `renderMarkdown`.
|
|
1155
|
+
|
|
1156
|
+
| Option | Type | Default | Descripción |
|
|
1157
|
+
| :-------------------- | :---------- | :------ | :--------------------------------------------------------------------------------------------------------------- |
|
|
1158
|
+
| `forceBlock` | `boolean` | `false` | Fuerza la salida para que esté envuelta en un elemento de nivel de bloque (ej. `<div>`). |
|
|
1159
|
+
| `forceInline` | `boolean` | `false` | Fuerza la salida para que esté envuelta en un elemento en línea (ej. `<span>`). |
|
|
1160
|
+
| `tagfilter` | `boolean` | `true` | Habilita el GitHub Tag Filter para mejorar la seguridad eliminando etiquetas HTML peligrosas. |
|
|
1161
|
+
| `preserveFrontmatter` | `boolean` | `false` | Si es `true`, no se eliminará el frontmatter al principio de la cadena Markdown. |
|
|
1162
|
+
| `components` | `Overrides` | `{}` | Un mapa de etiquetas HTML a componentes personalizados (ej. `{ h1: MyHeading }`). |
|
|
1163
|
+
| `wrapper` | `Component` | `null` | Un componente personalizado para envolver el Markdown renderizado. |
|
|
1164
|
+
| `renderMarkdown` | `Function` | `null` | Una función de renderizado personalizada para reemplazar completamente el compilador de Markdown predeterminado. |
|
|
@@ -223,7 +223,7 @@ Este enfoque te permite:
|
|
|
223
223
|
|
|
224
224
|
Las estrellas de GitHub son un fuerte indicador de la popularidad de un proyecto, la confianza de la comunidad y la relevancia a largo plazo. Si bien no son una medida directa de la calidad técnica, reflejan cuántos desarrolladores encuentran útil el proyecto, siguen su progreso y es probable que lo adopten. Para estimar el valor de un proyecto, las estrellas ayudan a comparar la tracción entre alternativas y brindan información sobre el crecimiento del ecosistema.
|
|
225
225
|
|
|
226
|
-
[](https://www.star-history.com/#aymericzip/intlayer&formatjs/formatjs&i18next/react-i18next&i18next/i18next&i18next/next-i18next&lingui/js-lingui&amannn/next-intl&intlify/vue-i18n&codingcommons/typesafe-i18n&opral/paraglide-js)
|
|
227
227
|
|
|
228
228
|
---
|
|
229
229
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-04-18
|
|
3
3
|
updatedAt: 2026-05-06
|
|
4
|
-
title: Angular i18n - Cómo traducir una aplicación Angular
|
|
4
|
+
title: Angular i18n - Cómo traducir una aplicación Angular 19 (Webpack)
|
|
5
5
|
description: Descubre cómo hacer que tu sitio web Angular sea multilingüe. Sigue la documentación para internacionalizar (i18n) y traducirlo.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internacionalización
|
|
@@ -13,8 +13,9 @@ slugs:
|
|
|
13
13
|
- doc
|
|
14
14
|
- environment
|
|
15
15
|
- angular
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
- 19
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-angular-19-template
|
|
18
|
+
applicationShowcase: https://intlayer-angular-19-template.vercel.app
|
|
18
19
|
history:
|
|
19
20
|
- version: 8.9.0
|
|
20
21
|
date: 2026-05-04
|
|
@@ -27,7 +28,7 @@ history:
|
|
|
27
28
|
changes: "Inicializar historial"
|
|
28
29
|
---
|
|
29
30
|
|
|
30
|
-
# Traduce tu sitio web Angular usando Intlayer | Internacionalización (i18n)
|
|
31
|
+
# Traduce tu sitio web Angular 19 (Webpack) usando Intlayer | Internacionalización (i18n)
|
|
31
32
|
|
|
32
33
|
## Tabla de contenidos
|
|
33
34
|
|
|
@@ -52,7 +53,7 @@ Con Intlayer, puedes:
|
|
|
52
53
|
<Tab label="Código" value="code">
|
|
53
54
|
|
|
54
55
|
<iframe
|
|
55
|
-
src="https://ide.intlayer.org/aymericzip/intlayer-angular-template?file=intlayer.config.ts"
|
|
56
|
+
src="https://ide.intlayer.org/aymericzip/intlayer-angular-19-template?file=intlayer.config.ts"
|
|
56
57
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
57
58
|
title="Demo CodeSandbox - Cómo internacionalizar tu aplicación usando Intlayer"
|
|
58
59
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
@@ -63,7 +64,7 @@ Con Intlayer, puedes:
|
|
|
63
64
|
<Tab label="Demo" value="demo">
|
|
64
65
|
|
|
65
66
|
<iframe
|
|
66
|
-
src="https://intlayer-angular-template.vercel.app"
|
|
67
|
+
src="https://intlayer-angular-19-template.vercel.app"
|
|
67
68
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
68
69
|
title="Demo - intlayer-angular-template"
|
|
69
70
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
@@ -73,7 +74,7 @@ Con Intlayer, puedes:
|
|
|
73
74
|
</Tab>
|
|
74
75
|
</Tabs>
|
|
75
76
|
|
|
76
|
-
Ver [Plantilla de aplicación](https://github.com/aymericzip/intlayer-angular-template) en GitHub.
|
|
77
|
+
Ver [Plantilla de aplicación](https://github.com/aymericzip/intlayer-angular-19-template) en GitHub.
|
|
77
78
|
|
|
78
79
|
### Paso 1: Instalar dependencias
|
|
79
80
|
|