@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
|
@@ -68,13 +68,10 @@ You can declare Markdown content using the `md` function or simply as a string (
|
|
|
68
68
|
Example of file structure:
|
|
69
69
|
|
|
70
70
|
```text
|
|
71
|
-
content
|
|
72
|
-
├── en
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
│ └── markdown-file.fr.content.md
|
|
76
|
-
└── es/
|
|
77
|
-
└── markdown-file.es.content.md
|
|
71
|
+
content
|
|
72
|
+
├── markdown-file.en.content.md
|
|
73
|
+
├── markdown-file.fr.content.md
|
|
74
|
+
└── markdown-file.es.content.md
|
|
78
75
|
```
|
|
79
76
|
|
|
80
77
|
You can add in front-matter any properties defined in the [Dictionary definition](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
|
|
@@ -134,8 +131,6 @@ You can declare Markdown content using the `md` function or simply as a string (
|
|
|
134
131
|
|
|
135
132
|
</Tabs>
|
|
136
133
|
|
|
137
|
-
---
|
|
138
|
-
|
|
139
134
|
## Rendering Markdown
|
|
140
135
|
|
|
141
136
|
Intlayer provides two independent ways to render Markdown:
|
|
@@ -151,7 +146,7 @@ Markdown rendering supports **MDX** — use any JSX/framework component by name
|
|
|
151
146
|
### 1. Automatic Rendering (via `useIntlayer`)
|
|
152
147
|
|
|
153
148
|
<Tabs group="framework">
|
|
154
|
-
<Tab label="React
|
|
149
|
+
<Tab label="React" value="react">
|
|
155
150
|
Markdown nodes can be rendered directly as JSX.
|
|
156
151
|
|
|
157
152
|
```tsx fileName="App.tsx"
|
|
@@ -201,6 +196,57 @@ Markdown rendering supports **MDX** — use any JSX/framework component by name
|
|
|
201
196
|
{myMarkdownContent.metadata.title}
|
|
202
197
|
```
|
|
203
198
|
|
|
199
|
+
</Tab>
|
|
200
|
+
<Tab label="Next.js" value="nextjs">
|
|
201
|
+
Markdown nodes can be rendered directly as JSX.
|
|
202
|
+
|
|
203
|
+
```tsx fileName="App.tsx"
|
|
204
|
+
import { useIntlayer } from "next-intlayer";
|
|
205
|
+
import { MarkdownProvider } from "next-intlayer/markdown";
|
|
206
|
+
|
|
207
|
+
const AppContent = () => {
|
|
208
|
+
const { myMarkdownContent } = useIntlayer("app");
|
|
209
|
+
|
|
210
|
+
return <div>{myMarkdownContent}</div>;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const App = () => (
|
|
214
|
+
<MarkdownProvider
|
|
215
|
+
components={{
|
|
216
|
+
h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
|
|
217
|
+
MyButton: (props) => <button {...props} />, // MDX component
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
<AppContent />
|
|
221
|
+
</MarkdownProvider>
|
|
222
|
+
);
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
> If `MarkdownProvider` not present, intlayer will render the markdown using the default Markdown to JSX parser.
|
|
226
|
+
|
|
227
|
+
You can also provide local overrides for specific nodes using the `.use()` method:
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
{myMarkdownContent.use({
|
|
231
|
+
h1: ({ children }) => <h1 style={{ color: "red" }}>{children}</h1>,
|
|
232
|
+
})}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
You can retrieve the Markdown as string:
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
{myMarkdownContent.value}
|
|
239
|
+
{String(myMarkdownContent)}
|
|
240
|
+
{myMarkdownContent.toString()}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
And you can access your markdown metadata like :
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
{myMarkdownContent.metadata}
|
|
247
|
+
{myMarkdownContent.metadata.title}
|
|
248
|
+
```
|
|
249
|
+
|
|
204
250
|
</Tab>
|
|
205
251
|
<Tab label="Vue" value="vue">
|
|
206
252
|
In Vue, Markdown content can be rendered using the `component` built-in or directly as a node.
|
|
@@ -445,7 +491,7 @@ Markdown rendering supports **MDX** — use any JSX/framework component by name
|
|
|
445
491
|
These utilities render **raw Markdown strings** and are independent of `useIntlayer`. Use them when you need to render Markdown from sources other than your dictionaries.
|
|
446
492
|
|
|
447
493
|
<Tabs group="framework">
|
|
448
|
-
<Tab label="React
|
|
494
|
+
<Tab label="React" value="react">
|
|
449
495
|
|
|
450
496
|
#### `<MarkdownRenderer />` Component
|
|
451
497
|
|
|
@@ -483,6 +529,45 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
483
529
|
const jsx = renderMarkdown("# My Title", { forceBlock: true });
|
|
484
530
|
```
|
|
485
531
|
|
|
532
|
+
</Tab>
|
|
533
|
+
<Tab label="Next.js" value="nextjs">
|
|
534
|
+
|
|
535
|
+
#### `<MarkdownRenderer />` Component
|
|
536
|
+
|
|
537
|
+
Render a Markdown string with specific options.
|
|
538
|
+
|
|
539
|
+
```tsx
|
|
540
|
+
import { MarkdownRenderer } from "next-intlayer/markdown";
|
|
541
|
+
|
|
542
|
+
<MarkdownRenderer forceBlock={true} tagfilter={true}>
|
|
543
|
+
{"# My Title"}
|
|
544
|
+
</MarkdownRenderer>
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
#### `useMarkdownRenderer()` Hook
|
|
548
|
+
|
|
549
|
+
Get a pre-configured renderer function.
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import { useMarkdownRenderer } from "next-intlayer/markdown";
|
|
553
|
+
|
|
554
|
+
const renderMarkdown = useMarkdownRenderer({
|
|
555
|
+
forceBlock: true,
|
|
556
|
+
components: { h1: (props) => <h1 {...props} className="custom" /> }
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
return renderMarkdown("# My Title");
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
#### `renderMarkdown()` Utility
|
|
563
|
+
Standalone utility for rendering outside of components.
|
|
564
|
+
|
|
565
|
+
```tsx
|
|
566
|
+
import { renderMarkdown } from "next-intlayer/markdown";
|
|
567
|
+
|
|
568
|
+
const jsx = renderMarkdown("# My Title", { forceBlock: true });
|
|
569
|
+
```
|
|
570
|
+
|
|
486
571
|
</Tab>
|
|
487
572
|
<Tab label="Vue" value="vue">
|
|
488
573
|
|
|
@@ -612,14 +697,12 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
612
697
|
</Tab>
|
|
613
698
|
</Tabs>
|
|
614
699
|
|
|
615
|
-
---
|
|
616
|
-
|
|
617
700
|
## Global Configuration with `MarkdownProvider`
|
|
618
701
|
|
|
619
702
|
`MarkdownProvider` (or its framework equivalent) configures the Markdown rendering pipeline for your entire application. It applies to both the automatic `useIntlayer` rendering and the helper utilities. Options set here are the defaults — `.use()` overrides them at the node level.
|
|
620
703
|
|
|
621
704
|
<Tabs group="framework">
|
|
622
|
-
<Tab label="React
|
|
705
|
+
<Tab label="React" value="react">
|
|
623
706
|
|
|
624
707
|
```tsx fileName="AppProvider.tsx"
|
|
625
708
|
import { MarkdownProvider } from "react-intlayer/markdown";
|
|
@@ -637,6 +720,7 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
637
720
|
);
|
|
638
721
|
```
|
|
639
722
|
|
|
723
|
+
|
|
640
724
|
> MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
|
|
641
725
|
|
|
642
726
|
You can also use your own markdown renderer:
|
|
@@ -659,6 +743,48 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
659
743
|
|
|
660
744
|
> Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
|
|
661
745
|
|
|
746
|
+
</Tab>
|
|
747
|
+
<Tab label="Next.js" value="nextjs">
|
|
748
|
+
|
|
749
|
+
```tsx fileName="AppProvider.tsx"
|
|
750
|
+
import { MarkdownProvider } from "next-intlayer/markdown";
|
|
751
|
+
|
|
752
|
+
export const AppProvider = ({ children }) => (
|
|
753
|
+
<MarkdownProvider
|
|
754
|
+
components={{
|
|
755
|
+
h1: (props) => <h1 style={{color: 'green'}} {...props} />,
|
|
756
|
+
a: ({ href, ...props }) => <a style={{color: 'red'}} {...props} />,
|
|
757
|
+
MyCustomJSXComponent: (props) => <span style={{color: 'red'}} {...props} />,
|
|
758
|
+
}}
|
|
759
|
+
>
|
|
760
|
+
{children}
|
|
761
|
+
</MarkdownProvider>
|
|
762
|
+
);
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
> MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
|
|
767
|
+
|
|
768
|
+
You can also use your own markdown renderer:
|
|
769
|
+
|
|
770
|
+
```tsx fileName="AppProvider.tsx"
|
|
771
|
+
import { MarkdownProvider } from "next-intlayer/markdown";
|
|
772
|
+
|
|
773
|
+
export const AppProvider = ({ children }) => (
|
|
774
|
+
<MarkdownProvider
|
|
775
|
+
renderMarkdown={async (md) => {
|
|
776
|
+
// Use dynamic import to reduce the bundle size of your application
|
|
777
|
+
const { renderMarkdown } = await import('next-intlayer/markdown');
|
|
778
|
+
return renderMarkdown(md);
|
|
779
|
+
}}
|
|
780
|
+
>
|
|
781
|
+
{children}
|
|
782
|
+
</MarkdownProvider>
|
|
783
|
+
);
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
> Importing your Markdown renderer dynamically is a good way to reduce the bundle size of your application.
|
|
787
|
+
|
|
662
788
|
</Tab>
|
|
663
789
|
<Tab label="Vue" value="vue">
|
|
664
790
|
|
|
@@ -684,6 +810,9 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
684
810
|
app.mount("#app");
|
|
685
811
|
```
|
|
686
812
|
|
|
813
|
+
|
|
814
|
+
> MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
|
|
815
|
+
|
|
687
816
|
You can also use your own markdown renderer:
|
|
688
817
|
|
|
689
818
|
```typescript fileName="main.ts"
|
|
@@ -725,6 +854,9 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
725
854
|
</MarkdownProvider>
|
|
726
855
|
```
|
|
727
856
|
|
|
857
|
+
|
|
858
|
+
> MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
|
|
859
|
+
|
|
728
860
|
You can also use your own markdown renderer:
|
|
729
861
|
|
|
730
862
|
```svelte fileName="App.svelte"
|
|
@@ -761,6 +893,9 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
761
893
|
);
|
|
762
894
|
```
|
|
763
895
|
|
|
896
|
+
|
|
897
|
+
> MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
|
|
898
|
+
|
|
764
899
|
You can also use your own markdown renderer:
|
|
765
900
|
|
|
766
901
|
```tsx fileName="AppProvider.tsx"
|
|
@@ -797,6 +932,9 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
797
932
|
);
|
|
798
933
|
```
|
|
799
934
|
|
|
935
|
+
|
|
936
|
+
> MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
|
|
937
|
+
|
|
800
938
|
You can also use your own markdown renderer:
|
|
801
939
|
|
|
802
940
|
```tsx fileName="AppProvider.tsx"
|
|
@@ -833,6 +971,9 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
833
971
|
};
|
|
834
972
|
```
|
|
835
973
|
|
|
974
|
+
|
|
975
|
+
> MDX is supported — any component name used inside your Markdown (e.g. `<MyCustomJSXComponent />`) is resolved against the `components` map.
|
|
976
|
+
|
|
836
977
|
You can also use your own markdown renderer:
|
|
837
978
|
|
|
838
979
|
```typescript fileName="app.config.ts"
|
|
@@ -855,7 +996,177 @@ These utilities render **raw Markdown strings** and are independent of `useIntla
|
|
|
855
996
|
</Tab>
|
|
856
997
|
</Tabs>
|
|
857
998
|
|
|
858
|
-
|
|
999
|
+
## Suspense
|
|
1000
|
+
|
|
1001
|
+
The Intlayer Markdown renderer is dynamically loaded. Although optimized, the underlying parser chunk is approximately 55kb. Loading this synchronously delays the initial page rendering and degrades First Contentful Paint (FCP).
|
|
1002
|
+
|
|
1003
|
+
To prevent blocking the UI, Intlayer integrates with React's Suspense API. It fetches the parser in the background and throws a Promise during the download.
|
|
1004
|
+
|
|
1005
|
+
Wrap any component rendering Intlayer Markdown in a `<Suspense>` boundary. This displays a localized fallback state while the chunk downloads, allowing the rest of your DOM to render immediately.
|
|
1006
|
+
|
|
1007
|
+
Warning: If you do not provide a `<Suspense>` boundary, React will suspend at the root level or block the entire component tree from rendering until the 55kb chunk is fully loaded.
|
|
1008
|
+
|
|
1009
|
+
<Tabs>
|
|
1010
|
+
<Tab label="Next.js" value="nextjs">
|
|
1011
|
+
|
|
1012
|
+
In Next.js App Router, you can use either React `Suspense` for client components or a `loading.tsx` file for server components.
|
|
1013
|
+
|
|
1014
|
+
**Client Component:**
|
|
1015
|
+
|
|
1016
|
+
```tsx fileName="components/MyComponent.tsx"
|
|
1017
|
+
"use client";
|
|
1018
|
+
import { useIntlayer } from "next-intlayer";
|
|
1019
|
+
import { Suspense } from "react";
|
|
1020
|
+
|
|
1021
|
+
const MyComponent = () => {
|
|
1022
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1023
|
+
|
|
1024
|
+
return (
|
|
1025
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1026
|
+
);
|
|
1027
|
+
};
|
|
1028
|
+
```
|
|
1029
|
+
|
|
1030
|
+
**Server Component with `loading.tsx`:**
|
|
1031
|
+
|
|
1032
|
+
```tsx fileName="app/loading.tsx"
|
|
1033
|
+
export default function Loading() {
|
|
1034
|
+
return <div>Loading...</div>;
|
|
1035
|
+
}
|
|
1036
|
+
```
|
|
1037
|
+
|
|
1038
|
+
```tsx fileName="app/page.tsx"
|
|
1039
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
1040
|
+
|
|
1041
|
+
const MyPage = () => {
|
|
1042
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1043
|
+
return <div>{markdownContent}</div>;
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
export default MyPage;
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
</Tab>
|
|
1050
|
+
|
|
1051
|
+
<Tab label="React" value="react">
|
|
1052
|
+
|
|
1053
|
+
```tsx
|
|
1054
|
+
import { useIntlayer } from "react-intlayer";
|
|
1055
|
+
import { Suspense } from "react";
|
|
1056
|
+
|
|
1057
|
+
const MyComponent = () => {
|
|
1058
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1059
|
+
|
|
1060
|
+
return (
|
|
1061
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1062
|
+
);
|
|
1063
|
+
};
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
</Tab>
|
|
1067
|
+
|
|
1068
|
+
<Tab label="Vue" value="vue">
|
|
1069
|
+
|
|
1070
|
+
Vue has a built-in `<Suspense>` component. Wrap the component rendering Markdown content in a `<Suspense>` boundary.
|
|
1071
|
+
|
|
1072
|
+
```vue fileName="MyComponent.vue"
|
|
1073
|
+
<script setup>
|
|
1074
|
+
import { useIntlayer } from "vue-intlayer";
|
|
1075
|
+
|
|
1076
|
+
const { markdownContent } = useIntlayer("my-markdown");
|
|
1077
|
+
</script>
|
|
1078
|
+
|
|
1079
|
+
<template>
|
|
1080
|
+
<Suspense>
|
|
1081
|
+
<component :is="markdownContent" />
|
|
1082
|
+
<template #fallback>
|
|
1083
|
+
<div>Loading...</div>
|
|
1084
|
+
</template>
|
|
1085
|
+
</Suspense>
|
|
1086
|
+
</template>
|
|
1087
|
+
```
|
|
1088
|
+
|
|
1089
|
+
</Tab>
|
|
1090
|
+
<Tab label="Svelte" value="svelte">
|
|
1091
|
+
|
|
1092
|
+
Svelte does not have a Suspense API equivalent. Use an `{#await}` block to handle async rendering of Markdown content.
|
|
1093
|
+
|
|
1094
|
+
```svelte fileName="MyComponent.svelte"
|
|
1095
|
+
<script lang="ts">
|
|
1096
|
+
import { useIntlayer } from "svelte-intlayer";
|
|
1097
|
+
|
|
1098
|
+
const content = useIntlayer("my-markdown");
|
|
1099
|
+
</script>
|
|
1100
|
+
|
|
1101
|
+
{#await $content.markdownContent}
|
|
1102
|
+
<div>Loading...</div>
|
|
1103
|
+
{:then rendered}
|
|
1104
|
+
{@html rendered}
|
|
1105
|
+
{/await}
|
|
1106
|
+
```
|
|
1107
|
+
|
|
1108
|
+
</Tab>
|
|
1109
|
+
<Tab label="Preact" value="preact">
|
|
1110
|
+
|
|
1111
|
+
Preact supports React's Suspense API via `preact/compat`.
|
|
1112
|
+
|
|
1113
|
+
```tsx fileName="MyComponent.tsx"
|
|
1114
|
+
import { useIntlayer } from "preact-intlayer";
|
|
1115
|
+
import { Suspense } from "preact/compat";
|
|
1116
|
+
|
|
1117
|
+
const MyComponent = () => {
|
|
1118
|
+
const markdownContent = useIntlayer("my-markdown");
|
|
1119
|
+
|
|
1120
|
+
return (
|
|
1121
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1122
|
+
);
|
|
1123
|
+
};
|
|
1124
|
+
```
|
|
1125
|
+
|
|
1126
|
+
</Tab>
|
|
1127
|
+
<Tab label="Solid" value="solid">
|
|
1128
|
+
|
|
1129
|
+
Solid has its own `<Suspense>` component from `solid-js`.
|
|
1130
|
+
|
|
1131
|
+
```tsx fileName="MyComponent.tsx"
|
|
1132
|
+
import { useIntlayer } from "solid-intlayer";
|
|
1133
|
+
import { Suspense } from "solid-js";
|
|
1134
|
+
|
|
1135
|
+
const MyComponent = () => {
|
|
1136
|
+
const { markdownContent } = useIntlayer("my-markdown");
|
|
1137
|
+
|
|
1138
|
+
return (
|
|
1139
|
+
<Suspense fallback={<div>Loading...</div>}>{markdownContent}</Suspense>
|
|
1140
|
+
);
|
|
1141
|
+
};
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
</Tab>
|
|
1145
|
+
<Tab label="Angular" value="angular">
|
|
1146
|
+
|
|
1147
|
+
Angular does not have a Suspense API. Use Angular's deferrable views (`@defer`) to handle lazy-loaded Markdown content (requires Angular 17+).
|
|
1148
|
+
|
|
1149
|
+
```typescript fileName="my.component.ts"
|
|
1150
|
+
import { Component } from "@angular/core";
|
|
1151
|
+
import { useIntlayer } from "angular-intlayer";
|
|
1152
|
+
|
|
1153
|
+
@Component({
|
|
1154
|
+
selector: "app-my",
|
|
1155
|
+
template: `
|
|
1156
|
+
@defer {
|
|
1157
|
+
<div [innerHTML]="content().markdownContent"></div>
|
|
1158
|
+
} @loading {
|
|
1159
|
+
<div>Loading...</div>
|
|
1160
|
+
}
|
|
1161
|
+
`,
|
|
1162
|
+
})
|
|
1163
|
+
export class MyComponent {
|
|
1164
|
+
content = useIntlayer("my-markdown");
|
|
1165
|
+
}
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
</Tab>
|
|
1169
|
+
</Tabs>
|
|
859
1170
|
|
|
860
1171
|
## Options Reference
|
|
861
1172
|
|
|
@@ -224,7 +224,7 @@ This approach allows you to:
|
|
|
224
224
|
|
|
225
225
|
GitHub stars are a strong indicator of a project's popularity, community trust, and long-term relevance. While not a direct measure of technical quality, they reflect how many developers find the project useful, follow its progress, and are likely to adopt it. For estimating the value of a project, stars help compare traction across alternatives and provide insights into ecosystem growth.
|
|
226
226
|
|
|
227
|
-
[](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)
|
|
228
228
|
|
|
229
229
|
---
|
|
230
230
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-04-18
|
|
3
3
|
updatedAt: 2026-05-06
|
|
4
|
-
title: Angular i18n - How to translate an Angular app
|
|
4
|
+
title: Angular i18n - How to translate an Angular 19 app (Webpack)
|
|
5
5
|
description: Discover how to make your Angular website multilingual. Follow the documentation to internationalize (i18n) and translate it.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internationalization
|
|
@@ -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
|
|
@@ -30,7 +31,7 @@ history:
|
|
|
30
31
|
changes: "Initial history"
|
|
31
32
|
---
|
|
32
33
|
|
|
33
|
-
# Translate your Angular website using Intlayer | Internationalization (i18n)
|
|
34
|
+
# Translate your Angular 19 (Webpack) website using Intlayer | Internationalization (i18n)
|
|
34
35
|
|
|
35
36
|
## Table of Contents
|
|
36
37
|
|
|
@@ -55,7 +56,7 @@ With Intlayer, you can:
|
|
|
55
56
|
<Tab label="Code" value="code">
|
|
56
57
|
|
|
57
58
|
<iframe
|
|
58
|
-
src="https://ide.intlayer.org/aymericzip/intlayer-angular-template?file=intlayer.config.ts"
|
|
59
|
+
src="https://ide.intlayer.org/aymericzip/intlayer-angular-19-template?file=intlayer.config.ts"
|
|
59
60
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
60
61
|
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
61
62
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
@@ -66,7 +67,7 @@ With Intlayer, you can:
|
|
|
66
67
|
<Tab label="Demo" value="demo">
|
|
67
68
|
|
|
68
69
|
<iframe
|
|
69
|
-
src="https://intlayer-angular-template.vercel.app"
|
|
70
|
+
src="https://intlayer-angular-19-template.vercel.app"
|
|
70
71
|
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
71
72
|
title="Demo - intlayer-angular-template"
|
|
72
73
|
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
@@ -76,7 +77,7 @@ With Intlayer, you can:
|
|
|
76
77
|
</Tab>
|
|
77
78
|
</Tabs>
|
|
78
79
|
|
|
79
|
-
See [Application Template](https://github.com/aymericzip/intlayer-angular-template) on GitHub.
|
|
80
|
+
See [Application Template](https://github.com/aymericzip/intlayer-angular-19-template) on GitHub.
|
|
80
81
|
|
|
81
82
|
### Step 1: Install Dependencies
|
|
82
83
|
|