@intlayer/docs 8.4.10 → 8.5.0
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/generated/docs.entry.cjs +40 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +40 -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/dictionary/html.md +22 -22
- package/docs/ar/dictionary/markdown.md +18 -18
- package/docs/ar/intlayer_with_analog.md +2 -13
- package/docs/ar/intlayer_with_angular.md +1 -12
- package/docs/ar/intlayer_with_nextjs_14.md +1 -1
- package/docs/ar/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ar/intlayer_with_react_router_v7.md +6 -1
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/ar/intlayer_with_storybook.md +2 -5
- package/docs/ar/intlayer_with_svelte_kit.md +9 -5
- package/docs/ar/intlayer_with_vite+lit.md +738 -0
- package/docs/ar/intlayer_with_vite+react.md +16 -4
- package/docs/ar/intlayer_with_vite+solid.md +1 -1
- package/docs/ar/intlayer_with_vite+svelte.md +13 -6
- package/docs/ar/intlayer_with_vite+vanilla.md +722 -0
- package/docs/ar/intlayer_with_vite+vue.md +21 -5
- package/docs/ar/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/ar/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/ar/releases/v8.md +27 -27
- package/docs/bn/intlayer_with_storybook.md +2 -5
- package/docs/bn/intlayer_with_vite+lit.md +738 -0
- package/docs/bn/intlayer_with_vite+vanilla.md +722 -0
- package/docs/cs/intlayer_with_storybook.md +2 -5
- package/docs/cs/intlayer_with_vite+lit.md +738 -0
- package/docs/cs/intlayer_with_vite+vanilla.md +722 -0
- package/docs/de/dictionary/html.md +146 -24
- package/docs/de/dictionary/markdown.md +143 -25
- package/docs/de/intlayer_with_analog.md +2 -13
- package/docs/de/intlayer_with_angular.md +1 -12
- package/docs/de/intlayer_with_nextjs_14.md +1 -1
- package/docs/de/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/de/intlayer_with_react_router_v7.md +6 -1
- package/docs/de/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/de/intlayer_with_storybook.md +2 -5
- package/docs/de/intlayer_with_svelte_kit.md +9 -5
- package/docs/de/intlayer_with_vite+lit.md +747 -0
- package/docs/de/intlayer_with_vite+react.md +16 -4
- package/docs/de/intlayer_with_vite+solid.md +1 -1
- package/docs/de/intlayer_with_vite+svelte.md +19 -6
- package/docs/de/intlayer_with_vite+vanilla.md +722 -0
- package/docs/de/intlayer_with_vite+vue.md +21 -5
- package/docs/de/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/de/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/de/releases/v8.md +27 -27
- package/docs/en/compiler.md +4 -1
- package/docs/en/configuration.md +4 -1
- package/docs/en/dictionary/html.md +146 -24
- package/docs/en/dictionary/markdown.md +143 -21
- package/docs/en/intlayer_with_analog.md +3 -14
- package/docs/en/intlayer_with_angular.md +1 -12
- package/docs/en/intlayer_with_nextjs_14.md +1 -1
- package/docs/en/intlayer_with_nextjs_16.md +12 -3
- package/docs/en/intlayer_with_nextjs_compiler.md +16 -4
- package/docs/en/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/en/intlayer_with_react_router_v7.md +17 -4
- package/docs/en/intlayer_with_react_router_v7_fs_routes.md +18 -4
- package/docs/en/intlayer_with_storybook.md +2 -5
- package/docs/en/intlayer_with_svelte_kit.md +21 -8
- package/docs/en/intlayer_with_tanstack.md +12 -3
- package/docs/en/intlayer_with_vite+lit.md +750 -0
- package/docs/en/intlayer_with_vite+preact.md +31 -3
- package/docs/en/intlayer_with_vite+react.md +28 -7
- package/docs/en/intlayer_with_vite+react_compiler.md +4 -1
- package/docs/en/intlayer_with_vite+solid.md +31 -3
- package/docs/en/intlayer_with_vite+svelte.md +30 -9
- package/docs/en/intlayer_with_vite+vanilla.md +725 -0
- package/docs/en/intlayer_with_vite+vue.md +28 -7
- package/docs/en/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/en/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/en/readme.md +1 -0
- package/docs/en/releases/v8.md +27 -27
- package/docs/en-GB/compiler.md +4 -1
- package/docs/en-GB/configuration.md +4 -1
- package/docs/en-GB/dictionary/html.md +22 -22
- package/docs/en-GB/dictionary/markdown.md +18 -18
- package/docs/en-GB/intlayer_with_analog.md +2 -13
- package/docs/en-GB/intlayer_with_angular.md +1 -12
- package/docs/en-GB/intlayer_with_nextjs_14.md +1 -1
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/en-GB/intlayer_with_react_router_v7.md +6 -1
- package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/en-GB/intlayer_with_storybook.md +2 -5
- package/docs/en-GB/intlayer_with_svelte_kit.md +9 -5
- package/docs/en-GB/intlayer_with_vite+lit.md +750 -0
- package/docs/en-GB/intlayer_with_vite+react.md +15 -3
- package/docs/en-GB/intlayer_with_vite+solid.md +1 -1
- package/docs/en-GB/intlayer_with_vite+svelte.md +17 -5
- package/docs/en-GB/intlayer_with_vite+vanilla.md +725 -0
- package/docs/en-GB/intlayer_with_vite+vue.md +16 -4
- package/docs/en-GB/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/en-GB/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/en-GB/releases/v8.md +27 -27
- package/docs/es/dictionary/html.md +147 -25
- package/docs/es/dictionary/markdown.md +143 -25
- package/docs/es/intlayer_with_analog.md +2 -13
- package/docs/es/intlayer_with_angular.md +1 -12
- package/docs/es/intlayer_with_nextjs_14.md +1 -1
- package/docs/es/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/es/intlayer_with_react_router_v7.md +6 -1
- package/docs/es/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/es/intlayer_with_storybook.md +2 -5
- package/docs/es/intlayer_with_svelte_kit.md +9 -5
- package/docs/es/intlayer_with_vite+lit.md +747 -0
- package/docs/es/intlayer_with_vite+react.md +16 -4
- package/docs/es/intlayer_with_vite+solid.md +1 -1
- package/docs/es/intlayer_with_vite+svelte.md +16 -6
- package/docs/es/intlayer_with_vite+vanilla.md +722 -0
- package/docs/es/intlayer_with_vite+vue.md +21 -5
- package/docs/es/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/es/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/es/releases/v8.md +27 -27
- package/docs/fr/dictionary/html.md +146 -24
- package/docs/fr/dictionary/markdown.md +143 -25
- package/docs/fr/intlayer_with_analog.md +2 -13
- package/docs/fr/intlayer_with_angular.md +1 -12
- package/docs/fr/intlayer_with_nextjs_14.md +1 -1
- package/docs/fr/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/fr/intlayer_with_react_router_v7.md +6 -1
- package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/fr/intlayer_with_storybook.md +2 -5
- package/docs/fr/intlayer_with_svelte_kit.md +9 -5
- package/docs/fr/intlayer_with_vite+lit.md +747 -0
- package/docs/fr/intlayer_with_vite+react.md +16 -4
- package/docs/fr/intlayer_with_vite+solid.md +1 -1
- package/docs/fr/intlayer_with_vite+svelte.md +19 -6
- package/docs/fr/intlayer_with_vite+vanilla.md +722 -0
- package/docs/fr/intlayer_with_vite+vue.md +21 -5
- package/docs/fr/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/fr/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/fr/releases/v8.md +27 -27
- package/docs/hi/dictionary/html.md +22 -22
- package/docs/hi/dictionary/markdown.md +18 -18
- package/docs/hi/intlayer_with_analog.md +2 -13
- package/docs/hi/intlayer_with_angular.md +1 -12
- package/docs/hi/intlayer_with_nextjs_14.md +1 -1
- package/docs/hi/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/hi/intlayer_with_react_router_v7.md +6 -1
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/hi/intlayer_with_storybook.md +2 -5
- package/docs/hi/intlayer_with_svelte_kit.md +9 -5
- package/docs/hi/intlayer_with_vite+lit.md +738 -0
- package/docs/hi/intlayer_with_vite+react.md +16 -4
- package/docs/hi/intlayer_with_vite+solid.md +1 -1
- package/docs/hi/intlayer_with_vite+svelte.md +13 -6
- package/docs/hi/intlayer_with_vite+vanilla.md +722 -0
- package/docs/hi/intlayer_with_vite+vue.md +21 -5
- package/docs/hi/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/hi/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/hi/releases/v8.md +27 -27
- package/docs/id/dictionary/html.md +22 -22
- package/docs/id/dictionary/markdown.md +18 -18
- package/docs/id/intlayer_with_analog.md +2 -13
- package/docs/id/intlayer_with_angular.md +1 -12
- package/docs/id/intlayer_with_nextjs_14.md +1 -1
- package/docs/id/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/id/intlayer_with_react_router_v7.md +6 -1
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/id/intlayer_with_storybook.md +2 -5
- package/docs/id/intlayer_with_svelte_kit.md +9 -5
- package/docs/id/intlayer_with_vite+lit.md +738 -0
- package/docs/id/intlayer_with_vite+react.md +16 -4
- package/docs/id/intlayer_with_vite+solid.md +1 -1
- package/docs/id/intlayer_with_vite+svelte.md +13 -6
- package/docs/id/intlayer_with_vite+vanilla.md +722 -0
- package/docs/id/intlayer_with_vite+vue.md +16 -4
- package/docs/id/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/id/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/id/releases/v8.md +27 -27
- package/docs/it/dictionary/html.md +146 -24
- package/docs/it/dictionary/markdown.md +143 -21
- package/docs/it/intlayer_with_analog.md +2 -13
- package/docs/it/intlayer_with_angular.md +1 -12
- package/docs/it/intlayer_with_nextjs_14.md +1 -1
- package/docs/it/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/it/intlayer_with_react_router_v7.md +6 -1
- package/docs/it/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/it/intlayer_with_storybook.md +2 -5
- package/docs/it/intlayer_with_svelte_kit.md +9 -5
- package/docs/it/intlayer_with_vite+lit.md +747 -0
- package/docs/it/intlayer_with_vite+react.md +16 -4
- package/docs/it/intlayer_with_vite+solid.md +1 -1
- package/docs/it/intlayer_with_vite+svelte.md +13 -6
- package/docs/it/intlayer_with_vite+vanilla.md +722 -0
- package/docs/it/intlayer_with_vite+vue.md +21 -5
- package/docs/it/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/it/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/it/releases/v8.md +27 -27
- package/docs/ja/dictionary/html.md +148 -27
- package/docs/ja/dictionary/markdown.md +139 -24
- package/docs/ja/intlayer_with_analog.md +2 -13
- package/docs/ja/intlayer_with_angular.md +1 -12
- package/docs/ja/intlayer_with_nextjs_14.md +1 -1
- package/docs/ja/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ja/intlayer_with_react_router_v7.md +6 -1
- package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/ja/intlayer_with_storybook.md +2 -5
- package/docs/ja/intlayer_with_vite+lit.md +747 -0
- package/docs/ja/intlayer_with_vite+solid.md +1 -1
- package/docs/ja/intlayer_with_vite+svelte.md +13 -6
- package/docs/ja/intlayer_with_vite+vanilla.md +722 -0
- package/docs/ja/intlayer_with_vite+vue.md +21 -5
- package/docs/ja/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/ja/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/ja/releases/v8.md +27 -27
- package/docs/ko/dictionary/html.md +149 -28
- package/docs/ko/dictionary/markdown.md +143 -25
- package/docs/ko/intlayer_with_analog.md +2 -13
- package/docs/ko/intlayer_with_angular.md +1 -12
- package/docs/ko/intlayer_with_nextjs_14.md +1 -1
- package/docs/ko/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ko/intlayer_with_react_router_v7.md +6 -1
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/ko/intlayer_with_storybook.md +2 -5
- package/docs/ko/intlayer_with_svelte_kit.md +9 -5
- package/docs/ko/intlayer_with_vite+lit.md +747 -0
- package/docs/ko/intlayer_with_vite+react.md +16 -4
- package/docs/ko/intlayer_with_vite+solid.md +1 -1
- package/docs/ko/intlayer_with_vite+svelte.md +13 -6
- package/docs/ko/intlayer_with_vite+vanilla.md +722 -0
- package/docs/ko/intlayer_with_vite+vue.md +21 -5
- package/docs/ko/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/ko/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/ko/releases/v8.md +27 -27
- package/docs/nl/intlayer_with_storybook.md +2 -5
- package/docs/nl/intlayer_with_vite+lit.md +738 -0
- package/docs/nl/intlayer_with_vite+vanilla.md +722 -0
- package/docs/pl/dictionary/html.md +146 -24
- package/docs/pl/dictionary/markdown.md +143 -25
- package/docs/pl/intlayer_with_analog.md +2 -13
- package/docs/pl/intlayer_with_angular.md +1 -12
- package/docs/pl/intlayer_with_nextjs_14.md +1 -1
- package/docs/pl/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/pl/intlayer_with_react_router_v7.md +6 -1
- package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/pl/intlayer_with_storybook.md +2 -5
- package/docs/pl/intlayer_with_svelte_kit.md +9 -5
- package/docs/pl/intlayer_with_vite+lit.md +738 -0
- package/docs/pl/intlayer_with_vite+react.md +16 -4
- package/docs/pl/intlayer_with_vite+solid.md +1 -1
- package/docs/pl/intlayer_with_vite+svelte.md +13 -6
- package/docs/pl/intlayer_with_vite+vanilla.md +722 -0
- package/docs/pl/intlayer_with_vite+vue.md +16 -4
- package/docs/pl/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/pl/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/pl/releases/v8.md +27 -27
- package/docs/pt/dictionary/html.md +127 -24
- package/docs/pt/dictionary/markdown.md +143 -25
- package/docs/pt/intlayer_with_analog.md +2 -13
- package/docs/pt/intlayer_with_angular.md +1 -12
- package/docs/pt/intlayer_with_nextjs_14.md +1 -1
- package/docs/pt/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/pt/intlayer_with_react_router_v7.md +6 -1
- package/docs/pt/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/pt/intlayer_with_storybook.md +2 -5
- package/docs/pt/intlayer_with_svelte_kit.md +9 -5
- package/docs/pt/intlayer_with_vite+lit.md +747 -0
- package/docs/pt/intlayer_with_vite+react.md +16 -4
- package/docs/pt/intlayer_with_vite+solid.md +1 -1
- package/docs/pt/intlayer_with_vite+svelte.md +16 -6
- package/docs/pt/intlayer_with_vite+vanilla.md +722 -0
- package/docs/pt/intlayer_with_vite+vue.md +21 -5
- package/docs/pt/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/pt/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/pt/releases/v8.md +27 -27
- package/docs/ru/dictionary/html.md +148 -27
- package/docs/ru/dictionary/markdown.md +143 -23
- package/docs/ru/intlayer_with_analog.md +2 -13
- package/docs/ru/intlayer_with_angular.md +1 -12
- package/docs/ru/intlayer_with_nextjs_14.md +1 -1
- package/docs/ru/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ru/intlayer_with_react_router_v7.md +6 -1
- package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/ru/intlayer_with_storybook.md +2 -5
- package/docs/ru/intlayer_with_svelte_kit.md +9 -5
- package/docs/ru/intlayer_with_vite+lit.md +747 -0
- package/docs/ru/intlayer_with_vite+react.md +16 -4
- package/docs/ru/intlayer_with_vite+solid.md +1 -1
- package/docs/ru/intlayer_with_vite+svelte.md +13 -6
- package/docs/ru/intlayer_with_vite+vanilla.md +722 -0
- package/docs/ru/intlayer_with_vite+vue.md +21 -5
- package/docs/ru/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/ru/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/ru/releases/v8.md +27 -27
- package/docs/tr/dictionary/html.md +129 -27
- package/docs/tr/dictionary/markdown.md +143 -23
- package/docs/tr/intlayer_with_analog.md +2 -13
- package/docs/tr/intlayer_with_angular.md +1 -12
- package/docs/tr/intlayer_with_nextjs_14.md +1 -1
- package/docs/tr/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/tr/intlayer_with_react_router_v7.md +6 -1
- package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/tr/intlayer_with_storybook.md +2 -5
- package/docs/tr/intlayer_with_svelte_kit.md +9 -5
- package/docs/tr/intlayer_with_vite+lit.md +738 -0
- package/docs/tr/intlayer_with_vite+react.md +16 -4
- package/docs/tr/intlayer_with_vite+solid.md +1 -1
- package/docs/tr/intlayer_with_vite+svelte.md +13 -6
- package/docs/tr/intlayer_with_vite+vanilla.md +722 -0
- package/docs/tr/intlayer_with_vite+vue.md +16 -4
- package/docs/tr/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/tr/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/tr/releases/v8.md +27 -27
- package/docs/uk/dictionary/html.md +22 -22
- package/docs/uk/dictionary/markdown.md +18 -18
- package/docs/uk/intlayer_with_analog.md +2 -13
- package/docs/uk/intlayer_with_angular.md +1 -12
- package/docs/uk/intlayer_with_nextjs_14.md +1 -1
- package/docs/uk/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/uk/intlayer_with_react_router_v7.md +5 -1
- package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/uk/intlayer_with_storybook.md +2 -5
- package/docs/uk/intlayer_with_svelte_kit.md +9 -5
- package/docs/uk/intlayer_with_vite+lit.md +738 -0
- package/docs/uk/intlayer_with_vite+react.md +16 -4
- package/docs/uk/intlayer_with_vite+solid.md +1 -1
- package/docs/uk/intlayer_with_vite+svelte.md +18 -6
- package/docs/uk/intlayer_with_vite+vanilla.md +722 -0
- package/docs/uk/intlayer_with_vite+vue.md +16 -4
- package/docs/uk/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/uk/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/uk/releases/v8.md +27 -27
- package/docs/ur/intlayer_with_storybook.md +2 -5
- package/docs/ur/intlayer_with_vite+lit.md +738 -0
- package/docs/ur/intlayer_with_vite+vanilla.md +722 -0
- package/docs/vi/dictionary/html.md +22 -22
- package/docs/vi/dictionary/markdown.md +18 -18
- package/docs/vi/intlayer_with_analog.md +2 -13
- package/docs/vi/intlayer_with_angular.md +1 -12
- package/docs/vi/intlayer_with_nextjs_14.md +1 -1
- package/docs/vi/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/vi/intlayer_with_react_router_v7.md +6 -1
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/vi/intlayer_with_storybook.md +2 -5
- package/docs/vi/intlayer_with_svelte_kit.md +9 -5
- package/docs/vi/intlayer_with_vite+lit.md +738 -0
- package/docs/vi/intlayer_with_vite+react.md +16 -4
- package/docs/vi/intlayer_with_vite+solid.md +1 -1
- package/docs/vi/intlayer_with_vite+svelte.md +17 -5
- package/docs/vi/intlayer_with_vite+vanilla.md +722 -0
- package/docs/vi/intlayer_with_vite+vue.md +16 -4
- package/docs/vi/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/vi/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/vi/releases/v8.md +27 -27
- package/docs/zh/dictionary/html.md +148 -27
- package/docs/zh/dictionary/markdown.md +143 -21
- package/docs/zh/intlayer_with_analog.md +2 -13
- package/docs/zh/intlayer_with_angular.md +1 -12
- package/docs/zh/intlayer_with_nextjs_14.md +1 -1
- package/docs/zh/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/zh/intlayer_with_react_router_v7.md +6 -1
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +6 -1
- package/docs/zh/intlayer_with_storybook.md +2 -5
- package/docs/zh/intlayer_with_svelte_kit.md +9 -5
- package/docs/zh/intlayer_with_vite+lit.md +747 -0
- package/docs/zh/intlayer_with_vite+react.md +16 -4
- package/docs/zh/intlayer_with_vite+solid.md +1 -1
- package/docs/zh/intlayer_with_vite+svelte.md +16 -6
- package/docs/zh/intlayer_with_vite+vanilla.md +722 -0
- package/docs/zh/intlayer_with_vite+vue.md +16 -4
- package/docs/zh/packages/react-intlayer/MarkdownRenderer.md +1 -1
- package/docs/zh/packages/svelte-intlayer/useRewriteURL.md +1 -1
- package/docs/zh/releases/v8.md +27 -27
- package/package.json +6 -6
- package/src/generated/docs.entry.ts +40 -0
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2026-03-23
|
|
3
|
+
updatedAt: 2026-03-23
|
|
4
|
+
title: i18n Vite + Vanilla JS - Cómo traducir una aplicación Vanilla JS en 2026
|
|
5
|
+
description: Descubre cómo hacer que tu sitio web Vite y Vanilla JS sea multilingüe. Sigue la documentación para internacionalizarlo (i18n) y traducirlo.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internacionalización
|
|
8
|
+
- Documentación
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Vite
|
|
11
|
+
- Vanilla JS
|
|
12
|
+
- JavaScript
|
|
13
|
+
- TypeScript
|
|
14
|
+
- HTML
|
|
15
|
+
slugs:
|
|
16
|
+
- doc
|
|
17
|
+
- environment
|
|
18
|
+
- vite-and-vanilla
|
|
19
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-vanilla-template
|
|
20
|
+
history:
|
|
21
|
+
- version: 8.4.10
|
|
22
|
+
date: 2026-03-23
|
|
23
|
+
changes: "Init history"
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Traduce tu sitio web Vite y Vanilla JS usando Intlayer | Internacionalización (i18n)
|
|
27
|
+
|
|
28
|
+
## Tabla de Contenidos
|
|
29
|
+
|
|
30
|
+
<TOC/>
|
|
31
|
+
|
|
32
|
+
## ¿Qué es Intlayer?
|
|
33
|
+
|
|
34
|
+
**Intlayer** es una biblioteca de internacionalización (i18n) innovadora y de código abierto diseñada para simplificar el soporte multilingüe en aplicaciones web modernas.
|
|
35
|
+
|
|
36
|
+
Con Intlayer, puedes:
|
|
37
|
+
|
|
38
|
+
- **Gestionar fácilmente las traducciones** usando diccionarios declarativos a nivel de componente.
|
|
39
|
+
- **Localizar dinámicamente metadatos**, rutas y contenido.
|
|
40
|
+
- **Asegurar el soporte de TypeScript** con tipos autogenerados, mejorando el autocompletado y la detección de errores.
|
|
41
|
+
- **Beneficiarte de funciones avanzadas**, como la detección y el cambio dinámico de idioma.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Guía paso a paso para configurar Intlayer en una aplicación Vite y Vanilla JS
|
|
46
|
+
|
|
47
|
+
### Paso 1: Instalar dependencias
|
|
48
|
+
|
|
49
|
+
Instala los paquetes necesarios usando npm:
|
|
50
|
+
|
|
51
|
+
```bash packageManager="npm"
|
|
52
|
+
npm install intlayer vanilla-intlayer
|
|
53
|
+
npm install vite-intlayer --save-dev
|
|
54
|
+
npx intlayer init
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```bash packageManager="pnpm"
|
|
58
|
+
pnpm add intlayer vanilla-intlayer
|
|
59
|
+
pnpm add vite-intlayer --save-dev
|
|
60
|
+
pnpm intlayer init
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash packageManager="yarn"
|
|
64
|
+
yarn add intlayer vanilla-intlayer
|
|
65
|
+
yarn add vite-intlayer --save-dev
|
|
66
|
+
yarn intlayer init
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```bash packageManager="bun"
|
|
70
|
+
bun add intlayer vanilla-intlayer
|
|
71
|
+
bun add vite-intlayer --dev
|
|
72
|
+
bunx intlayer init
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- **intlayer**
|
|
76
|
+
El paquete principal que proporciona herramientas de internacionalización para la gestión de la configuración, traducción, [declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/content_file.md), transpilación y [comandos de CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/cli/index.md).
|
|
77
|
+
|
|
78
|
+
- **vanilla-intlayer**
|
|
79
|
+
El paquete que integra Intlayer con aplicaciones de JavaScript puro / TypeScript. Proporciona un singleton pub/sub (`IntlayerClient`) y ayudantes basados en callbacks (`useIntlayer`, `useLocale`, etc.) para que cualquier parte de tu aplicación pueda reaccionar a los cambios de idioma sin depender de un framework de UI.
|
|
80
|
+
|
|
81
|
+
- **vite-intlayer**
|
|
82
|
+
Incluye el plugin de Vite para integrar Intlayer con el [bundler Vite](https://vite.dev/guide/why.html#why-bundle-for-production), así como middleware para detectar el idioma preferido del usuario, gestionar cookies y manejar la redirección de URL.
|
|
83
|
+
|
|
84
|
+
### Paso 2: Configuración de tu proyecto
|
|
85
|
+
|
|
86
|
+
Crea un archivo de configuración para configurar los idiomas de tu aplicación:
|
|
87
|
+
|
|
88
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
89
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
90
|
+
|
|
91
|
+
const config: IntlayerConfig = {
|
|
92
|
+
internationalization: {
|
|
93
|
+
locales: [
|
|
94
|
+
Locales.ENGLISH,
|
|
95
|
+
Locales.FRENCH,
|
|
96
|
+
Locales.SPANISH,
|
|
97
|
+
// Tus otros idiomas
|
|
98
|
+
],
|
|
99
|
+
defaultLocale: Locales.ENGLISH,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default config;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
107
|
+
import { Locales } from "intlayer";
|
|
108
|
+
|
|
109
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
110
|
+
const config = {
|
|
111
|
+
internationalization: {
|
|
112
|
+
locales: [
|
|
113
|
+
Locales.ENGLISH,
|
|
114
|
+
Locales.FRENCH,
|
|
115
|
+
Locales.SPANISH,
|
|
116
|
+
// Tus otros idiomas
|
|
117
|
+
],
|
|
118
|
+
defaultLocale: Locales.ENGLISH,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export default config;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
126
|
+
const { Locales } = require("intlayer");
|
|
127
|
+
|
|
128
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
129
|
+
const config = {
|
|
130
|
+
internationalization: {
|
|
131
|
+
locales: [
|
|
132
|
+
Locales.ENGLISH,
|
|
133
|
+
Locales.FRENCH,
|
|
134
|
+
Locales.SPANISH,
|
|
135
|
+
// Tus otros idiomas
|
|
136
|
+
],
|
|
137
|
+
defaultLocale: Locales.ENGLISH,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
module.exports = config;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
> A través de este archivo de configuración, puedes configurar URLs localizadas, redirección de middleware, nombres de cookies, la ubicación y extensión de tus declaraciones de contenido, desactivar los registros de Intlayer en la consola y más. Para obtener una lista completa de los parámetros disponibles, consulta la [documentación de configuración](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/configuration.md).
|
|
145
|
+
|
|
146
|
+
### Paso 3: Integrar Intlayer en tu configuración de Vite
|
|
147
|
+
|
|
148
|
+
Añade el plugin de intlayer en tu configuración.
|
|
149
|
+
|
|
150
|
+
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
151
|
+
import { defineConfig } from "vite";
|
|
152
|
+
import { intlayer } from "vite-intlayer";
|
|
153
|
+
|
|
154
|
+
// https://vitejs.dev/config/
|
|
155
|
+
export default defineConfig({
|
|
156
|
+
plugins: [intlayer()],
|
|
157
|
+
});
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
161
|
+
import { defineConfig } from "vite";
|
|
162
|
+
import { intlayer } from "vite-intlayer";
|
|
163
|
+
|
|
164
|
+
// https://vitejs.dev/config/
|
|
165
|
+
export default defineConfig({
|
|
166
|
+
plugins: [intlayer()],
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```javascript fileName="vite.config.cjs" codeFormat="commonjs"
|
|
171
|
+
const { defineConfig } = require("vite");
|
|
172
|
+
const { intlayer } = require("vite-intlayer");
|
|
173
|
+
|
|
174
|
+
// https://vitejs.dev/config/
|
|
175
|
+
module.exports = defineConfig({
|
|
176
|
+
plugins: [intlayer()],
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
> El plugin de Vite `intlayer()` se utiliza para integrar Intlayer con Vite. Asegura la construcción de archivos de declaración de contenido y los monitorea en modo de desarrollo. Define variables de entorno de Intlayer dentro de la aplicación Vite. Además, proporciona alias para optimizar el rendimiento.
|
|
181
|
+
|
|
182
|
+
### Paso 4: Inicializar Intlayer en tu punto de entrada
|
|
183
|
+
|
|
184
|
+
Llama a `installIntlayer()` **antes** de que se renderice cualquier contenido para que el singleton de idioma global esté listo.
|
|
185
|
+
|
|
186
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
187
|
+
import { installIntlayer } from "vanilla-intlayer";
|
|
188
|
+
|
|
189
|
+
// Debe llamarse antes de renderizar cualquier contenido i18n.
|
|
190
|
+
installIntlayer();
|
|
191
|
+
|
|
192
|
+
// Importa y ejecuta tus módulos de aplicación.
|
|
193
|
+
import "./app.js";
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Si también usas declaraciones de contenido `md()` (Markdown), instala también el renderizador de markdown:
|
|
197
|
+
|
|
198
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
199
|
+
import { installIntlayer, installIntlayerMarkdown } from "vanilla-intlayer";
|
|
200
|
+
|
|
201
|
+
installIntlayer();
|
|
202
|
+
installIntlayerMarkdown();
|
|
203
|
+
|
|
204
|
+
import "./app.js";
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Paso 5: Declara tu contenido
|
|
208
|
+
|
|
209
|
+
Crea y gestiona tus declaraciones de contenido para almacenar traducciones:
|
|
210
|
+
|
|
211
|
+
```typescript fileName="src/app.content.ts" contentDeclarationFormat="typescript"
|
|
212
|
+
import { insert, t, type Dictionary } from "intlayer";
|
|
213
|
+
|
|
214
|
+
const appContent = {
|
|
215
|
+
key: "app",
|
|
216
|
+
content: {
|
|
217
|
+
title: "Vite + Vanilla",
|
|
218
|
+
|
|
219
|
+
viteLogoLabel: t({
|
|
220
|
+
en: "Vite Logo",
|
|
221
|
+
fr: "Logo Vite",
|
|
222
|
+
es: "Logo Vite",
|
|
223
|
+
}),
|
|
224
|
+
|
|
225
|
+
count: insert(
|
|
226
|
+
t({
|
|
227
|
+
en: "count is {{count}}",
|
|
228
|
+
fr: "le compte est {{count}}",
|
|
229
|
+
es: "el recuento es {{count}}",
|
|
230
|
+
})
|
|
231
|
+
),
|
|
232
|
+
|
|
233
|
+
readTheDocs: t({
|
|
234
|
+
en: "Click on the Vite logo to learn more",
|
|
235
|
+
fr: "Cliquez sur le logo Vite pour en savoir plus",
|
|
236
|
+
es: "Haga clic en el logotipo de Vite para obtener más información",
|
|
237
|
+
}),
|
|
238
|
+
},
|
|
239
|
+
} satisfies Dictionary;
|
|
240
|
+
|
|
241
|
+
export default appContent;
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
```javascript fileName="src/app.content.mjs" contentDeclarationFormat="esm"
|
|
245
|
+
import { insert, t } from "intlayer";
|
|
246
|
+
|
|
247
|
+
/** @type {import('intlayer').Dictionary} */
|
|
248
|
+
const appContent = {
|
|
249
|
+
key: "app",
|
|
250
|
+
content: {
|
|
251
|
+
title: "Vite + Vanilla",
|
|
252
|
+
|
|
253
|
+
viteLogoLabel: t({
|
|
254
|
+
en: "Vite Logo",
|
|
255
|
+
fr: "Logo Vite",
|
|
256
|
+
es: "Logo Vite",
|
|
257
|
+
}),
|
|
258
|
+
|
|
259
|
+
count: insert(
|
|
260
|
+
t({
|
|
261
|
+
en: "count is {{count}}",
|
|
262
|
+
fr: "le compte est {{count}}",
|
|
263
|
+
es: "el recuento es {{count}}",
|
|
264
|
+
})
|
|
265
|
+
),
|
|
266
|
+
|
|
267
|
+
readTheDocs: t({
|
|
268
|
+
en: "Click on the Vite logo to learn more",
|
|
269
|
+
fr: "Cliquez sur le logo Vite pour en savoir plus",
|
|
270
|
+
es: "Haga clic en el logotipo de Vite para obtener más información",
|
|
271
|
+
}),
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export default appContent;
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
```javascript fileName="src/app.content.cjs" contentDeclarationFormat="commonjs"
|
|
279
|
+
const { insert, t } = require("intlayer");
|
|
280
|
+
|
|
281
|
+
/** @type {import('intlayer').Dictionary} */
|
|
282
|
+
const appContent = {
|
|
283
|
+
key: "app",
|
|
284
|
+
content: {
|
|
285
|
+
title: "Vite + Vanilla",
|
|
286
|
+
|
|
287
|
+
viteLogoLabel: t({
|
|
288
|
+
en: "Vite Logo",
|
|
289
|
+
fr: "Logo Vite",
|
|
290
|
+
es: "Logo Vite",
|
|
291
|
+
}),
|
|
292
|
+
|
|
293
|
+
count: insert(
|
|
294
|
+
t({
|
|
295
|
+
en: "count is {{count}}",
|
|
296
|
+
fr: "le compte est {{count}}",
|
|
297
|
+
es: "el recuento es {{count}}",
|
|
298
|
+
})
|
|
299
|
+
),
|
|
300
|
+
|
|
301
|
+
readTheDocs: t({
|
|
302
|
+
en: "Click on the Vite logo to learn more",
|
|
303
|
+
fr: "Cliquez sur le logo Vite pour en savoir plus",
|
|
304
|
+
es: "Haga clic en el logotipo de Vite para obtener más información",
|
|
305
|
+
}),
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
module.exports = appContent;
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
```json fileName="src/app.content.json" contentDeclarationFormat="json"
|
|
313
|
+
{
|
|
314
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
315
|
+
"key": "app",
|
|
316
|
+
"content": {
|
|
317
|
+
"title": "Vite + Vanilla",
|
|
318
|
+
"viteLogoLabel": {
|
|
319
|
+
"nodeType": "translation",
|
|
320
|
+
"translation": {
|
|
321
|
+
"en": "Vite Logo",
|
|
322
|
+
"fr": "Logo Vite",
|
|
323
|
+
"es": "Logo Vite"
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"count": {
|
|
327
|
+
"nodeType": "insertion",
|
|
328
|
+
"insertion": {
|
|
329
|
+
"nodeType": "translation",
|
|
330
|
+
"translation": {
|
|
331
|
+
"en": "count is {{count}}",
|
|
332
|
+
"fr": "le compte est {{count}}",
|
|
333
|
+
"es": "el recuento es {{count}}"
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"readTheDocs": {
|
|
338
|
+
"nodeType": "translation",
|
|
339
|
+
"translation": {
|
|
340
|
+
"en": "Click on the Vite logo to learn more",
|
|
341
|
+
"fr": "Cliquez sur le logo Vite pour en savoir plus",
|
|
342
|
+
"es": "Haga clic en el logotipo de Vite para obtener más información"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
> Tus declaraciones de contenido pueden definirse en cualquier lugar de tu aplicación, siempre que estén incluidas en el directorio `contentDir` (por defecto, `./src`). Y coincidir con la extensión del archivo de declaración de contenido (por defecto, `.content.{json,ts,tsx,js,jsx,mjs,cjs}`).
|
|
350
|
+
>
|
|
351
|
+
> Para obtener más detalles, consulta la [documentación de declaración de contenido](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/dictionary/content_file.md).
|
|
352
|
+
|
|
353
|
+
### Paso 6: Usar Intlayer en tu JavaScript
|
|
354
|
+
|
|
355
|
+
`vanilla-intlayer` refleja la API de superficie de `react-intlayer`: `useIntlayer(key, locale?)` devuelve el contenido traducido directamente. Encadena `.onChange()` en el resultado para suscribirte a los cambios de idioma — el equivalente explícito de un re-renderizado de React.
|
|
356
|
+
|
|
357
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
358
|
+
import { installIntlayer, useIntlayer } from "vanilla-intlayer";
|
|
359
|
+
|
|
360
|
+
installIntlayer();
|
|
361
|
+
|
|
362
|
+
// Obtener el contenido inicial para el idioma actual.
|
|
363
|
+
// Encadenar .onChange() para ser notificado cada vez que el idioma cambie.
|
|
364
|
+
const content = useIntlayer("app").onChange((newContent) => {
|
|
365
|
+
// Volver a renderizar o parchear solo los nodos DOM afectados
|
|
366
|
+
document.querySelector<HTMLHeadingElement>("h1")!.textContent = String(
|
|
367
|
+
newContent.title
|
|
368
|
+
);
|
|
369
|
+
document.querySelector<HTMLParagraphElement>(".read-the-docs")!.textContent =
|
|
370
|
+
String(newContent.readTheDocs);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
// Renderizado inicial
|
|
374
|
+
document.querySelector<HTMLHeadingElement>("h1")!.textContent = String(
|
|
375
|
+
content.title
|
|
376
|
+
);
|
|
377
|
+
document.querySelector<HTMLParagraphElement>(".read-the-docs")!.textContent =
|
|
378
|
+
String(content.readTheDocs);
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
> Accede a los valores finales como cadenas envolviéndolos en `String()`, que llama al método `toString()` del nodo y devuelve el texto traducido.
|
|
382
|
+
>
|
|
383
|
+
> Cuando necesites el valor para un atributo HTML nativo (por ejemplo, `alt`, `aria-label`), utiliza `.value` directamente:
|
|
384
|
+
>
|
|
385
|
+
> ```typescript
|
|
386
|
+
> img.alt = content.viteLogoLabel.value;
|
|
387
|
+
> ```
|
|
388
|
+
|
|
389
|
+
### (Opcional) Paso 7: Cambiar el idioma de tu contenido
|
|
390
|
+
|
|
391
|
+
Para cambiar el idioma de tu contenido, utiliza la función `setLocale` expuesta por `useLocale`.
|
|
392
|
+
|
|
393
|
+
```typescript fileName="src/locale-switcher.ts" codeFormat="typescript"
|
|
394
|
+
import { getLocaleName } from "intlayer";
|
|
395
|
+
import { useLocale } from "vanilla-intlayer";
|
|
396
|
+
|
|
397
|
+
export function setupLocaleSwitcher(container: HTMLElement): () => void {
|
|
398
|
+
const { locale, availableLocales, setLocale, subscribe } = useLocale();
|
|
399
|
+
|
|
400
|
+
const select = document.createElement("select");
|
|
401
|
+
select.setAttribute("aria-label", "Language");
|
|
402
|
+
|
|
403
|
+
const render = (currentLocale: string) => {
|
|
404
|
+
select.innerHTML = availableLocales
|
|
405
|
+
.map(
|
|
406
|
+
(loc) =>
|
|
407
|
+
`<option value="${loc}"${loc === currentLocale ? " selected" : ""}>
|
|
408
|
+
${getLocaleName(loc)}
|
|
409
|
+
</option>`
|
|
410
|
+
)
|
|
411
|
+
.join("");
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
render(locale);
|
|
415
|
+
container.appendChild(select);
|
|
416
|
+
|
|
417
|
+
select.addEventListener("change", () => setLocale(select.value as any));
|
|
418
|
+
|
|
419
|
+
// Mantener el menú desplegable sincronizado cuando el idioma cambie desde otro lugar
|
|
420
|
+
return subscribe((newLocale) => render(newLocale));
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### (Opcional) Paso 8: Renderizar contenido Markdown y HTML
|
|
425
|
+
|
|
426
|
+
Intlayer admite declaraciones de contenido `md()` y `html()`. En vanilla JS, la salida compilada se inserta como HTML puro a través de `innerHTML`.
|
|
427
|
+
|
|
428
|
+
```typescript fileName="src/app.content.ts" contentDeclarationFormat="typescript"
|
|
429
|
+
import { md, t, type Dictionary } from "intlayer";
|
|
430
|
+
|
|
431
|
+
const appContent = {
|
|
432
|
+
key: "app",
|
|
433
|
+
content: {
|
|
434
|
+
// ...
|
|
435
|
+
editNote: md(
|
|
436
|
+
t({
|
|
437
|
+
en: "Edit `src/main.ts` and save to test **HMR**",
|
|
438
|
+
fr: "Modifiez `src/main.ts` et enregistrez pour tester **HMR**",
|
|
439
|
+
es: "Edite `src/main.ts` y guarde para probar **HMR**",
|
|
440
|
+
})
|
|
441
|
+
),
|
|
442
|
+
},
|
|
443
|
+
} satisfies Dictionary;
|
|
444
|
+
|
|
445
|
+
export default appContent;
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Compila e inyecta el HTML:
|
|
449
|
+
|
|
450
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
451
|
+
import {
|
|
452
|
+
compileMarkdown,
|
|
453
|
+
installIntlayerMarkdown,
|
|
454
|
+
useIntlayer,
|
|
455
|
+
} from "vanilla-intlayer";
|
|
456
|
+
|
|
457
|
+
installIntlayerMarkdown();
|
|
458
|
+
|
|
459
|
+
const content = useIntlayer("app").onChange((newContent) => {
|
|
460
|
+
const el = document.querySelector<HTMLDivElement>(".edit-note")!;
|
|
461
|
+
el.innerHTML = compileMarkdown(String(newContent.editNote));
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
document.querySelector<HTMLDivElement>(".edit-note")!.innerHTML =
|
|
465
|
+
compileMarkdown(String(content.editNote));
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
> [!TIP]
|
|
469
|
+
> `String(content.editNote)` llama a `toString()` en el `IntlayerNode`, que devuelve la cadena Markdown pura. Pásala a `compileMarkdown` para obtener una cadena HTML, luego configúrala a través de `innerHTML`.
|
|
470
|
+
|
|
471
|
+
> [!WARNING]
|
|
472
|
+
> Solo usa `innerHTML` con contenido de confianza. Si el markdown proviene de la entrada del usuario, desinféctalo primero (por ejemplo, con DOMPurify). Puedes instalar un renderizador de desinfección dinámicamente:
|
|
473
|
+
>
|
|
474
|
+
> ```typescript
|
|
475
|
+
> import { installIntlayerMarkdownDynamic } from "vanilla-intlayer";
|
|
476
|
+
>
|
|
477
|
+
> await installIntlayerMarkdownDynamic(async () => {
|
|
478
|
+
> const DOMPurify = await import("dompurify");
|
|
479
|
+
> return (markdown) => DOMPurify.sanitize(compileMarkdown(markdown));
|
|
480
|
+
> });
|
|
481
|
+
> ```
|
|
482
|
+
|
|
483
|
+
### (Opcional) Paso 9: Añadir enrutamiento localizado a tu aplicación
|
|
484
|
+
|
|
485
|
+
Para crear rutas únicas para cada idioma (útil para el SEO), puedes usar `intlayerProxy` en tu configuración de Vite para la detección del idioma en el lado del servidor.
|
|
486
|
+
|
|
487
|
+
Primero, añade `intlayerProxy` a tu configuración de Vite:
|
|
488
|
+
|
|
489
|
+
> Ten en cuenta que para usar `intlayerProxy` en producción, necesitas mover `vite-intlayer` de `devDependencies` a `dependencies`.
|
|
490
|
+
|
|
491
|
+
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
492
|
+
import { defineConfig } from "vite";
|
|
493
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
494
|
+
|
|
495
|
+
export default defineConfig({
|
|
496
|
+
plugins: [
|
|
497
|
+
intlayerProxy(), // debe colocarse primero
|
|
498
|
+
intlayer(),
|
|
499
|
+
],
|
|
500
|
+
});
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
504
|
+
import { defineConfig } from "vite";
|
|
505
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
506
|
+
|
|
507
|
+
export default defineConfig({
|
|
508
|
+
plugins: [
|
|
509
|
+
intlayerProxy(), // debe colocarse primero
|
|
510
|
+
intlayer(),
|
|
511
|
+
],
|
|
512
|
+
});
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
516
|
+
const { defineConfig } = require("vite");
|
|
517
|
+
const { intlayer, intlayerProxy } = require("vite-intlayer");
|
|
518
|
+
|
|
519
|
+
module.exports = defineConfig({
|
|
520
|
+
plugins: [
|
|
521
|
+
intlayerProxy(), // debe colocarse primero
|
|
522
|
+
intlayer(),
|
|
523
|
+
],
|
|
524
|
+
});
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### (Opcional) Paso 10: Cambiar la URL cuando cambie el idioma
|
|
528
|
+
|
|
529
|
+
Para actualizar la URL del navegador cuando cambie el idioma, llama a `useRewriteURL()` después de instalar Intlayer:
|
|
530
|
+
|
|
531
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
532
|
+
import { installIntlayer, useRewriteURL } from "vanilla-intlayer";
|
|
533
|
+
|
|
534
|
+
installIntlayer();
|
|
535
|
+
|
|
536
|
+
// Sobrescribe la URL inmediatamente y en cada cambio de idioma posterior.
|
|
537
|
+
// Devuelve una función de cancelación de suscripción para la limpieza.
|
|
538
|
+
const stopRewriteURL = useRewriteURL();
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### (Opcional) Paso 11: Cambiar los atributos de idioma y dirección de HTML
|
|
542
|
+
|
|
543
|
+
Actualiza los atributos `lang` y `dir` de la etiqueta `<html>` para que coincidan con el idioma actual para la accesibilidad y el SEO.
|
|
544
|
+
|
|
545
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
546
|
+
import { getHTMLTextDir } from "intlayer";
|
|
547
|
+
import { installIntlayer, useLocale } from "vanilla-intlayer";
|
|
548
|
+
|
|
549
|
+
installIntlayer();
|
|
550
|
+
|
|
551
|
+
useLocale({
|
|
552
|
+
onLocaleChange: (locale) => {
|
|
553
|
+
document.documentElement.lang = locale;
|
|
554
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
555
|
+
},
|
|
556
|
+
});
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### (Opcional) Paso 12: Carga diferida de diccionarios por idioma
|
|
560
|
+
|
|
561
|
+
Para aplicaciones grandes, es posible que desees dividir el diccionario de cada idioma en su propio fragmento. Usa `useDictionaryDynamic` junto con el `import()` dinámico de Vite:
|
|
562
|
+
|
|
563
|
+
```typescript fileName="src/app.ts" codeFormat="typescript"
|
|
564
|
+
import { installIntlayer, useDictionaryDynamic } from "vanilla-intlayer";
|
|
565
|
+
|
|
566
|
+
installIntlayer();
|
|
567
|
+
|
|
568
|
+
const unsubscribe = useDictionaryDynamic(
|
|
569
|
+
{
|
|
570
|
+
en: () => import("../.intlayer/dictionaries/en/app.mjs"),
|
|
571
|
+
fr: () => import("../.intlayer/dictionaries/fr/app.mjs"),
|
|
572
|
+
es: () => import("../.intlayer/dictionaries/es/app.mjs"),
|
|
573
|
+
},
|
|
574
|
+
"app"
|
|
575
|
+
).onChange((content) => {
|
|
576
|
+
document.querySelector("h1")!.textContent = String(content.title);
|
|
577
|
+
});
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
> El paquete de cada idioma se recupera solo cuando ese idioma se activa y el resultado se almacena en caché; los cambios posteriores al mismo idioma son instantáneos.
|
|
581
|
+
|
|
582
|
+
### (Opcional) Paso 13: Extraer el contenido de tus componentes
|
|
583
|
+
|
|
584
|
+
Si tienes una base de código existente, transformar miles de archivos puede llevar mucho tiempo.
|
|
585
|
+
|
|
586
|
+
Para facilitar este proceso, Intlayer propone un [compilador](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/compiler.md) / [extractor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/cli/extract.md) para transformar tus componentes y extraer el contenido.
|
|
587
|
+
|
|
588
|
+
Para configurarlo, puedes añadir una sección `compiler` en tu archivo `intlayer.config.ts`:
|
|
589
|
+
|
|
590
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
591
|
+
import { type IntlayerConfig } from "intlayer";
|
|
592
|
+
|
|
593
|
+
const config: IntlayerConfig = {
|
|
594
|
+
// ... Resto de tu config
|
|
595
|
+
compiler: {
|
|
596
|
+
/**
|
|
597
|
+
* Indica si el compilador debe estar habilitado.
|
|
598
|
+
*/
|
|
599
|
+
enabled: true,
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Define la ruta de los archivos de salida
|
|
603
|
+
*/
|
|
604
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Indica si los componentes deben guardarse después de ser transformados.
|
|
608
|
+
* De esa manera, el compilador puede ejecutarse solo una vez para transformar la aplicación y luego puede eliminarse.
|
|
609
|
+
*/
|
|
610
|
+
saveComponents: false,
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Prefijo de clave de diccionario
|
|
614
|
+
*/
|
|
615
|
+
dictionaryKeyPrefix: "",
|
|
616
|
+
},
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
export default config;
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
<Tabs>
|
|
623
|
+
<Tab value='Comando Extract'>
|
|
624
|
+
|
|
625
|
+
Ejecuta el extractor para transformar tus componentes y extraer el contenido
|
|
626
|
+
|
|
627
|
+
```bash packageManager="npm"
|
|
628
|
+
npx intlayer extract
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
```bash packageManager="pnpm"
|
|
632
|
+
pnpm intlayer extract
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
```bash packageManager="yarn"
|
|
636
|
+
yarn intlayer extract
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
```bash packageManager="bun"
|
|
640
|
+
bunx intlayer extract
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
</Tab>
|
|
644
|
+
<Tab value='Compilador Babel'>
|
|
645
|
+
|
|
646
|
+
Actualiza tu `vite.config.ts` para incluir el plugin `intlayerCompiler`:
|
|
647
|
+
|
|
648
|
+
```ts fileName="vite.config.ts"
|
|
649
|
+
import { defineConfig } from "vite";
|
|
650
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
651
|
+
|
|
652
|
+
export default defineConfig({
|
|
653
|
+
plugins: [
|
|
654
|
+
intlayer(),
|
|
655
|
+
intlayerCompiler(), // Añade el plugin del compilador
|
|
656
|
+
],
|
|
657
|
+
});
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
```bash packageManager="npm"
|
|
661
|
+
npm run build # O npm run dev
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
```bash packageManager="pnpm"
|
|
665
|
+
pnpm run build # O pnpm run dev
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
```bash packageManager="yarn"
|
|
669
|
+
yarn build # O yarn dev
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
```bash packageManager="bun"
|
|
673
|
+
bun run build # O bun run dev
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
</Tab>
|
|
677
|
+
</Tabs>
|
|
678
|
+
|
|
679
|
+
### Configurar TypeScript
|
|
680
|
+
|
|
681
|
+
Asegúrate de que tu configuración de TypeScript incluya los tipos autogenerados.
|
|
682
|
+
|
|
683
|
+
```json5 fileName="tsconfig.json"
|
|
684
|
+
{
|
|
685
|
+
"compilerOptions": {
|
|
686
|
+
// ...
|
|
687
|
+
},
|
|
688
|
+
"include": ["src", ".intlayer/**/*.ts"],
|
|
689
|
+
}
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### Configuración de Git
|
|
693
|
+
|
|
694
|
+
Se recomienda ignorar los archivos generados por Intlayer. Esto te permite evitar enviarlos a tu repositorio de Git.
|
|
695
|
+
|
|
696
|
+
Para hacer esto, puedes añadir las siguientes instrucciones a tu archivo `.gitignore`:
|
|
697
|
+
|
|
698
|
+
```bash
|
|
699
|
+
# Ignorar los archivos generados por Intlayer
|
|
700
|
+
.intlayer
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
### Extensión de VS Code
|
|
704
|
+
|
|
705
|
+
Para mejorar tu experiencia de desarrollo con Intlayer, puedes instalar la **Extensión oficial de Intlayer para VS Code**.
|
|
706
|
+
|
|
707
|
+
[Instalar desde el VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
708
|
+
|
|
709
|
+
Esta extensión proporciona:
|
|
710
|
+
|
|
711
|
+
- **Autocompletado** para claves de traducción.
|
|
712
|
+
- **Detección de errores en tiempo real** para traducciones faltantes.
|
|
713
|
+
- **Vistas previas en línea** del contenido traducido.
|
|
714
|
+
- **Acciones rápidas** para crear y actualizar traducciones fácilmente.
|
|
715
|
+
|
|
716
|
+
Para obtener más detalles sobre cómo usar la extensión, consulta la [documentación de la Extensión de Intlayer para VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
### Ir más allá
|
|
721
|
+
|
|
722
|
+
Para ir más allá, puedes implementar el [editor visual](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/intlayer_visual_editor.md) o externalizar tu contenido usando el [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/intlayer_CMS.md).
|