@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,750 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2026-03-23
|
|
3
|
+
updatedAt: 2026-03-23
|
|
4
|
+
title: Vite + Lit i18n - How to translate a Lit app in 2026
|
|
5
|
+
description: Discover how to make your Vite and Lit website multilingual. Follow the documentation to internationalize (i18n) and translate it.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internationalization
|
|
8
|
+
- Documentation
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Vite
|
|
11
|
+
- Lit
|
|
12
|
+
- Web Components
|
|
13
|
+
- JavaScript
|
|
14
|
+
slugs:
|
|
15
|
+
- doc
|
|
16
|
+
- environment
|
|
17
|
+
- vite-and-lit
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-lit-template
|
|
19
|
+
history:
|
|
20
|
+
- version: 8.4.10
|
|
21
|
+
date: 2026-03-23
|
|
22
|
+
changes: "Init history"
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Translate your Vite and Lit website using Intlayer | Internationalization (i18n)
|
|
26
|
+
|
|
27
|
+
## Table of Contents
|
|
28
|
+
|
|
29
|
+
<TOC/>
|
|
30
|
+
|
|
31
|
+
## What is Intlayer?
|
|
32
|
+
|
|
33
|
+
**Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
|
|
34
|
+
|
|
35
|
+
With Intlayer, you can:
|
|
36
|
+
|
|
37
|
+
- **Easily manage translations** using declarative dictionaries at the component level.
|
|
38
|
+
- **Dynamically localize metadata**, routes, and content.
|
|
39
|
+
- **Ensure TypeScript support** with autogenerated types, improving autocompletion and error detection.
|
|
40
|
+
- **Benefit from advanced features**, like dynamic locale detection and switching.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Step-by-Step Guide to Set Up Intlayer in a Vite and Lit Application
|
|
45
|
+
|
|
46
|
+
### Step 1: Install Dependencies
|
|
47
|
+
|
|
48
|
+
Install the necessary packages using npm:
|
|
49
|
+
|
|
50
|
+
```bash packageManager="npm"
|
|
51
|
+
npm install intlayer lit-intlayer
|
|
52
|
+
npm install vite-intlayer --save-dev
|
|
53
|
+
npx intlayer init
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash packageManager="pnpm"
|
|
57
|
+
pnpm add intlayer lit-intlayer
|
|
58
|
+
pnpm add vite-intlayer --save-dev
|
|
59
|
+
pnpm intlayer init
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```bash packageManager="yarn"
|
|
63
|
+
yarn add intlayer lit-intlayer
|
|
64
|
+
yarn add vite-intlayer --save-dev
|
|
65
|
+
yarn intlayer init
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```bash packageManager="bun"
|
|
69
|
+
bun add intlayer lit-intlayer
|
|
70
|
+
bun add vite-intlayer --dev
|
|
71
|
+
bunx intlayer init
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- **intlayer**
|
|
75
|
+
|
|
76
|
+
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/cli/index.md).
|
|
77
|
+
|
|
78
|
+
- **lit-intlayer**
|
|
79
|
+
The package that integrates Intlayer with Lit applications. It provides `ReactiveController`-based hooks (`useIntlayer`, `useLocale`, etc.) so that LitElements automatically re-render when the locale changes.
|
|
80
|
+
|
|
81
|
+
- **vite-intlayer**
|
|
82
|
+
Includes the Vite plugin for integrating Intlayer with the [Vite bundler](https://vite.dev/guide/why.html#why-bundle-for-production), as well as middleware for detecting the user's preferred locale, managing cookies, and handling URL redirection.
|
|
83
|
+
|
|
84
|
+
### Step 2: Configuration of your project
|
|
85
|
+
|
|
86
|
+
Create a config file to configure the languages of your application:
|
|
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
|
+
// Your other locales
|
|
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
|
+
// Your other locales
|
|
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
|
+
// Your other locales
|
|
136
|
+
],
|
|
137
|
+
defaultLocale: Locales.ENGLISH,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
module.exports = config;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
> Through this configuration file, you can set up localized URLs, middleware redirection, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md).
|
|
145
|
+
|
|
146
|
+
### Step 3: Integrate Intlayer in Your Vite Configuration
|
|
147
|
+
|
|
148
|
+
Add the intlayer plugin into your configuration.
|
|
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
|
+
> The `intlayer()` Vite plugin is used to integrate Intlayer with Vite. It ensures the building of content declaration files and monitors them in development mode. It defines Intlayer environment variables within the Vite application. Additionally, it provides aliases to optimize performance.
|
|
181
|
+
|
|
182
|
+
### Step 4: Bootstrap Intlayer in your entry point
|
|
183
|
+
|
|
184
|
+
Call `installIntlayer()` **before** any custom elements are registered so that the global locale singleton is ready when the first element connects.
|
|
185
|
+
|
|
186
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
187
|
+
import { installIntlayer } from "lit-intlayer";
|
|
188
|
+
|
|
189
|
+
// Must be called before any LitElement is connected to the DOM.
|
|
190
|
+
installIntlayer();
|
|
191
|
+
|
|
192
|
+
// Import and register your custom elements.
|
|
193
|
+
import "./my-element.js";
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
If you also use `md()` content declarations (Markdown), install the markdown renderer as well:
|
|
197
|
+
|
|
198
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
199
|
+
import { installIntlayer, installIntlayerMarkdown } from "lit-intlayer";
|
|
200
|
+
|
|
201
|
+
installIntlayer();
|
|
202
|
+
installIntlayerMarkdown();
|
|
203
|
+
|
|
204
|
+
import "./my-element.js";
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Step 5: Declare Your Content
|
|
208
|
+
|
|
209
|
+
Create and manage your content declarations to store translations:
|
|
210
|
+
|
|
211
|
+
```typescript fileName="src/app.content.ts" contentDeclarationFormat="typescript"
|
|
212
|
+
import { t, type Dictionary } from "intlayer";
|
|
213
|
+
|
|
214
|
+
const appContent = {
|
|
215
|
+
key: "app",
|
|
216
|
+
content: {
|
|
217
|
+
title: "Vite + Lit",
|
|
218
|
+
|
|
219
|
+
viteLogo: t({
|
|
220
|
+
en: "Vite logo",
|
|
221
|
+
fr: "Logo Vite",
|
|
222
|
+
es: "Logo Vite",
|
|
223
|
+
}),
|
|
224
|
+
litLogo: t({
|
|
225
|
+
en: "Lit logo",
|
|
226
|
+
fr: "Logo Lit",
|
|
227
|
+
es: "Logo Lit",
|
|
228
|
+
}),
|
|
229
|
+
|
|
230
|
+
count: t({
|
|
231
|
+
en: "count is {{count}}",
|
|
232
|
+
fr: "le compte est {{count}}",
|
|
233
|
+
es: "el recuento es {{count}}",
|
|
234
|
+
}),
|
|
235
|
+
|
|
236
|
+
readTheDocs: t({
|
|
237
|
+
en: "Click on the Vite and Lit logos to learn more",
|
|
238
|
+
fr: "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
239
|
+
es: "Haga clic en los logotipos de Vite y Lit para obtener más información",
|
|
240
|
+
}),
|
|
241
|
+
},
|
|
242
|
+
} satisfies Dictionary;
|
|
243
|
+
|
|
244
|
+
export default appContent;
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```javascript fileName="src/app.content.mjs" contentDeclarationFormat="esm"
|
|
248
|
+
import { t } from "intlayer";
|
|
249
|
+
|
|
250
|
+
/** @type {import('intlayer').Dictionary} */
|
|
251
|
+
const appContent = {
|
|
252
|
+
key: "app",
|
|
253
|
+
content: {
|
|
254
|
+
title: "Vite + Lit",
|
|
255
|
+
|
|
256
|
+
viteLogo: t({
|
|
257
|
+
en: "Vite logo",
|
|
258
|
+
fr: "Logo Vite",
|
|
259
|
+
es: "Logo Vite",
|
|
260
|
+
}),
|
|
261
|
+
litLogo: t({
|
|
262
|
+
en: "Lit logo",
|
|
263
|
+
fr: "Logo Lit",
|
|
264
|
+
es: "Logo Lit",
|
|
265
|
+
}),
|
|
266
|
+
|
|
267
|
+
count: t({
|
|
268
|
+
en: "count is {{count}}",
|
|
269
|
+
fr: "le compte est {{count}}",
|
|
270
|
+
es: "el recuento es {{count}}",
|
|
271
|
+
}),
|
|
272
|
+
|
|
273
|
+
readTheDocs: t({
|
|
274
|
+
en: "Click on the Vite and Lit logos to learn more",
|
|
275
|
+
fr: "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
276
|
+
es: "Haga clic en los logotipos de Vite y Lit para obtener más información",
|
|
277
|
+
}),
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export default appContent;
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
```javascript fileName="src/app.content.cjs" contentDeclarationFormat="commonjs"
|
|
285
|
+
const { t } = require("intlayer");
|
|
286
|
+
|
|
287
|
+
/** @type {import('intlayer').Dictionary} */
|
|
288
|
+
const appContent = {
|
|
289
|
+
key: "app",
|
|
290
|
+
content: {
|
|
291
|
+
title: "Vite + Lit",
|
|
292
|
+
|
|
293
|
+
viteLogo: t({
|
|
294
|
+
en: "Vite logo",
|
|
295
|
+
fr: "Logo Vite",
|
|
296
|
+
es: "Logo Vite",
|
|
297
|
+
}),
|
|
298
|
+
litLogo: t({
|
|
299
|
+
en: "Lit logo",
|
|
300
|
+
fr: "Logo Lit",
|
|
301
|
+
es: "Logo Lit",
|
|
302
|
+
}),
|
|
303
|
+
|
|
304
|
+
count: t({
|
|
305
|
+
en: "count is {{count}}",
|
|
306
|
+
fr: "le compte est {{count}}",
|
|
307
|
+
es: "el recuento es {{count}}",
|
|
308
|
+
}),
|
|
309
|
+
|
|
310
|
+
readTheDocs: t({
|
|
311
|
+
en: "Click on the Vite and Lit logos to learn more",
|
|
312
|
+
fr: "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
313
|
+
es: "Haga clic en los logotipos de Vite y Lit para obtener más información",
|
|
314
|
+
}),
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
module.exports = appContent;
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
```json fileName="src/app.content.json" contentDeclarationFormat="json"
|
|
322
|
+
{
|
|
323
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
324
|
+
"key": "app",
|
|
325
|
+
"content": {
|
|
326
|
+
"title": "Vite + Lit",
|
|
327
|
+
"viteLogo": {
|
|
328
|
+
"nodeType": "translation",
|
|
329
|
+
"translation": {
|
|
330
|
+
"en": "Vite logo",
|
|
331
|
+
"fr": "Logo Vite",
|
|
332
|
+
"es": "Logo Vite"
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
"litLogo": {
|
|
336
|
+
"nodeType": "translation",
|
|
337
|
+
"translation": {
|
|
338
|
+
"en": "Lit logo",
|
|
339
|
+
"fr": "Logo Lit",
|
|
340
|
+
"es": "Logo Lit"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"count": {
|
|
344
|
+
"nodeType": "translation",
|
|
345
|
+
"translation": {
|
|
346
|
+
"en": "count is {{count}}",
|
|
347
|
+
"fr": "le compte est {{count}}",
|
|
348
|
+
"es": "el recuento es {{count}}"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"readTheDocs": {
|
|
352
|
+
"nodeType": "translation",
|
|
353
|
+
"translation": {
|
|
354
|
+
"en": "Click on the Vite and Lit logos to learn more",
|
|
355
|
+
"fr": "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
356
|
+
"es": "Haga clic en los logotipos de Vite y Lit para obtener más información"
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
> Your content declarations can be defined anywhere in your application as soon as they are included in the `contentDir` directory (by default, `./src`). And match the content declaration file extension (by default, `.content.{json,ts,tsx,js,jsx,mjs,cjs}`).
|
|
364
|
+
>
|
|
365
|
+
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
366
|
+
|
|
367
|
+
### Step 6: Utilize Intlayer in Your LitElement
|
|
368
|
+
|
|
369
|
+
Use `useIntlayer` inside a `LitElement`. It returns a `ReactiveController` proxy that automatically triggers re-renders whenever the active locale changes — no extra setup required.
|
|
370
|
+
|
|
371
|
+
```typescript fileName="src/my-element.ts" codeFormat="typescript"
|
|
372
|
+
import { LitElement, html } from "lit";
|
|
373
|
+
import { customElement, property } from "lit/decorators.js";
|
|
374
|
+
import { useIntlayer } from "lit-intlayer";
|
|
375
|
+
|
|
376
|
+
@customElement("my-element")
|
|
377
|
+
export class MyElement extends LitElement {
|
|
378
|
+
@property({ type: Number })
|
|
379
|
+
count = 0;
|
|
380
|
+
|
|
381
|
+
// useIntlayer registers itself as a ReactiveController.
|
|
382
|
+
// The element re-renders automatically when the locale changes.
|
|
383
|
+
private content = useIntlayer(this, "app");
|
|
384
|
+
|
|
385
|
+
override render() {
|
|
386
|
+
const { content } = this;
|
|
387
|
+
|
|
388
|
+
return html`
|
|
389
|
+
<h1>${content.title}</h1>
|
|
390
|
+
|
|
391
|
+
<img src="/vite.svg" alt=${content.viteLogo.value} />
|
|
392
|
+
<img src="/lit.svg" alt=${content.litLogo.value} />
|
|
393
|
+
|
|
394
|
+
<button @click=${() => this.count++}>
|
|
395
|
+
${content.count({ count: this.count })}
|
|
396
|
+
</button>
|
|
397
|
+
|
|
398
|
+
<p>${content.readTheDocs}</p>
|
|
399
|
+
`;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
> [!NOTE]
|
|
405
|
+
> When you need the translated string in a native HTML attribute (e.g. `alt`, `aria-label`, `title`), call `.value` on the leaf node:
|
|
406
|
+
>
|
|
407
|
+
> ```typescript
|
|
408
|
+
> html`<img alt=${content.viteLogo.value} />`;
|
|
409
|
+
> ```
|
|
410
|
+
|
|
411
|
+
### (Optional) Step 7: Change the language of your content
|
|
412
|
+
|
|
413
|
+
To change the language of your content, use the `setLocale` method exposed by the `useLocale` controller.
|
|
414
|
+
|
|
415
|
+
```typescript fileName="src/locale-switcher.ts" codeFormat="typescript"
|
|
416
|
+
import { LitElement, html } from "lit";
|
|
417
|
+
import { customElement } from "lit/decorators.js";
|
|
418
|
+
import { getLocaleName } from "intlayer";
|
|
419
|
+
import { useLocale } from "lit-intlayer";
|
|
420
|
+
|
|
421
|
+
@customElement("locale-switcher")
|
|
422
|
+
export class LocaleSwitcher extends LitElement {
|
|
423
|
+
private locale = useLocale(this);
|
|
424
|
+
|
|
425
|
+
private _onChange(e: Event) {
|
|
426
|
+
const select = e.target as HTMLSelectElement;
|
|
427
|
+
this.locale.setLocale(select.value as any);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
override render() {
|
|
431
|
+
return html`
|
|
432
|
+
<select @change=${this._onChange}>
|
|
433
|
+
${this.locale.availableLocales.map(
|
|
434
|
+
(loc) => html`
|
|
435
|
+
<option value=${loc} ?selected=${loc === this.locale.locale}>
|
|
436
|
+
${getLocaleName(loc)}
|
|
437
|
+
</option>
|
|
438
|
+
`
|
|
439
|
+
)}
|
|
440
|
+
</select>
|
|
441
|
+
`;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### (Optional) Step 8: Render Markdown and HTML content
|
|
447
|
+
|
|
448
|
+
Intlayer supports `md()` and `html()` content declarations. In Lit, compiled output is injected as raw HTML via the `unsafeHTML` directive.
|
|
449
|
+
|
|
450
|
+
```typescript fileName="src/app.content.ts" contentDeclarationFormat="typescript"
|
|
451
|
+
import { md, t, type Dictionary } from "intlayer";
|
|
452
|
+
|
|
453
|
+
const appContent = {
|
|
454
|
+
key: "app",
|
|
455
|
+
content: {
|
|
456
|
+
// ...
|
|
457
|
+
editNote: md(
|
|
458
|
+
t({
|
|
459
|
+
en: "Edit `src/my-element.ts` and save to test **HMR**",
|
|
460
|
+
fr: "Modifiez `src/my-element.ts` et enregistrez pour tester **HMR**",
|
|
461
|
+
es: "Edite `src/my-element.ts` y guarde para probar **HMR**",
|
|
462
|
+
})
|
|
463
|
+
),
|
|
464
|
+
},
|
|
465
|
+
} satisfies Dictionary;
|
|
466
|
+
|
|
467
|
+
export default appContent;
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Render the compiled HTML in your element:
|
|
471
|
+
|
|
472
|
+
```typescript fileName="src/my-element.ts" codeFormat="typescript"
|
|
473
|
+
import { LitElement, html } from "lit";
|
|
474
|
+
import { customElement } from "lit/decorators.js";
|
|
475
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
476
|
+
import { useIntlayer } from "lit-intlayer";
|
|
477
|
+
import { compileMarkdown } from "lit-intlayer/markdown";
|
|
478
|
+
|
|
479
|
+
@customElement("my-element")
|
|
480
|
+
export class MyElement extends LitElement {
|
|
481
|
+
private content = useIntlayer(this, "app");
|
|
482
|
+
|
|
483
|
+
override render() {
|
|
484
|
+
return html`
|
|
485
|
+
<div class="edit-note">
|
|
486
|
+
${unsafeHTML(compileMarkdown(String(this.content.editNote)))}
|
|
487
|
+
</div>
|
|
488
|
+
`;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
> [!TIP]
|
|
494
|
+
> `String(content.editNote)` calls `toString()` on the `IntlayerNode`, which returns the raw Markdown string. Pass it to `compileMarkdown` to get an HTML string, then render it with Lit's `unsafeHTML` directive.
|
|
495
|
+
|
|
496
|
+
### (Optional) Step 9: Add localized Routing to your application
|
|
497
|
+
|
|
498
|
+
To make unique routes for each language (useful for SEO), you can use a client-side router alongside Intlayer's `localeMap` / `localeFlatMap` helpers, and the `intlayerProxy` Vite plugin for server-side locale detection.
|
|
499
|
+
|
|
500
|
+
First, add `intlayerProxy` to your Vite config:
|
|
501
|
+
|
|
502
|
+
> Note that to use `intlayerProxy` in production, you need to move `vite-intlayer` from `devDependencies` to `dependencies`.
|
|
503
|
+
|
|
504
|
+
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
505
|
+
import { defineConfig } from "vite";
|
|
506
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
507
|
+
|
|
508
|
+
export default defineConfig({
|
|
509
|
+
plugins: [
|
|
510
|
+
intlayerProxy(), // should be placed first
|
|
511
|
+
intlayer(),
|
|
512
|
+
],
|
|
513
|
+
});
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
517
|
+
import { defineConfig } from "vite";
|
|
518
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
519
|
+
|
|
520
|
+
export default defineConfig({
|
|
521
|
+
plugins: [
|
|
522
|
+
intlayerProxy(), // should be placed first
|
|
523
|
+
intlayer(),
|
|
524
|
+
],
|
|
525
|
+
});
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
529
|
+
const { defineConfig } = require("vite");
|
|
530
|
+
const { intlayer, intlayerProxy } = require("vite-intlayer");
|
|
531
|
+
|
|
532
|
+
module.exports = defineConfig({
|
|
533
|
+
plugins: [
|
|
534
|
+
intlayerProxy(), // should be placed first
|
|
535
|
+
intlayer(),
|
|
536
|
+
],
|
|
537
|
+
});
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
### (Optional) Step 10: Change the URL when the locale changes
|
|
541
|
+
|
|
542
|
+
To update the browser URL when the locale changes, use `useRewriteURL` alongside the locale switcher:
|
|
543
|
+
|
|
544
|
+
```typescript fileName="src/locale-switcher.ts" codeFormat="typescript"
|
|
545
|
+
import { LitElement, html } from "lit";
|
|
546
|
+
import { customElement } from "lit/decorators.js";
|
|
547
|
+
import { getLocaleName, getLocalizedUrl } from "intlayer";
|
|
548
|
+
import { useLocale, useRewriteURL } from "lit-intlayer";
|
|
549
|
+
|
|
550
|
+
@customElement("locale-switcher")
|
|
551
|
+
export class LocaleSwitcher extends LitElement {
|
|
552
|
+
private locale = useLocale(this);
|
|
553
|
+
|
|
554
|
+
// Automatically rewrites the current URL when the locale changes.
|
|
555
|
+
private _rewriteURL = useRewriteURL(this);
|
|
556
|
+
|
|
557
|
+
private _onChange(e: Event) {
|
|
558
|
+
const select = e.target as HTMLSelectElement;
|
|
559
|
+
this.locale.setLocale(select.value as any);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
override render() {
|
|
563
|
+
return html`
|
|
564
|
+
<select @change=${this._onChange}>
|
|
565
|
+
${this.locale.availableLocales.map(
|
|
566
|
+
(loc) => html`
|
|
567
|
+
<option value=${loc} ?selected=${loc === this.locale.locale}>
|
|
568
|
+
${getLocaleName(loc)}
|
|
569
|
+
</option>
|
|
570
|
+
`
|
|
571
|
+
)}
|
|
572
|
+
</select>
|
|
573
|
+
`;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### (Optional) Step 11: Switch the HTML Language and Direction Attributes
|
|
579
|
+
|
|
580
|
+
Update the `<html>` tag's `lang` and `dir` attributes to match the current locale for accessibility and SEO.
|
|
581
|
+
|
|
582
|
+
```typescript fileName="src/my-element.ts" codeFormat="typescript"
|
|
583
|
+
import { LitElement, html } from "lit";
|
|
584
|
+
import { customElement } from "lit/decorators.js";
|
|
585
|
+
import { getHTMLTextDir } from "intlayer";
|
|
586
|
+
import { useLocale } from "lit-intlayer";
|
|
587
|
+
|
|
588
|
+
@customElement("my-element")
|
|
589
|
+
export class MyElement extends LitElement {
|
|
590
|
+
private locale = useLocale(this, {
|
|
591
|
+
onLocaleChange: (loc) => {
|
|
592
|
+
document.documentElement.lang = loc;
|
|
593
|
+
document.documentElement.dir = getHTMLTextDir(loc);
|
|
594
|
+
},
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
override render() {
|
|
598
|
+
return html`<!-- your content -->`;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### (Optional) Step 12: Extract the content of your components
|
|
604
|
+
|
|
605
|
+
If you have an existing codebase, transforming thousands of files can be time-consuming.
|
|
606
|
+
|
|
607
|
+
To ease this process, Intlayer proposes a [compiler](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/compiler.md) / [extractor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/cli/extract.md) to transform your components and extract the content.
|
|
608
|
+
|
|
609
|
+
To set it up, you can add a `compiler` section in your `intlayer.config.ts` file:
|
|
610
|
+
|
|
611
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
612
|
+
import { type IntlayerConfig } from "intlayer";
|
|
613
|
+
|
|
614
|
+
const config: IntlayerConfig = {
|
|
615
|
+
// ... Rest of your config
|
|
616
|
+
compiler: {
|
|
617
|
+
/**
|
|
618
|
+
* Indicates if the compiler should be enabled.
|
|
619
|
+
*/
|
|
620
|
+
enabled: true,
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Defines the output files path
|
|
624
|
+
*/
|
|
625
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Indicates if the components should be saved after being transformed.
|
|
629
|
+
*
|
|
630
|
+
* - If `true`, the compiler will rewrite the component file in the disk. So the transformation will be permanent, and the compiler will skip the transformation for the next process. That way, the compiler can transform the app, and then it can be removed.
|
|
631
|
+
*
|
|
632
|
+
* - If `false`, the compiler will inject the `useIntlayer()` function call into the code in the build output only, and keep the base codebase intact. The transformation will be done only in memory.
|
|
633
|
+
*/
|
|
634
|
+
saveComponents: false,
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Dictionary key prefix
|
|
638
|
+
*/
|
|
639
|
+
dictionaryKeyPrefix: "",
|
|
640
|
+
},
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
export default config;
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
<Tabs>
|
|
647
|
+
<Tab value='Extract command'>
|
|
648
|
+
|
|
649
|
+
Run the extractor to transform your components and extract the content
|
|
650
|
+
|
|
651
|
+
```bash packageManager="npm"
|
|
652
|
+
npx intlayer extract
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
```bash packageManager="pnpm"
|
|
656
|
+
pnpm intlayer extract
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
```bash packageManager="yarn"
|
|
660
|
+
yarn intlayer extract
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
```bash packageManager="bun"
|
|
664
|
+
bunx intlayer extract
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
</Tab>
|
|
668
|
+
<Tab value='Babel compiler'>
|
|
669
|
+
|
|
670
|
+
Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
|
|
671
|
+
|
|
672
|
+
```ts fileName="vite.config.ts"
|
|
673
|
+
import { defineConfig } from "vite";
|
|
674
|
+
import { intlayer, intlayerCompiler } from "vite-intlayer";
|
|
675
|
+
|
|
676
|
+
export default defineConfig({
|
|
677
|
+
plugins: [
|
|
678
|
+
intlayer(),
|
|
679
|
+
intlayerCompiler(), // Adds the compiler plugin
|
|
680
|
+
],
|
|
681
|
+
});
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
```bash packageManager="npm"
|
|
685
|
+
npm run build # Or npm run dev
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
```bash packageManager="pnpm"
|
|
689
|
+
pnpm run build # Or pnpm run dev
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
```bash packageManager="yarn"
|
|
693
|
+
yarn build # Or yarn dev
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
```bash packageManager="bun"
|
|
697
|
+
bun run build # Or bun run dev
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
</Tab>
|
|
701
|
+
</Tabs>
|
|
702
|
+
|
|
703
|
+
### Configure TypeScript
|
|
704
|
+
|
|
705
|
+
Ensure your TypeScript configuration includes the autogenerated types.
|
|
706
|
+
|
|
707
|
+
```json5 fileName="tsconfig.json"
|
|
708
|
+
{
|
|
709
|
+
"compilerOptions": {
|
|
710
|
+
// ...
|
|
711
|
+
"experimentalDecorators": true,
|
|
712
|
+
"useDefineForClassFields": false,
|
|
713
|
+
},
|
|
714
|
+
"include": ["src", ".intlayer/**/*.ts"],
|
|
715
|
+
}
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
> `experimentalDecorators` and `useDefineForClassFields: false` are required by Lit for decorator support.
|
|
719
|
+
|
|
720
|
+
### Git Configuration
|
|
721
|
+
|
|
722
|
+
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|
|
723
|
+
|
|
724
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
725
|
+
|
|
726
|
+
```bash
|
|
727
|
+
# Ignore the files generated by Intlayer
|
|
728
|
+
.intlayer
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
### VS Code Extension
|
|
732
|
+
|
|
733
|
+
To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
|
|
734
|
+
|
|
735
|
+
[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
736
|
+
|
|
737
|
+
This extension provides:
|
|
738
|
+
|
|
739
|
+
- **Autocompletion** for translation keys.
|
|
740
|
+
- **Real-time error detection** for missing translations.
|
|
741
|
+
- **Inline previews** of translated content.
|
|
742
|
+
- **Quick actions** to easily create and update translations.
|
|
743
|
+
|
|
744
|
+
For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
|
|
745
|
+
|
|
746
|
+
---
|
|
747
|
+
|
|
748
|
+
### Go Further
|
|
749
|
+
|
|
750
|
+
To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md) or externalize your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md).
|