@intlayer/docs 6.1.6-canary.0 → 6.1.6
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/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +71 -80
- package/dist/cjs/generated/docs.entry.cjs +16 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +16 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/intlayer_with_angular.md +2 -2
- package/docs/ar/intlayer_with_astro.md +246 -0
- package/docs/ar/intlayer_with_create_react_app.md +3 -2
- package/docs/ar/intlayer_with_express.md +2 -2
- package/docs/ar/intlayer_with_nestjs.md +2 -2
- package/docs/ar/intlayer_with_nextjs_14.md +2 -2
- package/docs/ar/intlayer_with_nextjs_15.md +2 -2
- package/docs/ar/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ar/intlayer_with_nuxt.md +2 -2
- package/docs/ar/intlayer_with_react_native+expo.md +11 -20
- package/docs/ar/intlayer_with_react_router_v7.md +195 -241
- package/docs/ar/intlayer_with_tanstack.md +198 -272
- package/docs/ar/intlayer_with_vite+preact.md +9 -9
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/de/intlayer_with_angular.md +2 -2
- package/docs/de/intlayer_with_astro.md +246 -0
- package/docs/de/intlayer_with_create_react_app.md +2 -2
- package/docs/de/intlayer_with_express.md +2 -2
- package/docs/de/intlayer_with_nestjs.md +2 -2
- package/docs/de/intlayer_with_nextjs_14.md +2 -2
- package/docs/de/intlayer_with_nextjs_15.md +2 -2
- package/docs/de/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/de/intlayer_with_nuxt.md +2 -2
- package/docs/de/intlayer_with_react_native+expo.md +11 -20
- package/docs/de/intlayer_with_react_router_v7.md +193 -242
- package/docs/de/intlayer_with_tanstack.md +194 -266
- package/docs/de/intlayer_with_vite+preact.md +9 -9
- package/docs/de/intlayer_with_vite+react.md +9 -9
- package/docs/de/intlayer_with_vite+vue.md +11 -11
- package/docs/de/packages/vite-intlayer/index.md +3 -3
- package/docs/en/how_works_intlayer.md +1 -1
- package/docs/en/index.md +1 -1
- package/docs/en/intlayer_cli.md +1 -1
- package/docs/en/intlayer_with_angular.md +4 -4
- package/docs/en/intlayer_with_astro.md +246 -0
- package/docs/en/intlayer_with_create_react_app.md +4 -4
- package/docs/en/intlayer_with_express.md +3 -3
- package/docs/en/intlayer_with_lynx+react.md +1 -1
- package/docs/en/intlayer_with_nestjs.md +2 -2
- package/docs/en/intlayer_with_nextjs_14.md +13 -4
- package/docs/en/intlayer_with_nextjs_15.md +13 -4
- package/docs/en/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/en/intlayer_with_nuxt.md +4 -4
- package/docs/en/intlayer_with_react_native+expo.md +46 -24
- package/docs/en/intlayer_with_react_router_v7.md +164 -211
- package/docs/en/intlayer_with_tanstack.md +166 -241
- package/docs/en/intlayer_with_vite+preact.md +12 -12
- package/docs/en/intlayer_with_vite+react.md +12 -12
- package/docs/en/intlayer_with_vite+solid.md +2 -2
- package/docs/en/intlayer_with_vite+svelte.md +2 -2
- package/docs/en/intlayer_with_vite+vue.md +12 -12
- package/docs/en/introduction.md +1 -1
- package/docs/en/packages/next-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/react-intlayer/useI18n.md +1 -1
- package/docs/en/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en/releases/v6.md +1 -0
- package/docs/en/roadmap.md +1 -1
- package/docs/en-GB/intlayer_with_angular.md +3 -3
- package/docs/en-GB/intlayer_with_astro.md +246 -0
- package/docs/en-GB/intlayer_with_create_react_app.md +5 -4
- package/docs/en-GB/intlayer_with_express.md +2 -2
- package/docs/en-GB/intlayer_with_nestjs.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_14.md +4 -4
- package/docs/en-GB/intlayer_with_nextjs_15.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/en-GB/intlayer_with_nuxt.md +2 -2
- package/docs/en-GB/intlayer_with_react_native+expo.md +11 -20
- package/docs/en-GB/intlayer_with_react_router_v7.md +171 -220
- package/docs/en-GB/intlayer_with_tanstack.md +174 -248
- package/docs/en-GB/intlayer_with_vite+preact.md +9 -9
- package/docs/en-GB/intlayer_with_vite+react.md +9 -9
- package/docs/en-GB/intlayer_with_vite+vue.md +11 -11
- package/docs/en-GB/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/es/intlayer_with_angular.md +2 -2
- package/docs/es/intlayer_with_astro.md +246 -0
- package/docs/es/intlayer_with_create_react_app.md +3 -2
- package/docs/es/intlayer_with_express.md +2 -2
- package/docs/es/intlayer_with_nextjs_14.md +2 -2
- package/docs/es/intlayer_with_nextjs_15.md +2 -2
- package/docs/es/intlayer_with_react_native+expo.md +11 -20
- package/docs/es/intlayer_with_react_router_v7.md +188 -232
- package/docs/es/intlayer_with_tanstack.md +203 -273
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/intlayer_with_angular.md +2 -2
- package/docs/fr/intlayer_with_astro.md +246 -0
- package/docs/fr/intlayer_with_create_react_app.md +3 -2
- package/docs/fr/intlayer_with_express.md +2 -2
- package/docs/fr/intlayer_with_nestjs.md +2 -2
- package/docs/fr/intlayer_with_nextjs_14.md +2 -2
- package/docs/fr/intlayer_with_react_native+expo.md +11 -20
- package/docs/fr/intlayer_with_react_router_v7.md +188 -248
- package/docs/fr/intlayer_with_tanstack.md +192 -265
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/hi/intlayer_cli.md +1 -4
- package/docs/hi/intlayer_with_angular.md +2 -2
- package/docs/hi/intlayer_with_astro.md +246 -0
- package/docs/hi/intlayer_with_create_react_app.md +2 -2
- package/docs/hi/intlayer_with_express.md +2 -2
- package/docs/hi/intlayer_with_nestjs.md +2 -2
- package/docs/hi/intlayer_with_nextjs_14.md +2 -2
- package/docs/hi/intlayer_with_nextjs_15.md +2 -2
- package/docs/hi/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/hi/intlayer_with_nuxt.md +2 -2
- package/docs/hi/intlayer_with_react_native+expo.md +11 -20
- package/docs/hi/intlayer_with_react_router_v7.md +199 -243
- package/docs/hi/intlayer_with_tanstack.md +210 -285
- package/docs/hi/intlayer_with_vite+preact.md +9 -9
- package/docs/hi/intlayer_with_vite+react.md +9 -9
- package/docs/hi/intlayer_with_vite+solid.md +1 -1
- package/docs/hi/intlayer_with_vite+vue.md +11 -11
- package/docs/it/intlayer_with_angular.md +2 -2
- package/docs/it/intlayer_with_astro.md +246 -0
- package/docs/it/intlayer_with_create_react_app.md +3 -2
- package/docs/it/intlayer_with_express.md +2 -2
- package/docs/it/intlayer_with_nestjs.md +2 -2
- package/docs/it/intlayer_with_nextjs_14.md +2 -2
- package/docs/it/intlayer_with_nextjs_15.md +2 -2
- package/docs/it/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/it/intlayer_with_nuxt.md +2 -2
- package/docs/it/intlayer_with_react_native+expo.md +11 -21
- package/docs/it/intlayer_with_react_router_v7.md +195 -242
- package/docs/it/intlayer_with_tanstack.md +203 -267
- package/docs/it/intlayer_with_vite+preact.md +9 -9
- package/docs/it/intlayer_with_vite+react.md +13 -11
- package/docs/it/intlayer_with_vite+vue.md +11 -11
- package/docs/ja/intlayer_with_angular.md +2 -2
- package/docs/ja/intlayer_with_astro.md +246 -0
- package/docs/ja/intlayer_with_create_react_app.md +3 -2
- package/docs/ja/intlayer_with_express.md +2 -2
- package/docs/ja/intlayer_with_nestjs.md +2 -2
- package/docs/ja/intlayer_with_nextjs_14.md +2 -2
- package/docs/ja/intlayer_with_nextjs_15.md +2 -2
- package/docs/ja/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ja/intlayer_with_nuxt.md +2 -2
- package/docs/ja/intlayer_with_react_native+expo.md +18 -29
- package/docs/ja/intlayer_with_react_router_v7.md +204 -250
- package/docs/ja/intlayer_with_tanstack.md +218 -286
- package/docs/ja/intlayer_with_vite+preact.md +9 -9
- package/docs/ja/intlayer_with_vite+react.md +11 -11
- package/docs/ja/intlayer_with_vite+vue.md +11 -11
- package/docs/ko/intlayer_with_angular.md +2 -2
- package/docs/ko/intlayer_with_astro.md +246 -0
- package/docs/ko/intlayer_with_create_react_app.md +3 -2
- package/docs/ko/intlayer_with_express.md +2 -2
- package/docs/ko/intlayer_with_nestjs.md +2 -2
- package/docs/ko/intlayer_with_nextjs_14.md +2 -2
- package/docs/ko/intlayer_with_nextjs_15.md +2 -2
- package/docs/ko/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ko/intlayer_with_nuxt.md +2 -2
- package/docs/ko/intlayer_with_react_native+expo.md +19 -28
- package/docs/ko/intlayer_with_react_router_v7.md +190 -244
- package/docs/ko/intlayer_with_tanstack.md +200 -270
- package/docs/ko/intlayer_with_vite+preact.md +9 -9
- package/docs/ko/intlayer_with_vite+react.md +9 -9
- package/docs/ko/intlayer_with_vite+vue.md +11 -11
- package/docs/pt/intlayer_with_angular.md +2 -2
- package/docs/pt/intlayer_with_astro.md +246 -0
- package/docs/pt/intlayer_with_create_react_app.md +3 -2
- package/docs/pt/intlayer_with_express.md +2 -2
- package/docs/pt/intlayer_with_nestjs.md +2 -2
- package/docs/pt/intlayer_with_nextjs_14.md +2 -2
- package/docs/pt/intlayer_with_nextjs_15.md +2 -2
- package/docs/pt/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/pt/intlayer_with_nuxt.md +2 -2
- package/docs/pt/intlayer_with_react_native+expo.md +11 -20
- package/docs/pt/intlayer_with_react_router_v7.md +7 -13
- package/docs/pt/intlayer_with_tanstack.md +183 -258
- package/docs/pt/intlayer_with_vite+preact.md +9 -9
- package/docs/pt/intlayer_with_vite+react.md +9 -9
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/ru/intlayer_with_angular.md +2 -2
- package/docs/ru/intlayer_with_astro.md +246 -0
- package/docs/ru/intlayer_with_create_react_app.md +3 -2
- package/docs/ru/intlayer_with_express.md +2 -2
- package/docs/ru/intlayer_with_nestjs.md +2 -2
- package/docs/ru/intlayer_with_nextjs_14.md +2 -2
- package/docs/ru/intlayer_with_nextjs_15.md +2 -2
- package/docs/ru/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ru/intlayer_with_nuxt.md +2 -2
- package/docs/ru/intlayer_with_react_native+expo.md +11 -20
- package/docs/ru/intlayer_with_react_router_v7.md +192 -238
- package/docs/ru/intlayer_with_tanstack.md +197 -269
- package/docs/ru/intlayer_with_vite+preact.md +9 -9
- package/docs/ru/intlayer_with_vite+react.md +9 -9
- package/docs/ru/intlayer_with_vite+vue.md +11 -11
- package/docs/tr/how_works_intlayer.md +1 -1
- package/docs/tr/index.md +1 -1
- package/docs/tr/intlayer_cli.md +1 -1
- package/docs/tr/intlayer_with_angular.md +4 -4
- package/docs/tr/intlayer_with_astro.md +246 -0
- package/docs/tr/intlayer_with_create_react_app.md +4 -4
- package/docs/tr/intlayer_with_express.md +3 -3
- package/docs/tr/intlayer_with_lynx+react.md +1 -1
- package/docs/tr/intlayer_with_nestjs.md +2 -2
- package/docs/tr/intlayer_with_nextjs_14.md +2 -2
- package/docs/tr/intlayer_with_nextjs_15.md +4 -4
- package/docs/tr/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/tr/intlayer_with_nuxt.md +4 -4
- package/docs/tr/intlayer_with_react_native+expo.md +12 -21
- package/docs/tr/intlayer_with_react_router_v7.md +222 -267
- package/docs/tr/intlayer_with_tanstack.md +400 -303
- package/docs/tr/intlayer_with_vite+preact.md +12 -12
- package/docs/tr/intlayer_with_vite+react.md +12 -12
- package/docs/tr/intlayer_with_vite+solid.md +2 -2
- package/docs/tr/intlayer_with_vite+svelte.md +2 -2
- package/docs/tr/intlayer_with_vite+vue.md +12 -12
- package/docs/tr/introduction.md +1 -1
- package/docs/tr/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/tr/packages/react-intlayer/useI18n.md +1 -1
- package/docs/tr/roadmap.md +1 -1
- package/docs/zh/intlayer_with_angular.md +2 -2
- package/docs/zh/intlayer_with_astro.md +246 -0
- package/docs/zh/intlayer_with_create_react_app.md +3 -2
- package/docs/zh/intlayer_with_express.md +2 -2
- package/docs/zh/intlayer_with_nestjs.md +2 -2
- package/docs/zh/intlayer_with_nextjs_14.md +2 -2
- package/docs/zh/intlayer_with_nextjs_15.md +2 -2
- package/docs/zh/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/zh/intlayer_with_nuxt.md +2 -2
- package/docs/zh/intlayer_with_react_native+expo.md +19 -28
- package/docs/zh/intlayer_with_react_router_v7.md +200 -248
- package/docs/zh/intlayer_with_tanstack.md +208 -283
- package/docs/zh/intlayer_with_vite+preact.md +9 -9
- package/docs/zh/intlayer_with_vite+react.md +9 -9
- package/docs/zh/intlayer_with_vite+vue.md +9 -9
- package/package.json +11 -11
- package/src/generated/docs.entry.ts +16 -0
|
@@ -60,7 +60,7 @@ yarn add intlayer next-intlayer
|
|
|
60
60
|
|
|
61
61
|
- **intlayer**
|
|
62
62
|
|
|
63
|
-
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
63
|
+
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md).
|
|
64
64
|
|
|
65
65
|
- **next-intlayer**
|
|
66
66
|
|
|
@@ -384,7 +384,7 @@ module.exports = pageContent;
|
|
|
384
384
|
|
|
385
385
|
> Your content declarations can be defined anywhere in your application as soon they are included into the `contentDir` directory (by default, `./src`). And match the content declaration file extension (by default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
386
386
|
|
|
387
|
-
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
387
|
+
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
388
388
|
|
|
389
389
|
### Step 6: Utilize Content in Your Code
|
|
390
390
|
|
|
@@ -1461,6 +1461,15 @@ export const myServerAction = async () => {
|
|
|
1461
1461
|
};
|
|
1462
1462
|
```
|
|
1463
1463
|
|
|
1464
|
+
> The `getLocale` function follows a cascading strategy to determine the user's locale:
|
|
1465
|
+
>
|
|
1466
|
+
> 1. First, it checks the request headers for a locale value that may have been set by the middleware
|
|
1467
|
+
> 2. If no locale is found in headers, it looks for a locale stored in cookies
|
|
1468
|
+
> 3. If no cookie is found, it attempts to detect the user's preferred language from their browser settings
|
|
1469
|
+
> 4. As a last resort, it falls back to the application's configured default locale
|
|
1470
|
+
>
|
|
1471
|
+
> This ensures the most appropriate locale is selected based on available context.
|
|
1472
|
+
|
|
1464
1473
|
### (Optional) Step 13: Optmize your bundle size
|
|
1465
1474
|
|
|
1466
1475
|
When using `next-intlayer`, dictionaries are included in the bundle for every page by default. To optimize bundle size, Intlayer provides an optional SWC plugin that intelligently replace `useIntlayer` calls using macros. This ensures dictionaries are only included in bundles for pages that actually use them.
|
|
@@ -1503,9 +1512,9 @@ This limitation occurs because Turbopack cannot run webpack plugins in parallel
|
|
|
1503
1512
|
|
|
1504
1513
|
Intlayer use module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
1505
1514
|
|
|
1506
|
-

|
|
1507
1516
|
|
|
1508
|
-

|
|
1509
1518
|
|
|
1510
1519
|
Ensure your TypeScript configuration includes the autogenerated types.
|
|
1511
1520
|
|
|
@@ -55,7 +55,7 @@ yarn add intlayer next-intlayer
|
|
|
55
55
|
|
|
56
56
|
- **intlayer**
|
|
57
57
|
|
|
58
|
-
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
58
|
+
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md).
|
|
59
59
|
|
|
60
60
|
- **next-intlayer**
|
|
61
61
|
|
|
@@ -426,7 +426,7 @@ module.exports = homeContent;
|
|
|
426
426
|
}
|
|
427
427
|
```
|
|
428
428
|
|
|
429
|
-
For more information on declaring content, refer to the [content declaration guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
429
|
+
For more information on declaring content, refer to the [content declaration guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
430
430
|
|
|
431
431
|
### Step 7: Utilize Content in Your Code
|
|
432
432
|
|
|
@@ -1427,9 +1427,9 @@ yarn add @intlayer/swc --save-dev
|
|
|
1427
1427
|
|
|
1428
1428
|
Intlayer use module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
1429
1429
|
|
|
1430
|
-

|
|
1431
1431
|
|
|
1432
|
-

|
|
1433
1433
|
|
|
1434
1434
|
Ensure your TypeScript configuration includes the autogenerated types.
|
|
1435
1435
|
|
|
@@ -1472,7 +1472,7 @@ For more details on how to use the extension, refer to the [Intlayer VS Code Ext
|
|
|
1472
1472
|
## Additional Resources
|
|
1473
1473
|
|
|
1474
1474
|
- **Intlayer Documentation:** [GitHub Repository](https://github.com/aymericzip/intlayer)
|
|
1475
|
-
- **Dictionary Guide:** [Dictionary](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
1475
|
+
- **Dictionary Guide:** [Dictionary](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
|
|
1476
1476
|
- **Configuration Documentation:** [Configuration Guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md)
|
|
1477
1477
|
|
|
1478
1478
|
By following this guide, you can effectively integrate Intlayer into your Next.js application using the Page Router, enabling robust and scalable internationalization support for your web projects.
|
|
@@ -57,7 +57,7 @@ yarn add --save-dev nuxt-intlayer
|
|
|
57
57
|
|
|
58
58
|
- **intlayer**
|
|
59
59
|
|
|
60
|
-
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
60
|
+
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md).
|
|
61
61
|
|
|
62
62
|
- **vue-intlayer**
|
|
63
63
|
The package that integrates Intlayer with Vue application. It the composables for the Vue components.
|
|
@@ -341,7 +341,7 @@ module.exports = helloWorldContent;
|
|
|
341
341
|
|
|
342
342
|
> Your content declarations can be defined anywhere in your application as long as they are included in the `contentDir` directory (by default, `./src`). And match the content declaration file extension (by default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
343
343
|
|
|
344
|
-
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
344
|
+
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
345
345
|
|
|
346
346
|
### Step 5: Utilize Intlayer in Your Code
|
|
347
347
|
|
|
@@ -716,9 +716,9 @@ module.exports = aboutMetaContent;
|
|
|
716
716
|
|
|
717
717
|
Intlayer uses module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
718
718
|
|
|
719
|
-

|
|
720
720
|
|
|
721
|
-

|
|
722
722
|
|
|
723
723
|
Ensure your TypeScript configuration includes the autogenerated types.
|
|
724
724
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-06-18
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-10-02
|
|
4
4
|
title: Translate your React Native and Expo website (i18n)
|
|
5
5
|
description: Discover how to make your React Native and Expo website multilingual. Follow the documentation to internationalize (i18n) and translate it.
|
|
6
6
|
keywords:
|
|
@@ -148,28 +148,27 @@ module.exports = (async () => {
|
|
|
148
148
|
|
|
149
149
|
## Step 4: Add the Intlayer provider
|
|
150
150
|
|
|
151
|
-
To keep synchronized the user language across your application, you need to wrap your root component with the `IntlayerProvider` component from `react-intlayer`.
|
|
151
|
+
To keep synchronized the user language across your application, you need to wrap your root component with the `IntlayerProvider` component from `react-intlayer-native`.
|
|
152
|
+
|
|
153
|
+
> Make sure to use the provider from `react-native-intlayer` instead of `react-intlayer`. The export from `react-native-intlayer` includes polyfills for the web API.
|
|
152
154
|
|
|
153
155
|
Also, you need to add the `intlayerPolyfill` function to your `index.js` file to ensure that Intlayer can work properly.
|
|
154
156
|
|
|
155
157
|
```tsx fileName="app/_layout.tsx" codeFormat="typescript"
|
|
156
158
|
import { Stack } from "expo-router";
|
|
157
159
|
import { getLocales } from "expo-localization";
|
|
158
|
-
import {
|
|
159
|
-
import { intlayerPolyfill } from "react-native-intlayer";
|
|
160
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
160
161
|
import { type FC } from "react";
|
|
161
162
|
|
|
162
|
-
intlayerPolyfill();
|
|
163
|
-
|
|
164
163
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
165
164
|
|
|
166
165
|
const RootLayout: FC = () => {
|
|
167
166
|
return (
|
|
168
|
-
<
|
|
167
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
169
168
|
<Stack>
|
|
170
169
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
171
170
|
</Stack>
|
|
172
|
-
</
|
|
171
|
+
</IntlayerProvider>
|
|
173
172
|
);
|
|
174
173
|
};
|
|
175
174
|
|
|
@@ -179,20 +178,17 @@ export default RootLayout;
|
|
|
179
178
|
```jsx fileName="app/_layout.mjx" codeFormat="esm"
|
|
180
179
|
import { Stack } from "expo-router";
|
|
181
180
|
import { getLocales } from "expo-localization";
|
|
182
|
-
import {
|
|
183
|
-
import { intlayerPolyfill } from "react-native-intlayer";
|
|
184
|
-
|
|
185
|
-
intlayerPolyfill();
|
|
181
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
186
182
|
|
|
187
183
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
188
184
|
|
|
189
185
|
const RootLayout = () => {
|
|
190
186
|
return (
|
|
191
|
-
<
|
|
187
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
192
188
|
<Stack>
|
|
193
189
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
194
190
|
</Stack>
|
|
195
|
-
</
|
|
191
|
+
</IntlayerProvider>
|
|
196
192
|
);
|
|
197
193
|
};
|
|
198
194
|
|
|
@@ -202,20 +198,17 @@ export default RootLayout;
|
|
|
202
198
|
```jsx fileName="app/_layout.cjx" codeFormat="commonjs"
|
|
203
199
|
const { Stack } = require("expo-router");
|
|
204
200
|
const { getLocales } = require("expo-localization");
|
|
205
|
-
const {
|
|
206
|
-
const { intlayerPolyfill } = require("react-native-intlayer");
|
|
207
|
-
|
|
208
|
-
intlayerPolyfill();
|
|
201
|
+
const { IntlayerProvider } = require("react-native-intlayer");
|
|
209
202
|
|
|
210
203
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
211
204
|
|
|
212
205
|
const RootLayout = () => {
|
|
213
206
|
return (
|
|
214
|
-
<
|
|
207
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
215
208
|
<Stack>
|
|
216
209
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
217
210
|
</Stack>
|
|
218
|
-
</
|
|
211
|
+
</IntlayerProvider>
|
|
219
212
|
);
|
|
220
213
|
};
|
|
221
214
|
|
|
@@ -316,7 +309,7 @@ module.exports = appContent;
|
|
|
316
309
|
}
|
|
317
310
|
```
|
|
318
311
|
|
|
319
|
-
> For details on content declarations, see [Intlayer’s content docs](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
312
|
+
> For details on content declarations, see [Intlayer’s content docs](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
320
313
|
|
|
321
314
|
---
|
|
322
315
|
|
|
@@ -653,8 +646,37 @@ Enjoy building your **React Native** apps with fully powered i18n through **Intl
|
|
|
653
646
|
|
|
654
647
|
---
|
|
655
648
|
|
|
649
|
+
### Debug
|
|
650
|
+
|
|
651
|
+
React Native can be less stable than React Web, so pay extra attention to version alignment.
|
|
652
|
+
|
|
653
|
+
Intlayer primarily targets the Web Intl API; on React Native you must include the appropriate polyfills.
|
|
654
|
+
|
|
655
|
+
Checklist:
|
|
656
|
+
|
|
657
|
+
- Use the latest versions of `intlayer`, `react-intlayer`, and `react-native-intlayer`.
|
|
658
|
+
- Enable the Intlayer polyfill.
|
|
659
|
+
- If you use `getLocaleName` or other Intl-API-based utilities, import these polyfills early (for example in `index.js` or `App.tsx`):
|
|
660
|
+
|
|
661
|
+
```ts
|
|
662
|
+
import "intl";
|
|
663
|
+
import "@formatjs/intl-getcanonicallocales/polyfill";
|
|
664
|
+
import "@formatjs/intl-locale/polyfill";
|
|
665
|
+
import "@formatjs/intl-pluralrules/polyfill";
|
|
666
|
+
import "@formatjs/intl-displaynames/polyfill";
|
|
667
|
+
import "@formatjs/intl-listformat/polyfill";
|
|
668
|
+
import "@formatjs/intl-numberformat/polyfill";
|
|
669
|
+
import "@formatjs/intl-relativetimeformat/polyfill";
|
|
670
|
+
import "@formatjs/intl-datetimeformat/polyfill";
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
- Verify your Metro configuration (resolver aliases, asset plugins, `tsconfig` paths) if modules fail to resolve.
|
|
674
|
+
|
|
675
|
+
---
|
|
676
|
+
|
|
656
677
|
## Doc History
|
|
657
678
|
|
|
658
|
-
| Version | Date | Changes
|
|
659
|
-
| ------- | ---------- |
|
|
660
|
-
|
|
|
679
|
+
| Version | Date | Changes |
|
|
680
|
+
| ------- | ---------- | ----------------- |
|
|
681
|
+
| 6.1.6 | 2025-10-02 | Add debug section |
|
|
682
|
+
| 5.5.10 | 2025-06-29 | Init history |
|