@intlayer/docs 6.1.5 → 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/ar/next-i18next_vs_next-intl_vs_intlayer.md +404 -173
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +262 -113
- package/blog/en/intlayer_with_next-i18next.mdx +431 -0
- package/blog/en/intlayer_with_next-intl.mdx +335 -0
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +463 -209
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +185 -71
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +36 -28
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/dist/cjs/generated/docs.entry.cjs +32 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +32 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +186 -0
- 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/ar/vs_code_extension.md +48 -109
- package/docs/de/component_i18n.md +186 -0
- 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/de/vs_code_extension.md +46 -107
- package/docs/en/component_i18n.md +186 -0
- 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 +31 -5
- package/docs/en/intlayer_with_nextjs_15.md +31 -5
- 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/vs_code_extension.md +24 -114
- package/docs/en-GB/component_i18n.md +186 -0
- 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/en-GB/vs_code_extension.md +42 -103
- package/docs/es/component_i18n.md +182 -0
- 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/es/vs_code_extension.md +53 -114
- package/docs/fr/component_i18n.md +186 -0
- 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/fr/vs_code_extension.md +50 -111
- package/docs/hi/component_i18n.md +186 -0
- 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/hi/vs_code_extension.md +49 -110
- package/docs/it/component_i18n.md +186 -0
- 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/it/vs_code_extension.md +50 -111
- package/docs/ja/component_i18n.md +186 -0
- 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/ja/vs_code_extension.md +50 -111
- package/docs/ko/component_i18n.md +186 -0
- 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/ko/vs_code_extension.md +48 -109
- package/docs/pt/component_i18n.md +186 -0
- 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/pt/vs_code_extension.md +46 -107
- package/docs/ru/component_i18n.md +186 -0
- 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/ru/vs_code_extension.md +48 -109
- package/docs/tr/component_i18n.md +186 -0
- 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/tr/vs_code_extension.md +54 -115
- package/docs/zh/component_i18n.md +186 -0
- 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/docs/zh/vs_code_extension.md +51 -105
- package/package.json +10 -10
- package/src/generated/docs.entry.ts +32 -0
|
@@ -1055,38 +1055,38 @@ const App = () => (
|
|
|
1055
1055
|
module.exports = App;
|
|
1056
1056
|
```
|
|
1057
1057
|
|
|
1058
|
-
En paralelo, también puedes usar el `
|
|
1058
|
+
En paralelo, también puedes usar el `intlayerMiddleware` para agregar enrutamiento del lado del servidor a tu aplicación. Este plugin detectará automáticamente la configuración regional actual basada en la URL y establecerá la cookie de configuración regional apropiada. Si no se especifica ninguna configuración regional, el plugin determinará la configuración regional más adecuada según las preferencias de idioma del navegador del usuario. Si no se detecta ninguna configuración regional, redirigirá a la configuración regional predeterminada.
|
|
1059
1059
|
|
|
1060
1060
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1061
1061
|
import { defineConfig } from "vite";
|
|
1062
1062
|
import preact from "@preact/preset-vite";
|
|
1063
|
-
import { intlayer,
|
|
1063
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1064
1064
|
|
|
1065
1065
|
// https://vitejs.dev/config/
|
|
1066
1066
|
export default defineConfig({
|
|
1067
|
-
plugins: [preact(), intlayer(),
|
|
1067
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1068
1068
|
});
|
|
1069
1069
|
```
|
|
1070
1070
|
|
|
1071
1071
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
1072
1072
|
import { defineConfig } from "vite";
|
|
1073
1073
|
import preact from "@preact/preset-vite";
|
|
1074
|
-
import { intlayer,
|
|
1074
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1075
1075
|
|
|
1076
1076
|
// https://vitejs.dev/config/
|
|
1077
1077
|
export default defineConfig({
|
|
1078
|
-
plugins: [preact(), intlayer(),
|
|
1078
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1079
1079
|
});
|
|
1080
1080
|
```
|
|
1081
1081
|
|
|
1082
1082
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
1083
1083
|
const { defineConfig } = require("vite");
|
|
1084
1084
|
const preact = require("@preact/preset-vite");
|
|
1085
|
-
const { intlayer,
|
|
1085
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
1086
1086
|
|
|
1087
1087
|
// https://vitejs.dev/config/
|
|
1088
1088
|
module.exports = defineConfig({
|
|
1089
|
-
plugins: [preact(), intlayer(),
|
|
1089
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1090
1090
|
});
|
|
1091
1091
|
```
|
|
1092
1092
|
|
|
@@ -1003,38 +1003,38 @@ const App = () => (
|
|
|
1003
1003
|
);
|
|
1004
1004
|
```
|
|
1005
1005
|
|
|
1006
|
-
Paralelamente, también puedes usar el `
|
|
1006
|
+
Paralelamente, también puedes usar el `intlayerMiddleware` para agregar enrutamiento del lado del servidor a tu aplicación. Este plugin detectará automáticamente la configuración regional actual basada en la URL y establecerá la cookie de configuración regional correspondiente. Si no se especifica ninguna configuración regional, el plugin determinará la configuración regional más adecuada basándose en las preferencias de idioma del navegador del usuario. Si no se detecta ninguna configuración regional, redirigirá a la configuración regional predeterminada.
|
|
1007
1007
|
|
|
1008
1008
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1009
1009
|
import { defineConfig } from "vite";
|
|
1010
1010
|
import react from "@vitejs/plugin-react-swc";
|
|
1011
|
-
import { intlayer,
|
|
1011
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1012
1012
|
|
|
1013
1013
|
// https://vitejs.dev/config/
|
|
1014
1014
|
export default defineConfig({
|
|
1015
|
-
plugins: [react(), intlayer(),
|
|
1015
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1016
1016
|
});
|
|
1017
1017
|
```
|
|
1018
1018
|
|
|
1019
1019
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
1020
1020
|
import { defineConfig } from "vite";
|
|
1021
1021
|
import react from "@vitejs/plugin-react-swc";
|
|
1022
|
-
import { intlayer,
|
|
1022
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1023
1023
|
|
|
1024
1024
|
// https://vitejs.dev/config/
|
|
1025
1025
|
export default defineConfig({
|
|
1026
|
-
plugins: [react(), intlayer(),
|
|
1026
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1027
1027
|
});
|
|
1028
1028
|
```
|
|
1029
1029
|
|
|
1030
1030
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
1031
1031
|
const { defineConfig } = require("vite");
|
|
1032
1032
|
const react = require("@vitejs/plugin-react-swc");
|
|
1033
|
-
const { intlayer,
|
|
1033
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
1034
1034
|
|
|
1035
1035
|
// https://vitejs.dev/config/
|
|
1036
1036
|
module.exports = defineConfig({
|
|
1037
|
-
plugins: [react(), intlayer(),
|
|
1037
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1038
1038
|
});
|
|
1039
1039
|
```
|
|
1040
1040
|
|
|
@@ -697,46 +697,46 @@ import LocaleSwitcher from "@components/LocaleSwitcher.vue";
|
|
|
697
697
|
</template>
|
|
698
698
|
```
|
|
699
699
|
|
|
700
|
-
Paralelamente, también puede usar el `
|
|
700
|
+
Paralelamente, también puede usar el `intlayerMiddleware` para agregar enrutamiento del lado del servidor a su aplicación. Este plugin detectará automáticamente la configuración regional actual basada en la URL y establecerá la cookie de configuración regional correspondiente. Si no se especifica ninguna configuración regional, el plugin determinará la configuración regional más adecuada según las preferencias de idioma del navegador del usuario. Si no se detecta ninguna configuración regional, redirigirá a la configuración regional predeterminada.
|
|
701
701
|
|
|
702
702
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
703
703
|
import { defineConfig } from "vite";
|
|
704
704
|
import vue from "@vitejs/plugin-vue";
|
|
705
|
-
import { intlayer,
|
|
705
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
706
706
|
|
|
707
707
|
// https://vitejs.dev/config/
|
|
708
708
|
export default defineConfig({
|
|
709
|
-
plugins: [vue(), intlayer(),
|
|
709
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
710
710
|
});
|
|
711
711
|
```
|
|
712
712
|
|
|
713
713
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
714
714
|
import { defineConfig } from "vite";
|
|
715
715
|
import vue from "@vitejs/plugin-vue";
|
|
716
|
-
import { intlayer,
|
|
716
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
717
717
|
|
|
718
718
|
// https://vitejs.dev/config/
|
|
719
719
|
export default defineConfig({
|
|
720
|
-
plugins: [vue(), intlayer(),
|
|
720
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
721
721
|
});
|
|
722
722
|
```
|
|
723
723
|
|
|
724
724
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
725
725
|
const { defineConfig } = require("vite");
|
|
726
726
|
const vue = require("@vitejs/plugin-vue");
|
|
727
|
-
const { intlayer,
|
|
727
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
728
728
|
|
|
729
729
|
// https://vitejs.dev/config/
|
|
730
730
|
module.exports = defineConfig({
|
|
731
|
-
plugins: [vue(), intlayer(),
|
|
731
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
732
732
|
});
|
|
733
733
|
const { defineConfig } = require("vite");
|
|
734
734
|
const vue = require("@vitejs/plugin-vue");
|
|
735
|
-
const { intlayer,
|
|
735
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
736
736
|
|
|
737
737
|
// https://vitejs.dev/config/
|
|
738
738
|
module.exports = defineConfig({
|
|
739
|
-
plugins: [vue(), intlayer(),
|
|
739
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
740
740
|
});
|
|
741
741
|
```
|
|
742
742
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-17
|
|
3
|
-
updatedAt: 2025-09-
|
|
4
|
-
title: Extensión Oficial
|
|
3
|
+
updatedAt: 2025-09-30
|
|
4
|
+
title: Extensión Oficial para VS Code
|
|
5
5
|
description: Aprende a usar la extensión Intlayer en VS Code para mejorar tu flujo de trabajo de desarrollo. Navega rápidamente entre contenido localizado y gestiona tus diccionarios de manera eficiente.
|
|
6
6
|
keywords:
|
|
7
|
-
- Extensión
|
|
7
|
+
- Extensión VS Code
|
|
8
8
|
- Intlayer
|
|
9
9
|
- Localización
|
|
10
10
|
- Herramientas de Desarrollo
|
|
@@ -17,102 +17,46 @@ slugs:
|
|
|
17
17
|
- vs-code-extension
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
# Extensión Oficial
|
|
20
|
+
# Extensión Oficial para VS Code
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Descripción general
|
|
23
23
|
|
|
24
24
|
[**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) es la extensión oficial de Visual Studio Code para **Intlayer**, diseñada para mejorar la experiencia del desarrollador al trabajar con contenido localizado en tus proyectos.
|
|
25
25
|
|
|
26
|
-

|
|
26
|
+

|
|
27
27
|
|
|
28
28
|
Enlace de la extensión: [https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension)
|
|
29
29
|
|
|
30
30
|
## Funcionalidades
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+

|
|
33
33
|
|
|
34
|
-
**
|
|
35
|
-
**
|
|
36
|
-
**Soporte Multilingüe** – Soporta contenido localizado en diferentes idiomas.
|
|
37
|
-
**Integración con VS Code** – Se integra de manera fluida con la navegación y la paleta de comandos de VS Code.
|
|
34
|
+
- **Navegación Instantánea** – Salta rápidamente al archivo de contenido correcto al hacer clic en una clave `useIntlayer`.
|
|
35
|
+
- **Rellenar Diccionarios** – Rellena los diccionarios con contenido de tu proyecto.
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+

|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
- **Acceso fácil a los comandos de Intlayer** – Construye, envía, descarga, rellena y prueba diccionarios de contenido con facilidad.
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
- **Subir Diccionarios** – Sube el contenido más reciente del diccionario a tu repositorio.
|
|
45
|
-
- **Descargar Diccionarios** – Sincroniza el contenido más reciente del diccionario desde tu repositorio a tu entorno local.
|
|
46
|
-
- **Rellenar Diccionarios** – Llena los diccionarios con contenido de tu proyecto.
|
|
47
|
-
- **Probar Diccionarios** – Identifica traducciones faltantes o incompletas.
|
|
41
|
+

|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
- **Generador de declaración de contenido** – Crea archivos de contenido de diccionario en varios formatos (`.ts`, `.esm`, `.cjs`, `.json`).
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+

|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
- **Probar diccionarios** – Prueba diccionarios para detectar traducciones faltantes.
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+

|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
const MyComponent = () => {
|
|
59
|
-
const { myTranslatedContent } = useIntlayer("my-component");
|
|
51
|
+
- **Mantén tus diccionarios actualizados** – Mantén tus diccionarios actualizados con el contenido más reciente de tu proyecto.
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Archivo generado en formato TypeScript:
|
|
66
|
-
|
|
67
|
-
```tsx fileName="src/components/MyComponent/index.content.ts"
|
|
68
|
-
import { t, type Dictionary } from "intlayer";
|
|
69
|
-
|
|
70
|
-
const componentContent = {
|
|
71
|
-
key: "my-component",
|
|
72
|
-
content: {
|
|
73
|
-
myTranslatedContent: t({
|
|
74
|
-
en: "Hello World",
|
|
75
|
-
es: "Hola Mundo",
|
|
76
|
-
fr: "Bonjour le monde",
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default componentContent;
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Formatos disponibles:
|
|
85
|
-
|
|
86
|
-
- **TypeScript (`.ts`)**
|
|
87
|
-
- **Módulo ES (`.esm`)**
|
|
88
|
-
- **CommonJS (`.cjs`)**
|
|
89
|
-
- **JSON (`.json`)**
|
|
90
|
-
|
|
91
|
-
### Pestaña Intlayer (Barra de Actividad)
|
|
53
|
+

|
|
92
54
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- **Buscar**: Una barra de búsqueda en vivo para filtrar rápidamente los diccionarios y su contenido. Al escribir, los resultados se actualizan instantáneamente.
|
|
96
|
-
- **Diccionarios**: Una vista en árbol de tus entornos/proyectos, claves de diccionario y los archivos que aportan entradas. Puedes:
|
|
97
|
-
- Hacer clic en un archivo para abrirlo en el editor.
|
|
98
|
-
- Usar la barra de herramientas para ejecutar acciones: Construir, Extraer (Pull), Enviar (Push), Rellenar, Actualizar, Probar y Crear Archivo de Diccionario.
|
|
99
|
-
- Usar el menú contextual para acciones específicas del ítem:
|
|
100
|
-
- En un diccionario: Extraer (Pull) o Enviar (Push)
|
|
101
|
-
- En un archivo: Rellenar Diccionario
|
|
102
|
-
- Cuando cambias de editor, el árbol revelará el archivo correspondiente si pertenece a un diccionario.
|
|
103
|
-
|
|
104
|
-
## Instalación
|
|
105
|
-
|
|
106
|
-
Puedes instalar **Intlayer** directamente desde el Marketplace de VS Code:
|
|
107
|
-
|
|
108
|
-
1. Abre **VS Code**.
|
|
109
|
-
2. Ve al **Marketplace de Extensiones**.
|
|
110
|
-
3. Busca **"Intlayer"**.
|
|
111
|
-
4. Haz clic en **Instalar**.
|
|
55
|
+
- **Pestaña Intlayer (Barra de Actividad)** – Navega y busca diccionarios desde una pestaña lateral dedicada con barra de herramientas y acciones contextuales (Construir, Descargar, Enviar, Rellenar, Actualizar, Probar, Crear Archivo).
|
|
112
56
|
|
|
113
57
|
## Uso
|
|
114
58
|
|
|
115
|
-
### Navegación
|
|
59
|
+
### Navegación rápida
|
|
116
60
|
|
|
117
61
|
1. Abre un proyecto que use **react-intlayer**.
|
|
118
62
|
2. Localiza una llamada a `useIntlayer()`, como:
|
|
@@ -121,63 +65,58 @@ Puedes instalar **Intlayer** directamente desde el Marketplace de VS Code:
|
|
|
121
65
|
const content = useIntlayer("app");
|
|
122
66
|
```
|
|
123
67
|
|
|
124
|
-
3. Haz **
|
|
68
|
+
3. **Haz clic con comando** (`⌘+Click` en macOS) o **Ctrl+Click** (en Windows/Linux) sobre la clave (por ejemplo, `"app"`).
|
|
125
69
|
4. VS Code abrirá automáticamente el archivo de diccionario correspondiente, por ejemplo, `src/app.content.ts`.
|
|
126
70
|
|
|
127
|
-
###
|
|
128
|
-
|
|
129
|
-
### Pestaña Intlayer (Barra de Actividades)
|
|
71
|
+
### Pestaña Intlayer (Barra de Actividad)
|
|
130
72
|
|
|
131
|
-
Usa la pestaña lateral para
|
|
73
|
+
Usa la pestaña lateral para navegar y gestionar diccionarios:
|
|
132
74
|
|
|
133
|
-
- Abre el ícono de Intlayer en la Barra de
|
|
75
|
+
- Abre el ícono de Intlayer en la Barra de Actividad.
|
|
134
76
|
- En **Buscar**, escribe para filtrar diccionarios y entradas en tiempo real.
|
|
135
|
-
- En **Diccionarios**, navega por entornos, diccionarios y archivos. Usa la barra de herramientas para Construir, Extraer, Enviar, Rellenar, Actualizar, Probar y Crear Archivo de Diccionario. Haz clic derecho para acciones contextuales (Extraer/Enviar en diccionarios, Rellenar en archivos). El archivo actual del editor se revela automáticamente en el árbol cuando es aplicable.
|
|
77
|
+
- En **Diccionarios**, navega por entornos, diccionarios y archivos. Usa la barra de herramientas para Construir, Extraer (Pull), Enviar (Push), Rellenar, Actualizar, Probar y Crear Archivo de Diccionario. Haz clic derecho para acciones contextuales (Extraer/Enviar en diccionarios, Rellenar en archivos). El archivo actual del editor se revela automáticamente en el árbol cuando es aplicable.
|
|
136
78
|
|
|
137
|
-
|
|
79
|
+
### Acceso a los comandos
|
|
138
80
|
|
|
139
|
-
|
|
81
|
+
Puedes acceder a los comandos desde la **Paleta de Comandos**.
|
|
140
82
|
|
|
141
83
|
```sh
|
|
142
84
|
Cmd + Shift + P (macOS) / Ctrl + Shift + P (Windows/Linux)
|
|
143
85
|
```
|
|
144
86
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
1. Abre la **Paleta de Comandos**.
|
|
152
|
-
2. Busca **Enviar Diccionarios**.
|
|
153
|
-
3. Selecciona los diccionarios a enviar y confirma.
|
|
154
|
-
|
|
155
|
-
#### Extracción de Diccionarios
|
|
87
|
+
- **Construir Diccionarios**
|
|
88
|
+
- **Enviar Diccionarios**
|
|
89
|
+
- **Obtener Diccionarios**
|
|
90
|
+
- **Rellenar Diccionarios**
|
|
91
|
+
- **Probar Diccionarios**
|
|
92
|
+
- **Crear Archivo de Diccionario**
|
|
156
93
|
|
|
157
|
-
|
|
94
|
+
### Carga de Variables de Entorno
|
|
158
95
|
|
|
159
|
-
|
|
160
|
-
2. Busca **Extraer Diccionarios**.
|
|
161
|
-
3. Elige los diccionarios que deseas extraer.
|
|
96
|
+
Intlayer recomienda almacenar tus claves API de IA, así como el ID y secreto del cliente de Intlayer en variables de entorno.
|
|
162
97
|
|
|
163
|
-
|
|
98
|
+
La extensión puede cargar variables de entorno desde tu espacio de trabajo para ejecutar comandos de Intlayer con el contexto correcto.
|
|
164
99
|
|
|
165
|
-
|
|
100
|
+
- **Orden de carga (por prioridad)**: `.env.<env>.local` → `.env.<env>` → `.env.local` → `.env`
|
|
101
|
+
- **No destructivo**: los valores existentes en `process.env` no son sobrescritos.
|
|
102
|
+
- **Alcance**: los archivos se resuelven desde el directorio base configurado (por defecto la raíz del espacio de trabajo).
|
|
166
103
|
|
|
167
|
-
|
|
168
|
-
2. Busca **Rellenar Diccionarios**.
|
|
169
|
-
3. Ejecuta el comando para poblar los diccionarios.
|
|
104
|
+
#### Selección del entorno activo
|
|
170
105
|
|
|
171
|
-
|
|
106
|
+
- **Paleta de Comandos**: abre la paleta y ejecuta `Intlayer: Select Environment`, luego elige el entorno (por ejemplo, `development`, `staging`, `production`). La extensión intentará cargar el primer archivo disponible en la lista de prioridad mencionada y mostrará una notificación como “Entorno cargado desde .env.<env>.local”.
|
|
107
|
+
- **Configuración**: ve a `Settings → Extensions → Intlayer`, y configura:
|
|
108
|
+
- **Environment**: el nombre del entorno usado para resolver archivos `.env.<env>*`.
|
|
109
|
+
- (Opcional) **Env File**: una ruta explícita a un archivo `.env`. Cuando se proporciona, tiene prioridad sobre la lista inferida.
|
|
172
110
|
|
|
173
|
-
|
|
111
|
+
#### Monorepos y directorios personalizados
|
|
174
112
|
|
|
175
|
-
|
|
176
|
-
2. Busca **Probar Diccionarios**.
|
|
177
|
-
3. Revisa los problemas reportados y corrígelos según sea necesario.
|
|
113
|
+
Si tus archivos `.env` están fuera de la raíz del espacio de trabajo, configura el **Directorio Base** en `Configuración → Extensiones → Intlayer`. El cargador buscará los archivos `.env` relativos a ese directorio.
|
|
178
114
|
|
|
179
|
-
## Historial
|
|
115
|
+
## Historial de Documentación
|
|
180
116
|
|
|
181
|
-
| Versión | Fecha | Cambios
|
|
182
|
-
| ------- | ---------- |
|
|
183
|
-
|
|
|
117
|
+
| Versión | Fecha | Cambios |
|
|
118
|
+
| ------- | ---------- | --------------------------------------------- |
|
|
119
|
+
| 6.1.5 | 2025-09-30 | Añadido gif de demostración |
|
|
120
|
+
| 6.1.0 | 2025-09-24 | Añadida sección de selección de entorno |
|
|
121
|
+
| 6.0.0 | 2025-09-22 | Pestaña Intlayer / Comandos Rellenar y Probar |
|
|
122
|
+
| 5.5.10 | 2025-06-29 | Historial inicial |
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2025-09-30
|
|
4
|
+
title: Rendre un composant multilingue (i18n) en React et Next.js
|
|
5
|
+
description: Apprenez à déclarer et récupérer du contenu localisé pour créer un composant React ou Next.js multilingue avec Intlayer.
|
|
6
|
+
keywords:
|
|
7
|
+
- i18n
|
|
8
|
+
- composant
|
|
9
|
+
- react
|
|
10
|
+
- multilingue
|
|
11
|
+
- next.js
|
|
12
|
+
- intlayer
|
|
13
|
+
slugs:
|
|
14
|
+
- doc
|
|
15
|
+
- component
|
|
16
|
+
- i18n
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
18
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Comment rendre un composant multilingue (i18n) avec Intlayer
|
|
22
|
+
|
|
23
|
+
Ce guide montre les étapes minimales pour rendre un composant d'interface utilisateur multilingue dans deux configurations courantes :
|
|
24
|
+
|
|
25
|
+
- React (Vite/SPA)
|
|
26
|
+
- Next.js (App Router)
|
|
27
|
+
|
|
28
|
+
Vous commencerez par déclarer votre contenu, puis vous le récupérerez dans votre composant.
|
|
29
|
+
|
|
30
|
+
## 1) Déclarez votre contenu (partagé pour React et Next.js)
|
|
31
|
+
|
|
32
|
+
Créez un fichier de déclaration de contenu à proximité de votre composant. Cela permet de garder les traductions proches de leur utilisation et assure la sécurité des types.
|
|
33
|
+
|
|
34
|
+
```ts fileName="component.content.ts"
|
|
35
|
+
import { t, type Dictionary } from "intlayer";
|
|
36
|
+
|
|
37
|
+
const componentContent = {
|
|
38
|
+
key: "component-example",
|
|
39
|
+
content: {
|
|
40
|
+
title: t({
|
|
41
|
+
en: "Hello",
|
|
42
|
+
fr: "Bonjour",
|
|
43
|
+
es: "Hola",
|
|
44
|
+
}),
|
|
45
|
+
description: t({
|
|
46
|
+
en: "A multilingual React component",
|
|
47
|
+
fr: "Un composant React multilingue",
|
|
48
|
+
es: "Un componente React multilingüe",
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
} satisfies Dictionary;
|
|
52
|
+
|
|
53
|
+
export default componentContent;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Le JSON est également supporté si vous préférez les fichiers de configuration.
|
|
57
|
+
|
|
58
|
+
```json fileName="component.content.json"
|
|
59
|
+
{
|
|
60
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
61
|
+
"key": "component-example",
|
|
62
|
+
"content": {
|
|
63
|
+
"title": {
|
|
64
|
+
"nodeType": "translation",
|
|
65
|
+
"translation": { "en": "Hello", "fr": "Bonjour", "es": "Hola" }
|
|
66
|
+
},
|
|
67
|
+
"description": {
|
|
68
|
+
"nodeType": "translation",
|
|
69
|
+
"translation": {
|
|
70
|
+
"en": "A multilingual React component",
|
|
71
|
+
"fr": "Un composant React multilingue",
|
|
72
|
+
"es": "Un componente React multilingüe"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 2) Récupérez votre contenu
|
|
80
|
+
|
|
81
|
+
### Cas A — Application React (Vite/SPA)
|
|
82
|
+
|
|
83
|
+
Approche par défaut : utilisez `useIntlayer` pour récupérer par clé. Cela permet de garder les composants légers et typés.
|
|
84
|
+
|
|
85
|
+
```tsx fileName="ComponentExample.tsx"
|
|
86
|
+
import { useIntlayer } from "react-intlayer";
|
|
87
|
+
|
|
88
|
+
export function ComponentExample() {
|
|
89
|
+
const content = useIntlayer("component-example");
|
|
90
|
+
return (
|
|
91
|
+
<div>
|
|
92
|
+
<h1>{content.title}</h1>
|
|
93
|
+
<p>{content.description}</p>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Rendu côté serveur ou hors du provider : utilisez `react-intlayer/server` et passez un `locale` explicite si nécessaire.
|
|
100
|
+
|
|
101
|
+
```tsx fileName="ServerRenderedExample.tsx"
|
|
102
|
+
import { useIntlayer } from "react-intlayer/server";
|
|
103
|
+
|
|
104
|
+
export function ServerRenderedExample({ locale }: { locale: string }) {
|
|
105
|
+
const content = useIntlayer("component-example", locale);
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
<h1>{content.title}</h1>
|
|
109
|
+
<p>{content.description}</p>
|
|
110
|
+
</>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Alternative : `useDictionary` peut lire un objet déclaré en entier si vous préférez regrouper la structure au point d'appel.
|
|
116
|
+
|
|
117
|
+
```tsx fileName="ComponentWithDictionary.tsx"
|
|
118
|
+
import { useDictionary } from "react-intlayer";
|
|
119
|
+
import componentContent from "./component.content";
|
|
120
|
+
|
|
121
|
+
export function ComponentWithDictionary() {
|
|
122
|
+
const { title, description } = useDictionary(componentContent);
|
|
123
|
+
return (
|
|
124
|
+
<div>
|
|
125
|
+
<h1>{title}</h1>
|
|
126
|
+
<p>{description}</p>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Cas B — Next.js (App Router)
|
|
133
|
+
|
|
134
|
+
Privilégiez les composants serveur pour la sécurité des données et la performance. Utilisez `useIntlayer` depuis `next-intlayer/server` dans les fichiers serveur, et `useIntlayer` depuis `next-intlayer` dans les composants clients.
|
|
135
|
+
|
|
136
|
+
```tsx fileName="app/[locale]/example/ServerComponent.tsx"
|
|
137
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
138
|
+
|
|
139
|
+
export default function ServerComponent() {
|
|
140
|
+
const content = useIntlayer("component-example");
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
<h1>{content.title}</h1>
|
|
144
|
+
<p>{content.description}</p>
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```tsx fileName="app/[locale]/example/ClientComponent.tsx"
|
|
151
|
+
"use client";
|
|
152
|
+
|
|
153
|
+
import { useIntlayer } from "next-intlayer";
|
|
154
|
+
|
|
155
|
+
export function ClientComponent() {
|
|
156
|
+
const content = useIntlayer("component-example");
|
|
157
|
+
return (
|
|
158
|
+
<div>
|
|
159
|
+
<h1>{content.title}</h1>
|
|
160
|
+
<p>{content.description}</p>
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Astuce : Pour les métadonnées de page et le SEO, vous pouvez également récupérer le contenu en utilisant `getIntlayer` et générer des URLs multilingues via `getMultilingualUrls`.
|
|
167
|
+
|
|
168
|
+
## Pourquoi l’approche composant d’Intlayer est la meilleure
|
|
169
|
+
|
|
170
|
+
- **Collocation** : Les déclarations de contenu vivent à proximité des composants, réduisant les dérives et améliorant la réutilisation à travers les systèmes de design.
|
|
171
|
+
- **Sécurité des types** : Les clés et structures sont fortement typées ; les traductions manquantes apparaissent à la compilation plutôt qu’à l’exécution.
|
|
172
|
+
- **Serveur d'abord** : Fonctionne nativement dans les composants serveur pour une meilleure sécurité et performance ; les hooks client restent ergonomiques.
|
|
173
|
+
- **Tree-shaking** : Seul le contenu utilisé par le composant est inclus, ce qui maintient les charges utiles légères dans les grandes applications.
|
|
174
|
+
- **Expérience développeur & outils** : Middleware intégré, assistants SEO, et traductions optionnelles via éditeur visuel/IA facilitent le travail quotidien.
|
|
175
|
+
|
|
176
|
+
Consultez les comparaisons et les modèles dans le résumé axé sur Next.js : https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
|
|
177
|
+
|
|
178
|
+
## Guides et références associés
|
|
179
|
+
|
|
180
|
+
- Configuration React (Vite) : https://intlayer.org/doc/environment/vite-and-react
|
|
181
|
+
- React Router v7 : https://intlayer.org/doc/environment/vite-and-react/react-router-v7
|
|
182
|
+
- Démarrage TanStack : https://intlayer.org/doc/environment/vite-and-react/tanstack-start
|
|
183
|
+
- Configuration Next.js : https://intlayer.org/doc/environment/nextjs
|
|
184
|
+
- Pourquoi Intlayer vs. next-intl vs. next-i18next : https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
|
|
185
|
+
|
|
186
|
+
Ces pages incluent la configuration de bout en bout, les fournisseurs, le routage et les assistants SEO.
|
|
@@ -648,9 +648,9 @@ Pour des scénarios plus complexes, vous pouvez créer un pipe pour rendre le HT
|
|
|
648
648
|
|
|
649
649
|
Intlayer utilise l'augmentation de module pour bénéficier de TypeScript et renforcer votre base de code.
|
|
650
650
|
|
|
651
|
-

|
|
652
652
|
|
|
653
|
-

|
|
654
654
|
|
|
655
655
|
Assurez-vous que votre configuration TypeScript inclut les types générés automatiquement.
|
|
656
656
|
|