@intlayer/docs 8.4.10 → 8.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/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 +32 -25
- package/docs/ar/dictionary/markdown.md +33 -35
- package/docs/ar/intlayer_with_analog.md +10 -27
- 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 +689 -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 +24 -8
- 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 +689 -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 +689 -0
- package/docs/cs/intlayer_with_vite+vanilla.md +722 -0
- package/docs/de/compiler.md +6 -1
- package/docs/de/configuration.md +12 -9
- package/docs/de/dictionary/html.md +151 -26
- package/docs/de/dictionary/markdown.md +154 -42
- package/docs/de/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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 +6 -1
- package/docs/en/configuration.md +12 -9
- package/docs/en/dictionary/html.md +152 -27
- package/docs/en/dictionary/markdown.md +154 -38
- package/docs/en/intlayer_with_analog.md +10 -27
- 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 +703 -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 +41 -10
- 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 +32 -25
- package/docs/en-GB/dictionary/markdown.md +34 -36
- package/docs/en-GB/intlayer_with_analog.md +10 -27
- 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 +703 -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 +19 -7
- 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/compiler.md +6 -1
- package/docs/es/configuration.md +12 -9
- package/docs/es/dictionary/html.md +152 -27
- package/docs/es/dictionary/markdown.md +155 -43
- package/docs/es/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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/compiler.md +8 -3
- package/docs/fr/configuration.md +12 -9
- package/docs/fr/dictionary/html.md +151 -26
- package/docs/fr/dictionary/markdown.md +155 -43
- package/docs/fr/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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 +32 -25
- package/docs/hi/dictionary/markdown.md +35 -37
- package/docs/hi/intlayer_with_analog.md +10 -27
- 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 +689 -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 +24 -8
- 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 +32 -25
- package/docs/id/dictionary/markdown.md +35 -37
- package/docs/id/intlayer_with_analog.md +10 -27
- 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 +689 -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 +19 -7
- 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/compiler.md +8 -3
- package/docs/it/configuration.md +12 -9
- package/docs/it/dictionary/html.md +151 -26
- package/docs/it/dictionary/markdown.md +155 -39
- package/docs/it/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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 +153 -29
- package/docs/ja/dictionary/markdown.md +154 -42
- package/docs/ja/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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 +154 -30
- package/docs/ko/dictionary/markdown.md +155 -43
- package/docs/ko/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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 +689 -0
- package/docs/nl/intlayer_with_vite+vanilla.md +722 -0
- package/docs/pl/dictionary/html.md +151 -26
- package/docs/pl/dictionary/markdown.md +155 -43
- package/docs/pl/intlayer_with_analog.md +10 -27
- 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 +689 -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 +19 -7
- 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/compiler.md +7 -2
- package/docs/pt/configuration.md +11 -9
- package/docs/pt/dictionary/html.md +132 -26
- package/docs/pt/dictionary/markdown.md +155 -43
- package/docs/pt/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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 +153 -29
- package/docs/ru/dictionary/markdown.md +155 -41
- package/docs/ru/intlayer_with_analog.md +10 -27
- 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 +698 -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 +24 -8
- 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 +134 -29
- package/docs/tr/dictionary/markdown.md +155 -41
- package/docs/tr/intlayer_with_analog.md +10 -27
- 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 +689 -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 +19 -7
- 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 +32 -25
- package/docs/uk/dictionary/markdown.md +35 -37
- package/docs/uk/intlayer_with_analog.md +10 -27
- 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 +689 -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 +19 -7
- 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 +689 -0
- package/docs/ur/intlayer_with_vite+vanilla.md +722 -0
- package/docs/vi/dictionary/html.md +32 -25
- package/docs/vi/dictionary/markdown.md +35 -37
- package/docs/vi/intlayer_with_analog.md +10 -27
- 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 +689 -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 +19 -7
- 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/compiler.md +8 -3
- package/docs/zh/configuration.md +4 -1
- package/docs/zh/dictionary/html.md +153 -29
- package/docs/zh/dictionary/markdown.md +155 -39
- package/docs/zh/intlayer_with_analog.md +10 -27
- 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 +698 -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 +19 -7
- 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,698 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2026-03-23
|
|
3
|
+
updatedAt: 2026-03-23
|
|
4
|
+
title: i18n Vite + Lit - Como traduzir uma app Lit em 2026
|
|
5
|
+
description: Descubra como tornar o seu website Vite e Lit multilíngue. Siga a documentação para internacionalizá-lo (i18n) e traduzi-lo.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internacionalização
|
|
8
|
+
- Documentação
|
|
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
|
+
# Traduza o seu website Vite e Lit usando Intlayer | Internacionalização (i18n)
|
|
26
|
+
|
|
27
|
+
<iframe
|
|
28
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-vite-lit-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
29
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
30
|
+
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
31
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
32
|
+
loading="lazy"
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
## Tabela de Conteúdos
|
|
36
|
+
|
|
37
|
+
<TOC/>
|
|
38
|
+
|
|
39
|
+
## O que é o Intlayer?
|
|
40
|
+
|
|
41
|
+
O **Intlayer** é uma biblioteca de internacionalização (i18n) inovadora e de código aberto, projetada para simplificar o suporte multilíngue em aplicações web modernas.
|
|
42
|
+
|
|
43
|
+
Com o Intlayer, pode:
|
|
44
|
+
|
|
45
|
+
- **Gerir facilmente as traduções** usando dicionários declarativos ao nível do componente.
|
|
46
|
+
- **Localizar dinamicamente metadados**, rotas e conteúdo.
|
|
47
|
+
- **Garantir o suporte a TypeScript** com tipos autogerados, melhorando o autocompletar e a deteção de erros.
|
|
48
|
+
- **Beneficiar de funcionalidades avançadas**, como a deteção e alternância dinâmica de idioma.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Guia Passo-a-Passo para Configurar o Intlayer numa Aplicação Vite e Lit
|
|
53
|
+
|
|
54
|
+
### Passo 1: Instalar Dependências
|
|
55
|
+
|
|
56
|
+
Instale os pacotes necessários usando npm:
|
|
57
|
+
|
|
58
|
+
```bash packageManager="npm"
|
|
59
|
+
npm install intlayer lit-intlayer
|
|
60
|
+
npm install vite-intlayer --save-dev
|
|
61
|
+
npx intlayer init
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```bash packageManager="pnpm"
|
|
65
|
+
pnpm add intlayer lit-intlayer
|
|
66
|
+
pnpm add vite-intlayer --save-dev
|
|
67
|
+
pnpm intlayer init
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```bash packageManager="yarn"
|
|
71
|
+
yarn add intlayer lit-intlayer
|
|
72
|
+
yarn add vite-intlayer --save-dev
|
|
73
|
+
yarn intlayer init
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```bash packageManager="bun"
|
|
77
|
+
bun add intlayer lit-intlayer
|
|
78
|
+
bun add vite-intlayer --dev
|
|
79
|
+
bunx intlayer init
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- **intlayer**
|
|
83
|
+
|
|
84
|
+
O pacote principal que fornece ferramentas de internacionalização para gestão de configuração, tradução, [declaração de conteúdo](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dictionary/content_file.md), transpilação e [comandos CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/cli/index.md).
|
|
85
|
+
|
|
86
|
+
- **lit-intlayer**
|
|
87
|
+
O pacote que integra o Intlayer com aplicações Lit. Fornece hooks baseados em `ReactiveController` (`useIntlayer`, `useLocale`, etc.) para que os LitElements sejam renderizados novamente de forma automática quando o idioma muda.
|
|
88
|
+
|
|
89
|
+
- **vite-intlayer**
|
|
90
|
+
Inclui o plugin Vite para integrar o Intlayer com o [bundler Vite](https://vite.dev/guide/why.html#why-bundle-for-production), bem como middleware para detetar o idioma preferido do utilizador, gerir cookies e lidar com redirecionamento de URL.
|
|
91
|
+
|
|
92
|
+
### Passo 2: Configuração do seu projeto
|
|
93
|
+
|
|
94
|
+
Crie um ficheiro de configuração para configurar os idiomas da sua aplicação:
|
|
95
|
+
|
|
96
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
97
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
98
|
+
|
|
99
|
+
const config: IntlayerConfig = {
|
|
100
|
+
internationalization: {
|
|
101
|
+
locales: [
|
|
102
|
+
Locales.ENGLISH,
|
|
103
|
+
Locales.FRENCH,
|
|
104
|
+
Locales.SPANISH,
|
|
105
|
+
// Os seus outros idiomas
|
|
106
|
+
],
|
|
107
|
+
defaultLocale: Locales.ENGLISH,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default config;
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
115
|
+
import { Locales } from "intlayer";
|
|
116
|
+
|
|
117
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
118
|
+
const config = {
|
|
119
|
+
internationalization: {
|
|
120
|
+
locales: [
|
|
121
|
+
Locales.ENGLISH,
|
|
122
|
+
Locales.FRENCH,
|
|
123
|
+
Locales.SPANISH,
|
|
124
|
+
// Os seus outros idiomas
|
|
125
|
+
],
|
|
126
|
+
defaultLocale: Locales.ENGLISH,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export default config;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
134
|
+
const { Locales } = require("intlayer");
|
|
135
|
+
|
|
136
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
137
|
+
const config = {
|
|
138
|
+
internationalization: {
|
|
139
|
+
locales: [
|
|
140
|
+
Locales.ENGLISH,
|
|
141
|
+
Locales.FRENCH,
|
|
142
|
+
Locales.SPANISH,
|
|
143
|
+
// Os seus outros idiomas
|
|
144
|
+
],
|
|
145
|
+
defaultLocale: Locales.ENGLISH,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
module.exports = config;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
> Através deste ficheiro de configuração, pode configurar URLs localizados, redirecionamento de middleware, nomes de cookies, a localização e extensão das suas declarações de conteúdo, desativar os logs do Intlayer na consola e muito mais. Para uma lista completa de parâmetros disponíveis, consulte a [documentação de configuração](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/configuration.md).
|
|
153
|
+
|
|
154
|
+
### Passo 3: Integrar o Intlayer na sua Configuração Vite
|
|
155
|
+
|
|
156
|
+
Adicione o plugin intlayer na sua configuração.
|
|
157
|
+
|
|
158
|
+
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
159
|
+
import { defineConfig } from "vite";
|
|
160
|
+
import { intlayer } from "vite-intlayer";
|
|
161
|
+
|
|
162
|
+
// https://vitejs.dev/config/
|
|
163
|
+
export default defineConfig({
|
|
164
|
+
plugins: [intlayer()],
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
169
|
+
import { defineConfig } from "vite";
|
|
170
|
+
import { intlayer } from "vite-intlayer";
|
|
171
|
+
|
|
172
|
+
// https://vitejs.dev/config/
|
|
173
|
+
export default defineConfig({
|
|
174
|
+
plugins: [intlayer()],
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```javascript fileName="vite.config.cjs" codeFormat="commonjs"
|
|
179
|
+
const { defineConfig } = require("vite");
|
|
180
|
+
const { intlayer } = require("vite-intlayer");
|
|
181
|
+
|
|
182
|
+
// https://vitejs.dev/config/
|
|
183
|
+
module.exports = defineConfig({
|
|
184
|
+
plugins: [intlayer()],
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
> O plugin Vite `intlayer()` é usado para integrar o Intlayer com o Vite. Garante a construção dos ficheiros de declaração de conteúdo e monitoriza-os em modo de desenvolvimento. Define variáveis de ambiente do Intlayer dentro da aplicação Vite. Adicionalmente, fornece pseudónimos para otimizar o desempenho.
|
|
189
|
+
|
|
190
|
+
### Passo 4: Inicializar o Intlayer no seu ponto de entrada
|
|
191
|
+
|
|
192
|
+
Chame `installIntlayer()` **antes** de quaisquer elementos personalizados serem registados para que o singleton global de idioma esteja pronto quando o primeiro elemento se ligar.
|
|
193
|
+
|
|
194
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
195
|
+
import { installIntlayer } from "lit-intlayer";
|
|
196
|
+
|
|
197
|
+
// Deve ser chamado antes de qualquer LitElement ser ligado ao DOM.
|
|
198
|
+
installIntlayer();
|
|
199
|
+
|
|
200
|
+
// Importe e registe os seus elementos personalizados.
|
|
201
|
+
import "./my-element.js";
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Se também usar declarações de conteúdo `md()` (Markdown), instale também o renderizador de markdown:
|
|
205
|
+
|
|
206
|
+
```typescript fileName="src/main.ts" codeFormat="typescript"
|
|
207
|
+
import { installIntlayer, installIntlayerMarkdown } from "lit-intlayer";
|
|
208
|
+
|
|
209
|
+
installIntlayer();
|
|
210
|
+
installIntlayerMarkdown();
|
|
211
|
+
|
|
212
|
+
import "./my-element.js";
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Passo 5: Declarar o Seu Conteúdo
|
|
216
|
+
|
|
217
|
+
Crie e gira as suas declarações de conteúdo para armazenar traduções:
|
|
218
|
+
|
|
219
|
+
```typescript fileName="src/app.content.ts" contentDeclarationFormat="typescript"
|
|
220
|
+
import { t, type Dictionary } from "intlayer";
|
|
221
|
+
|
|
222
|
+
const appContent = {
|
|
223
|
+
key: "app",
|
|
224
|
+
content: {
|
|
225
|
+
title: "Vite + Lit",
|
|
226
|
+
|
|
227
|
+
viteLogo: t({
|
|
228
|
+
en: "Vite logo",
|
|
229
|
+
fr: "Logo Vite",
|
|
230
|
+
es: "Logo Vite",
|
|
231
|
+
}),
|
|
232
|
+
litLogo: t({
|
|
233
|
+
en: "Lit logo",
|
|
234
|
+
fr: "Logo Lit",
|
|
235
|
+
es: "Logo Lit",
|
|
236
|
+
}),
|
|
237
|
+
|
|
238
|
+
count: t({
|
|
239
|
+
en: "count is {{count}}",
|
|
240
|
+
fr: "le compte est {{count}}",
|
|
241
|
+
es: "el recuento es {{count}}",
|
|
242
|
+
}),
|
|
243
|
+
|
|
244
|
+
readTheDocs: t({
|
|
245
|
+
en: "Click on the Vite and Lit logos to learn more",
|
|
246
|
+
fr: "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
247
|
+
es: "Haga clic en los logotipos de Vite y Lit para obtener más información",
|
|
248
|
+
}),
|
|
249
|
+
},
|
|
250
|
+
} satisfies Dictionary;
|
|
251
|
+
|
|
252
|
+
export default appContent;
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
```javascript fileName="src/app.content.mjs" contentDeclarationFormat="esm"
|
|
256
|
+
import { t } from "intlayer";
|
|
257
|
+
|
|
258
|
+
/** @type {import('intlayer').Dictionary} */
|
|
259
|
+
const appContent = {
|
|
260
|
+
key: "app",
|
|
261
|
+
content: {
|
|
262
|
+
title: "Vite + Lit",
|
|
263
|
+
|
|
264
|
+
viteLogo: t({
|
|
265
|
+
en: "Vite logo",
|
|
266
|
+
fr: "Logo Vite",
|
|
267
|
+
es: "Logo Vite",
|
|
268
|
+
}),
|
|
269
|
+
litLogo: t({
|
|
270
|
+
en: "Lit logo",
|
|
271
|
+
fr: "Logo Lit",
|
|
272
|
+
es: "Logo Lit",
|
|
273
|
+
}),
|
|
274
|
+
|
|
275
|
+
count: t({
|
|
276
|
+
en: "count is {{count}}",
|
|
277
|
+
fr: "le compte est {{count}}",
|
|
278
|
+
es: "el recuento es {{count}}",
|
|
279
|
+
}),
|
|
280
|
+
|
|
281
|
+
readTheDocs: t({
|
|
282
|
+
en: "Click on the Vite and Lit logos to learn more",
|
|
283
|
+
fr: "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
284
|
+
es: "Haga clic en los logotipos de Vite y Lit para obtener más información",
|
|
285
|
+
}),
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export default appContent;
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```javascript fileName="src/app.content.cjs" contentDeclarationFormat="commonjs"
|
|
293
|
+
const { t } = require("intlayer");
|
|
294
|
+
|
|
295
|
+
/** @type {import('intlayer').Dictionary} */
|
|
296
|
+
const appContent = {
|
|
297
|
+
key: "app",
|
|
298
|
+
content: {
|
|
299
|
+
title: "Vite + Lit",
|
|
300
|
+
|
|
301
|
+
viteLogo: t({
|
|
302
|
+
en: "Vite logo",
|
|
303
|
+
fr: "Logo Vite",
|
|
304
|
+
es: "Logo Vite",
|
|
305
|
+
}),
|
|
306
|
+
litLogo: t({
|
|
307
|
+
en: "Lit logo",
|
|
308
|
+
fr: "Logo Lit",
|
|
309
|
+
es: "Logo Lit",
|
|
310
|
+
}),
|
|
311
|
+
|
|
312
|
+
count: t({
|
|
313
|
+
en: "count is {{count}}",
|
|
314
|
+
fr: "le compte est {{count}}",
|
|
315
|
+
es: "el recuento es {{count}}",
|
|
316
|
+
}),
|
|
317
|
+
|
|
318
|
+
readTheDocs: t({
|
|
319
|
+
en: "Click on the Vite and Lit logos to learn more",
|
|
320
|
+
fr: "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
321
|
+
es: "Haga clic en los logotipos de Vite y Lit para obtener más información",
|
|
322
|
+
}),
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
module.exports = appContent;
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
```json fileName="src/app.content.json" contentDeclarationFormat="json"
|
|
330
|
+
{
|
|
331
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
332
|
+
"key": "app",
|
|
333
|
+
"content": {
|
|
334
|
+
"title": "Vite + Lit",
|
|
335
|
+
"viteLogo": {
|
|
336
|
+
"nodeType": "translation",
|
|
337
|
+
"translation": {
|
|
338
|
+
"en": "Vite logo",
|
|
339
|
+
"fr": "Logo Vite",
|
|
340
|
+
"es": "Logo Vite"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"litLogo": {
|
|
344
|
+
"nodeType": "translation",
|
|
345
|
+
"translation": {
|
|
346
|
+
"en": "Lit logo",
|
|
347
|
+
"fr": "Logo Lit",
|
|
348
|
+
"es": "Logo Lit"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"count": {
|
|
352
|
+
"nodeType": "translation",
|
|
353
|
+
"translation": {
|
|
354
|
+
"en": "count is {{count}}",
|
|
355
|
+
"fr": "le compte est {{count}}",
|
|
356
|
+
"es": "el recuento es {{count}}"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"readTheDocs": {
|
|
360
|
+
"nodeType": "translation",
|
|
361
|
+
"translation": {
|
|
362
|
+
"en": "Click on the Vite and Lit logos to learn more",
|
|
363
|
+
"fr": "Cliquez sur les logos Vite et Lit pour en savoir plus",
|
|
364
|
+
"es": "Haga clic en los logotipos de Vite y Lit para obtener más información"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
> As suas declarações de conteúdo podem ser definidas em qualquer lugar da sua aplicação, desde que sejam incluídas no diretório `contentDir` (por padrão, `./src`) e correspondam à extensão do ficheiro de declaração de conteúdo (por padrão, `.content.{json,ts,tsx,js,jsx,mjs,cjs}`).
|
|
372
|
+
>
|
|
373
|
+
> Para mais detalhes, consulte a [documentação de declaração de conteúdo](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dictionary/content_file.md).
|
|
374
|
+
|
|
375
|
+
### Passo 6: Utilizar o Intlayer no seu LitElement
|
|
376
|
+
|
|
377
|
+
Use o `useIntlayer` dentro de um `LitElement`. Ele retorna um proxy `ReactiveController` que ativa automaticamente re-renderizações sempre que o idioma ativo muda — não é necessária configuração extra.
|
|
378
|
+
|
|
379
|
+
```typescript fileName="src/my-element.ts" codeFormat="typescript"
|
|
380
|
+
import { LitElement, html } from "lit";
|
|
381
|
+
import { customElement, property } from "lit/decorators.js";
|
|
382
|
+
import { useIntlayer } from "lit-intlayer";
|
|
383
|
+
|
|
384
|
+
@customElement("my-element")
|
|
385
|
+
export class MyElement extends LitElement {
|
|
386
|
+
@property({ type: Number })
|
|
387
|
+
count = 0;
|
|
388
|
+
|
|
389
|
+
// useIntlayer regista-se como um ReactiveController.
|
|
390
|
+
// O elemento é renderizado novamente de forma automática quando o idioma muda.
|
|
391
|
+
private content = useIntlayer(this, "app");
|
|
392
|
+
|
|
393
|
+
override render() {
|
|
394
|
+
const { content } = this;
|
|
395
|
+
|
|
396
|
+
return html`
|
|
397
|
+
<h1>${content.title}</h1>
|
|
398
|
+
|
|
399
|
+
<img src="/vite.svg" alt=${content.viteLogo.value} />
|
|
400
|
+
<img src="/lit.svg" alt=${content.litLogo.value} />
|
|
401
|
+
|
|
402
|
+
<button @click=${() => this.count++}>
|
|
403
|
+
${content.count({ count: this.count })}
|
|
404
|
+
</button>
|
|
405
|
+
|
|
406
|
+
<p>${content.readTheDocs}</p>
|
|
407
|
+
`;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
> [!NOTE]
|
|
413
|
+
> Quando precisar da string traduzida num atributo HTML nativo (ex: `alt`, `aria-label`, `title`), chame `.value` no nó folha:
|
|
414
|
+
>
|
|
415
|
+
> ```typescript
|
|
416
|
+
> html`<img alt=${content.viteLogo.value} />`;
|
|
417
|
+
> ```
|
|
418
|
+
|
|
419
|
+
### (Opcional) Passo 7: Alterar o idioma do seu conteúdo
|
|
420
|
+
|
|
421
|
+
Para alterar o idioma do seu conteúdo, use o método `setLocale` exposto pelo controlador `useLocale`.
|
|
422
|
+
|
|
423
|
+
```typescript fileName="src/locale-switcher.ts" codeFormat="typescript"
|
|
424
|
+
import { LitElement, html } from "lit";
|
|
425
|
+
import { customElement } from "lit/decorators.js";
|
|
426
|
+
import { getLocaleName } from "intlayer";
|
|
427
|
+
import { useLocale } from "lit-intlayer";
|
|
428
|
+
|
|
429
|
+
@customElement("locale-switcher")
|
|
430
|
+
export class LocaleSwitcher extends LitElement {
|
|
431
|
+
private locale = useLocale(this);
|
|
432
|
+
|
|
433
|
+
private _onChange(e: Event) {
|
|
434
|
+
const select = e.target as HTMLSelectElement;
|
|
435
|
+
this.locale.setLocale(select.value as any);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
override render() {
|
|
439
|
+
return html`
|
|
440
|
+
<select @change=${this._onChange}>
|
|
441
|
+
${this.locale.availableLocales.map(
|
|
442
|
+
(loc) => html`
|
|
443
|
+
<option value=${loc} ?selected=${loc === this.locale.locale}>
|
|
444
|
+
${getLocaleName(loc)}
|
|
445
|
+
</option>
|
|
446
|
+
`
|
|
447
|
+
)}
|
|
448
|
+
</select>
|
|
449
|
+
`;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### (Opcional) Passo 8: Renderizar conteúdo Markdown e HTML
|
|
455
|
+
|
|
456
|
+
O Intlayer suporta declarações de conteúdo `md()` e `html()`. No Lit, a saída compilada é injetada como HTML bruto através da diretiva `unsafeHTML`.
|
|
457
|
+
|
|
458
|
+
```typescript fileName="src/app.content.ts" contentDeclarationFormat="typescript"
|
|
459
|
+
import { md, t, type Dictionary } from "intlayer";
|
|
460
|
+
|
|
461
|
+
const appContent = {
|
|
462
|
+
key: "app",
|
|
463
|
+
content: {
|
|
464
|
+
// ...
|
|
465
|
+
editNote: md(
|
|
466
|
+
t({
|
|
467
|
+
en: "Edit `src/my-element.ts` and save to test **HMR**",
|
|
468
|
+
fr: "Modifiez `src/my-element.ts` et enregistrez pour tester **HMR**",
|
|
469
|
+
es: "Edite `src/my-element.ts` y guarde para probar **HMR**",
|
|
470
|
+
})
|
|
471
|
+
),
|
|
472
|
+
},
|
|
473
|
+
} satisfies Dictionary;
|
|
474
|
+
|
|
475
|
+
export default appContent;
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Renderize o HTML compilado no seu elemento:
|
|
479
|
+
|
|
480
|
+
```typescript fileName="src/my-element.ts" codeFormat="typescript"
|
|
481
|
+
import { LitElement, html } from "lit";
|
|
482
|
+
import { customElement } from "lit/decorators.js";
|
|
483
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
484
|
+
import { useIntlayer } from "lit-intlayer";
|
|
485
|
+
import { compileMarkdown } from "lit-intlayer/markdown";
|
|
486
|
+
|
|
487
|
+
@customElement("my-element")
|
|
488
|
+
export class MyElement extends LitElement {
|
|
489
|
+
private content = useIntlayer(this, "app");
|
|
490
|
+
|
|
491
|
+
override render() {
|
|
492
|
+
return html`
|
|
493
|
+
<div class="edit-note">
|
|
494
|
+
${unsafeHTML(compileMarkdown(String(this.content.editNote)))}
|
|
495
|
+
</div>
|
|
496
|
+
`;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
> [!TIP]
|
|
502
|
+
> `String(content.editNote)` chama `toString()` no `IntlayerNode`, que retorna a string Markdown bruta. Passe-a para `compileMarkdown` para obter uma string HTML, e depois renderize-a com a diretiva `unsafeHTML` do Lit.
|
|
503
|
+
|
|
504
|
+
### (Opcional) Passo 9: Adicionar Localized Routing à sua aplicação
|
|
505
|
+
|
|
506
|
+
Para criar rotas únicas para cada idioma (útil para SEO), pode usar um router do lado do cliente juntamente com os ajudantes `localeMap` / `localeFlatMap` do Intlayer, e o plugin Vite `intlayerProxy` para deteção de idioma do lado do servidor.
|
|
507
|
+
|
|
508
|
+
Primeiro, adicione o `intlayerProxy` à sua configuração Vite:
|
|
509
|
+
|
|
510
|
+
> Note que para usar o `intlayerProxy` em produção, precisa de mover o `vite-intlayer` de `devDependencies` para `dependencies`.
|
|
511
|
+
|
|
512
|
+
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
513
|
+
import { defineConfig } from "vite";
|
|
514
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
515
|
+
|
|
516
|
+
export default defineConfig({
|
|
517
|
+
plugins: [
|
|
518
|
+
intlayerProxy(), // should be placed first
|
|
519
|
+
intlayer(),
|
|
520
|
+
],
|
|
521
|
+
});
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
525
|
+
import { defineConfig } from "vite";
|
|
526
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
527
|
+
|
|
528
|
+
export default defineConfig({
|
|
529
|
+
plugins: [
|
|
530
|
+
intlayerProxy(), // should be placed first
|
|
531
|
+
intlayer(),
|
|
532
|
+
],
|
|
533
|
+
});
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
537
|
+
const { defineConfig } = require("vite");
|
|
538
|
+
const { intlayer, intlayerProxy } = require("vite-intlayer");
|
|
539
|
+
|
|
540
|
+
module.exports = defineConfig({
|
|
541
|
+
plugins: [
|
|
542
|
+
intlayerProxy(), // should be placed first
|
|
543
|
+
intlayer(),
|
|
544
|
+
],
|
|
545
|
+
});
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### (Opcional) Passo 10: Alterar o URL quando o idioma muda
|
|
549
|
+
|
|
550
|
+
Para atualizar o URL do navegador quando o idioma muda, use o `useRewriteURL` juntamente com o seletor de idioma:
|
|
551
|
+
|
|
552
|
+
```typescript fileName="src/locale-switcher.ts" codeFormat="typescript"
|
|
553
|
+
import { LitElement, html } from "lit";
|
|
554
|
+
import { customElement } from "lit/decorators.js";
|
|
555
|
+
import { getLocaleName, getLocalizedUrl } from "intlayer";
|
|
556
|
+
import { useLocale, useRewriteURL } from "lit-intlayer";
|
|
557
|
+
|
|
558
|
+
@customElement("locale-switcher")
|
|
559
|
+
export class LocaleSwitcher extends LitElement {
|
|
560
|
+
private locale = useLocale(this);
|
|
561
|
+
|
|
562
|
+
// Re-escreve automaticamente o URL atual quando o idioma muda.
|
|
563
|
+
private _rewriteURL = useRewriteURL(this);
|
|
564
|
+
|
|
565
|
+
private _onChange(e: Event) {
|
|
566
|
+
const select = e.target as HTMLSelectElement;
|
|
567
|
+
this.locale.setLocale(select.value as any);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
override render() {
|
|
571
|
+
return html`
|
|
572
|
+
<select @change=${this._onChange}>
|
|
573
|
+
${this.locale.availableLocales.map(
|
|
574
|
+
(loc) => html`
|
|
575
|
+
<option value=${loc} ?selected=${loc === this.locale.locale}>
|
|
576
|
+
${getLocaleName(loc)}
|
|
577
|
+
</option>
|
|
578
|
+
`
|
|
579
|
+
)}
|
|
580
|
+
</select>
|
|
581
|
+
`;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
### (Opcional) Passo 11: Alternar os Atributos de Idioma e Direção HTML
|
|
587
|
+
|
|
588
|
+
Atualize os atributos `lang` e `dir` da tag `<html>` para corresponderem ao idioma atual para acessibilidade e SEO.
|
|
589
|
+
|
|
590
|
+
```typescript fileName="src/my-element.ts" codeFormat="typescript"
|
|
591
|
+
import { LitElement, html } from "lit";
|
|
592
|
+
import { customElement } from "lit/decorators.js";
|
|
593
|
+
import { getHTMLTextDir } from "intlayer";
|
|
594
|
+
import { useLocale } from "lit-intlayer";
|
|
595
|
+
|
|
596
|
+
@customElement("my-element")
|
|
597
|
+
export class MyElement extends LitElement {
|
|
598
|
+
private locale = useLocale(this, {
|
|
599
|
+
onLocaleChange: (loc) => {
|
|
600
|
+
document.documentElement.lang = loc;
|
|
601
|
+
document.documentElement.dir = getHTMLTextDir(loc);
|
|
602
|
+
},
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
override render() {
|
|
606
|
+
return html`<!-- o seu conteúdo -->`;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### (Opcional) Passo 12: Extrair o conteúdo dos seus componentes
|
|
612
|
+
|
|
613
|
+
Se tiver uma base de código existente, transformar milhares de ficheiros pode ser demorado.
|
|
614
|
+
|
|
615
|
+
Para facilitar este processo, o Intlayer propõe um [compilador](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/compiler.md) / [extrator](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/cli/extract.md) para transformar os seus componentes e extrair o conteúdo.
|
|
616
|
+
|
|
617
|
+
Para configurá-lo, pode adicionar uma secção `compiler` no seu ficheiro `intlayer.config.ts`:
|
|
618
|
+
|
|
619
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
620
|
+
import { type IntlayerConfig } from "intlayer";
|
|
621
|
+
|
|
622
|
+
const config: IntlayerConfig = {
|
|
623
|
+
// ... Restante da sua configuração
|
|
624
|
+
compiler: {
|
|
625
|
+
/**
|
|
626
|
+
* Indica se o compilador deve estar habilitado.
|
|
627
|
+
*/
|
|
628
|
+
enabled: true,
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Define o caminho dos ficheiros de saída
|
|
632
|
+
*/
|
|
633
|
+
output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* Indica se os componentes devem ser guardados após serem transformados.
|
|
637
|
+
* Dessa forma, o compilador pode ser executado apenas uma vez para transformar a app, e depois pode ser removido.
|
|
638
|
+
*/
|
|
639
|
+
saveComponents: false,
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Prefixo da chave do dicionário
|
|
643
|
+
*/
|
|
644
|
+
dictionaryKeyPrefix: "",
|
|
645
|
+
},
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
export default config;
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
### Configurar TypeScript
|
|
652
|
+
|
|
653
|
+
Certifique-se de que a sua configuração TypeScript inclui os tipos autogerados.
|
|
654
|
+
|
|
655
|
+
```json5 fileName="tsconfig.json"
|
|
656
|
+
{
|
|
657
|
+
"compilerOptions": {
|
|
658
|
+
// ...
|
|
659
|
+
"experimentalDecorators": true,
|
|
660
|
+
"useDefineForClassFields": false,
|
|
661
|
+
},
|
|
662
|
+
"include": ["src", ".intlayer/**/*.ts"],
|
|
663
|
+
}
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
> `experimentalDecorators` e `useDefineForClassFields: false` são exigidos pelo Lit para suporte a decoradores.
|
|
667
|
+
|
|
668
|
+
### Configuração Git
|
|
669
|
+
|
|
670
|
+
Recomenda-se ignorar os ficheiros gerados pelo Intlayer. Isso permite-lhe evitar submetê-los para o seu repositório Git.
|
|
671
|
+
|
|
672
|
+
Para fazer isso, pode adicionar as seguintes instruções ao seu ficheiro `.gitignore`:
|
|
673
|
+
|
|
674
|
+
```bash
|
|
675
|
+
# Ignorar os ficheiros gerados pelo Intlayer
|
|
676
|
+
.intlayer
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
### Extensão VS Code
|
|
680
|
+
|
|
681
|
+
Para melhorar a sua experiência de desenvolvimento com o Intlayer, pode instalar a **Extensão oficial Intlayer VS Code**.
|
|
682
|
+
|
|
683
|
+
[Instalar a partir do VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
684
|
+
|
|
685
|
+
Esta extensão fornece:
|
|
686
|
+
|
|
687
|
+
- **Autocompletar** para chaves de tradução.
|
|
688
|
+
- **Deteção de erros em tempo real** para traduções em falta.
|
|
689
|
+
- **Pré-visualizações inline** de conteúdo traduzido.
|
|
690
|
+
- **Ações rápidas** para criar e atualizar traduções facilmente.
|
|
691
|
+
|
|
692
|
+
Para mais detalhes sobre como usar a extensão, consulte a [documentação da Extensão Intlayer VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
693
|
+
|
|
694
|
+
---
|
|
695
|
+
|
|
696
|
+
### Ir Mais Longe
|
|
697
|
+
|
|
698
|
+
Para ir mais longe, pode implementar o [editor visual](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_visual_editor.md) ou externalizar o seu conteúdo usando o [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_CMS.md).
|