@intlayer/docs 7.0.7 → 7.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/i18n_using_next-i18next.md +1068 -0
- package/blog/ar/i18n_using_next-intl.md +768 -0
- package/blog/ar/intlayer_with_react-intl.md +0 -4
- package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +5 -4
- package/blog/de/i18n_using_next-i18next.md +1107 -0
- package/blog/de/i18n_using_next-intl.md +760 -0
- package/blog/de/intlayer_with_react-intl.md +0 -4
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/en/i18n_using_next-i18next.md +1073 -0
- package/blog/en/i18n_using_next-intl.md +757 -0
- package/blog/en/intlayer_with_i18next.md +71 -8
- package/blog/en/intlayer_with_next-i18next.md +71 -8
- package/blog/en/intlayer_with_next-intl.md +71 -8
- package/blog/en/intlayer_with_react-i18next.md +69 -8
- package/blog/en/intlayer_with_react-intl.md +68 -9
- package/blog/en/intlayer_with_vue-i18n.md +68 -7
- package/blog/en/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/blog/en/vue-i18n_vs_intlayer.md +2 -0
- package/blog/en-GB/i18n_using_next-i18next.md +1074 -0
- package/blog/en-GB/i18n_using_next-intl.md +757 -0
- package/blog/en-GB/intlayer_with_i18next.md +15 -6
- package/blog/en-GB/intlayer_with_next-i18next.md +16 -6
- package/blog/en-GB/intlayer_with_next-intl.md +16 -6
- package/blog/en-GB/intlayer_with_react-i18next.md +16 -7
- package/blog/en-GB/intlayer_with_react-intl.md +14 -9
- package/blog/en-GB/intlayer_with_vue-i18n.md +16 -7
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/en-GB/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/blog/en-GB/vue-i18n_vs_intlayer.md +2 -0
- package/blog/es/i18n_using_next-i18next.md +1066 -0
- package/blog/es/i18n_using_next-intl.md +757 -0
- package/blog/es/intlayer_with_react-intl.md +0 -4
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/fr/i18n_using_next-i18next.md +1078 -0
- package/blog/fr/i18n_using_next-intl.md +759 -0
- package/blog/fr/intlayer_with_react-intl.md +0 -4
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/hi/i18n_using_next-i18next.md +1068 -0
- package/blog/hi/i18n_using_next-intl.md +758 -0
- package/blog/hi/intlayer_with_react-intl.md +0 -4
- package/blog/hi/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/id/i18n_using_next-i18next.md +1078 -0
- package/blog/id/i18n_using_next-intl.md +757 -0
- package/blog/id/index.md +69 -0
- package/blog/id/internationalization_and_SEO.md +364 -0
- package/blog/id/intlayer_with_react-intl.md +0 -4
- package/blog/id/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/id/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/id/list_i18n_technologies/CMS/wordpress.md +188 -0
- package/blog/id/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/id/list_i18n_technologies/frameworks/flutter.md +150 -0
- package/blog/id/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/id/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/id/list_i18n_technologies/frameworks/svelte.md +131 -0
- package/blog/id/list_i18n_technologies/frameworks/vue.md +130 -0
- package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +1500 -0
- package/blog/id/nextjs-multilingual-seo-comparison.md +361 -0
- package/blog/id/rag_powered_documentation_assistant.md +288 -0
- package/blog/id/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/id/vue-i18n_vs_intlayer.md +278 -0
- package/blog/id/what_is_internationalization.md +166 -0
- package/blog/it/i18n_using_next-i18next.md +1078 -0
- package/blog/it/i18n_using_next-intl.md +758 -0
- package/blog/it/intlayer_with_react-intl.md +0 -4
- package/blog/it/react-i18next_vs_react-intl_vs_intlayer.md +4 -0
- package/blog/it/vue-i18n_vs_intlayer.md +2 -0
- package/blog/ja/i18n_using_next-i18next.md +1078 -0
- package/blog/ja/i18n_using_next-intl.md +758 -0
- package/blog/ja/intlayer_with_react-intl.md +0 -4
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/ko/i18n_using_next-i18next.md +1075 -0
- package/blog/ko/i18n_using_next-intl.md +759 -0
- package/blog/ko/intlayer_with_react-intl.md +0 -4
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/pl/i18n_using_next-i18next.md +1078 -0
- package/blog/pl/i18n_using_next-intl.md +758 -0
- package/blog/pl/index.md +69 -0
- package/blog/pl/internationalization_and_SEO.md +363 -0
- package/blog/pl/intlayer_with_react-intl.md +0 -4
- package/blog/pl/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/pl/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/pl/list_i18n_technologies/CMS/wordpress.md +196 -0
- package/blog/pl/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/pl/list_i18n_technologies/frameworks/flutter.md +151 -0
- package/blog/pl/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/pl/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/pl/list_i18n_technologies/frameworks/svelte.md +131 -0
- package/blog/pl/list_i18n_technologies/frameworks/vue.md +130 -0
- package/blog/pl/next-i18next_vs_next-intl_vs_intlayer.md +1501 -0
- package/blog/pl/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/pl/rag_powered_documentation_assistant.md +288 -0
- package/blog/pl/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/pl/vue-i18n_vs_intlayer.md +278 -0
- package/blog/pl/what_is_internationalization.md +167 -0
- package/blog/pt/i18n_using_next-i18next.md +1067 -0
- package/blog/pt/i18n_using_next-intl.md +760 -0
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/ru/i18n_using_next-i18next.md +1106 -0
- package/blog/ru/i18n_using_next-intl.md +759 -0
- package/blog/ru/intlayer_with_react-intl.md +0 -4
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/tr/i18n_using_next-i18next.md +1078 -0
- package/blog/tr/i18n_using_next-intl.md +760 -0
- package/blog/tr/intlayer_with_react-intl.md +0 -4
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/tr/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/blog/tr/vue-i18n_vs_intlayer.md +2 -0
- package/blog/vi/i18n_using_next-i18next.md +1080 -0
- package/blog/vi/i18n_using_next-intl.md +758 -0
- package/blog/vi/index.md +69 -0
- package/blog/vi/internationalization_and_SEO.md +363 -0
- package/blog/vi/intlayer_with_react-intl.md +0 -4
- package/blog/vi/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/vi/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/vi/list_i18n_technologies/CMS/wordpress.md +188 -0
- package/blog/vi/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/vi/list_i18n_technologies/frameworks/flutter.md +150 -0
- package/blog/vi/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/vi/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/vi/list_i18n_technologies/frameworks/svelte.md +131 -0
- package/blog/vi/list_i18n_technologies/frameworks/vue.md +130 -0
- package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +1520 -0
- package/blog/vi/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/vi/rag_powered_documentation_assistant.md +288 -0
- package/blog/vi/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/vi/vue-i18n_vs_intlayer.md +278 -0
- package/blog/vi/what_is_internationalization.md +168 -0
- package/blog/zh/i18n_using_next-i18next.md +1105 -0
- package/blog/zh/i18n_using_next-intl.md +758 -0
- package/blog/zh/intlayer_with_react-intl.md +0 -4
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/zh/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/dist/cjs/common.cjs +0 -4
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +38 -6
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +0 -6
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +0 -6
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +0 -6
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +38 -0
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/types/generated/blog.entry.d.ts +2 -0
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +1 -1
- package/docs/ar/configuration.md +6 -0
- package/docs/ar/intlayer_cli.md +8 -3
- package/docs/ar/intlayer_with_next-i18next.md +619 -0
- package/docs/ar/intlayer_with_next-intl.md +446 -0
- package/docs/ar/intlayer_with_nextjs_16.md +21 -0
- package/docs/ar/intlayer_with_tanstack.md +4 -0
- package/docs/ar/intlayer_with_vite+react.md +4 -0
- package/docs/de/component_i18n.md +1 -1
- package/docs/de/configuration.md +6 -0
- package/docs/de/intlayer_cli.md +8 -3
- package/docs/de/intlayer_with_next-i18next.md +627 -0
- package/docs/de/intlayer_with_next-intl.md +451 -0
- package/docs/de/intlayer_with_nextjs_16.md +21 -0
- package/docs/de/intlayer_with_tanstack.md +4 -0
- package/docs/de/intlayer_with_vite+react.md +4 -0
- package/docs/en/component_i18n.md +1 -1
- package/docs/en/intlayer_cli.md +8 -1
- package/docs/en/intlayer_with_astro.md +10 -2
- package/docs/en/intlayer_with_create_react_app.md +8 -0
- package/docs/en/intlayer_with_lynx+react.md +8 -0
- package/docs/en/intlayer_with_nestjs.md +10 -0
- package/docs/en/intlayer_with_nextjs_14.md +10 -2
- package/docs/en/intlayer_with_nextjs_15.md +21 -4
- package/docs/en/intlayer_with_nextjs_16.md +17 -0
- package/docs/en/intlayer_with_nuxt.md +8 -0
- package/docs/en/intlayer_with_react_native+expo.md +10 -2
- package/docs/en/intlayer_with_react_router_v7.md +8 -0
- package/docs/en/intlayer_with_tanstack.md +10 -0
- package/docs/en/intlayer_with_vite+preact.md +10 -2
- package/docs/en/intlayer_with_vite+react.md +21 -4
- package/docs/en/intlayer_with_vite+vue.md +10 -2
- package/docs/en-GB/component_i18n.md +1 -1
- package/docs/en-GB/configuration.md +6 -0
- package/docs/en-GB/intlayer_cli.md +8 -3
- package/docs/en-GB/intlayer_with_angular.md +4 -4
- package/docs/en-GB/intlayer_with_express.md +4 -4
- package/docs/en-GB/intlayer_with_lynx+react.md +12 -12
- package/{blog/en/_intlayer_with_next-i18next.md → docs/en-GB/intlayer_with_next-i18next.md} +241 -42
- package/{blog/en/_intlayer_with_next-intl.md → docs/en-GB/intlayer_with_next-intl.md} +144 -29
- package/docs/en-GB/intlayer_with_nextjs_16.md +21 -0
- package/docs/en-GB/intlayer_with_tanstack.md +5 -1
- package/docs/en-GB/intlayer_with_vite+react.md +4 -0
- package/docs/en-GB/packages/next-intlayer/t.md +2 -2
- package/docs/es/component_i18n.md +1 -1
- package/docs/es/configuration.md +6 -0
- package/docs/es/intlayer_cli.md +8 -3
- package/docs/es/intlayer_with_next-i18next.md +628 -0
- package/docs/es/intlayer_with_next-intl.md +446 -0
- package/docs/es/intlayer_with_nextjs_16.md +21 -0
- package/docs/es/intlayer_with_tanstack.md +4 -0
- package/docs/es/intlayer_with_vite+react.md +4 -0
- package/docs/fr/configuration.md +6 -0
- package/docs/fr/intlayer_cli.md +8 -3
- package/docs/fr/intlayer_with_next-i18next.md +628 -0
- package/docs/fr/intlayer_with_next-intl.md +446 -0
- package/docs/fr/intlayer_with_nextjs_16.md +23 -2
- package/docs/fr/intlayer_with_tanstack.md +4 -0
- package/docs/fr/intlayer_with_vite+react.md +4 -0
- package/docs/hi/component_i18n.md +1 -1
- package/docs/hi/configuration.md +6 -0
- package/docs/hi/intlayer_cli.md +8 -0
- package/docs/hi/intlayer_with_next-i18next.md +628 -0
- package/docs/hi/intlayer_with_next-intl.md +446 -0
- package/docs/hi/intlayer_with_nextjs_16.md +21 -0
- package/docs/hi/intlayer_with_tanstack.md +4 -0
- package/docs/hi/intlayer_with_vite+react.md +4 -0
- package/docs/id/CI_CD.md +198 -0
- package/docs/id/autoFill.md +284 -0
- package/docs/id/component_i18n.md +186 -0
- package/docs/id/configuration.md +710 -0
- package/docs/id/dictionary/condition.md +231 -0
- package/docs/id/dictionary/content_file.md +1092 -0
- package/docs/id/dictionary/enumeration.md +245 -0
- package/docs/id/dictionary/file.md +237 -0
- package/docs/id/dictionary/function_fetching.md +214 -0
- package/docs/id/dictionary/gender.md +273 -0
- package/docs/id/dictionary/insertion.md +192 -0
- package/docs/id/dictionary/markdown.md +381 -0
- package/docs/id/dictionary/nesting.md +273 -0
- package/docs/id/dictionary/translation.md +310 -0
- package/docs/id/formatters.md +596 -0
- package/docs/id/how_works_intlayer.md +256 -0
- package/docs/id/index.md +176 -0
- package/docs/id/interest_of_intlayer.md +293 -0
- package/docs/id/intlayer_CMS.md +549 -0
- package/docs/id/intlayer_cli.md +850 -0
- package/docs/id/intlayer_visual_editor.md +288 -0
- package/docs/id/intlayer_with_angular.md +694 -0
- package/docs/id/intlayer_with_astro.md +252 -0
- package/docs/id/intlayer_with_create_react_app.md +1233 -0
- package/docs/id/intlayer_with_express.md +411 -0
- package/docs/id/intlayer_with_lynx+react.md +518 -0
- package/docs/id/intlayer_with_nestjs.md +272 -0
- package/docs/id/intlayer_with_next-i18next.md +628 -0
- package/docs/id/intlayer_with_next-intl.md +446 -0
- package/docs/id/intlayer_with_nextjs_14.md +1617 -0
- package/docs/id/intlayer_with_nextjs_15.md +1698 -0
- package/docs/id/intlayer_with_nextjs_16.md +21 -0
- package/docs/id/intlayer_with_nextjs_page_router.md +1478 -0
- package/docs/id/intlayer_with_nuxt.md +808 -0
- package/docs/id/intlayer_with_react_native+expo.md +699 -0
- package/docs/id/intlayer_with_react_router_v7.md +496 -0
- package/docs/id/intlayer_with_tanstack.md +564 -0
- package/docs/id/intlayer_with_vite+preact.md +1737 -0
- package/docs/id/intlayer_with_vite+react.md +1413 -0
- package/docs/id/intlayer_with_vite+solid.md +289 -0
- package/docs/id/intlayer_with_vite+svelte.md +289 -0
- package/docs/id/intlayer_with_vite+vue.md +1088 -0
- package/docs/id/introduction.md +218 -0
- package/docs/id/locale_mapper.md +242 -0
- package/docs/id/mcp_server.md +211 -0
- package/docs/id/packages/express-intlayer/t.md +458 -0
- package/docs/id/packages/intlayer/getConfiguration.md +145 -0
- package/docs/id/packages/intlayer/getEnumeration.md +159 -0
- package/docs/id/packages/intlayer/getHTMLTextDir.md +122 -0
- package/docs/id/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/id/packages/intlayer/getLocaleName.md +119 -0
- package/docs/id/packages/intlayer/getLocalizedUrl.md +309 -0
- package/docs/id/packages/intlayer/getMultilingualUrls.md +223 -0
- package/docs/id/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/id/packages/intlayer/getTranslation.md +190 -0
- package/docs/id/packages/intlayer/getTranslationContent.md +188 -0
- package/docs/id/packages/next-intlayer/t.md +352 -0
- package/docs/id/packages/next-intlayer/useDictionary.md +271 -0
- package/docs/id/packages/next-intlayer/useIntlayer.md +264 -0
- package/docs/id/packages/next-intlayer/useLocale.md +166 -0
- package/docs/id/packages/react-intlayer/t.md +303 -0
- package/docs/id/packages/react-intlayer/useDictionary.md +287 -0
- package/docs/id/packages/react-intlayer/useI18n.md +267 -0
- package/docs/id/packages/react-intlayer/useIntlayer.md +254 -0
- package/docs/id/packages/react-intlayer/useLocale.md +210 -0
- package/docs/id/per_locale_file.md +323 -0
- package/docs/id/readme.md +261 -0
- package/docs/id/releases/v6.md +305 -0
- package/docs/id/roadmap.md +362 -0
- package/docs/id/testing.md +202 -0
- package/docs/id/vs_code_extension.md +126 -0
- package/docs/it/component_i18n.md +1 -1
- package/docs/it/configuration.md +6 -0
- package/docs/it/intlayer_cli.md +8 -3
- package/docs/it/intlayer_with_next-i18next.md +628 -0
- package/docs/it/intlayer_with_next-intl.md +446 -0
- package/docs/it/intlayer_with_nextjs_16.md +21 -0
- package/docs/it/intlayer_with_tanstack.md +4 -0
- package/docs/it/intlayer_with_vite+react.md +4 -0
- package/docs/ja/component_i18n.md +1 -1
- package/docs/ja/configuration.md +6 -0
- package/docs/ja/intlayer_cli.md +8 -3
- package/docs/ja/intlayer_with_next-i18next.md +627 -0
- package/docs/ja/intlayer_with_next-intl.md +446 -0
- package/docs/ja/intlayer_with_nextjs_16.md +21 -0
- package/docs/ja/intlayer_with_tanstack.md +4 -0
- package/docs/ja/intlayer_with_vite+react.md +4 -0
- package/docs/ko/configuration.md +6 -0
- package/docs/ko/intlayer_cli.md +8 -3
- package/docs/ko/intlayer_with_next-i18next.md +627 -0
- package/docs/ko/intlayer_with_next-intl.md +446 -0
- package/docs/ko/intlayer_with_nextjs_16.md +21 -0
- package/docs/ko/intlayer_with_tanstack.md +4 -0
- package/docs/ko/intlayer_with_vite+react.md +4 -0
- package/docs/pl/CI_CD.md +198 -0
- package/docs/pl/autoFill.md +284 -0
- package/docs/pl/component_i18n.md +186 -0
- package/docs/pl/configuration.md +710 -0
- package/docs/pl/dictionary/condition.md +232 -0
- package/docs/pl/dictionary/content_file.md +1130 -0
- package/docs/pl/dictionary/enumeration.md +245 -0
- package/docs/pl/dictionary/file.md +234 -0
- package/docs/pl/dictionary/function_fetching.md +214 -0
- package/docs/pl/dictionary/gender.md +276 -0
- package/docs/pl/dictionary/insertion.md +188 -0
- package/docs/pl/dictionary/markdown.md +408 -0
- package/docs/pl/dictionary/nesting.md +273 -0
- package/docs/pl/dictionary/translation.md +310 -0
- package/docs/pl/formatters.md +596 -0
- package/docs/pl/how_works_intlayer.md +256 -0
- package/docs/pl/index.md +176 -0
- package/docs/pl/interest_of_intlayer.md +291 -0
- package/docs/pl/intlayer_CMS.md +549 -0
- package/docs/pl/intlayer_cli.md +857 -0
- package/docs/pl/intlayer_visual_editor.md +288 -0
- package/docs/pl/intlayer_with_angular.md +690 -0
- package/docs/pl/intlayer_with_astro.md +280 -0
- package/docs/pl/intlayer_with_create_react_app.md +1235 -0
- package/docs/pl/intlayer_with_express.md +411 -0
- package/docs/pl/intlayer_with_lynx+react.md +518 -0
- package/docs/pl/intlayer_with_nestjs.md +272 -0
- package/docs/pl/intlayer_with_next-i18next.md +628 -0
- package/docs/pl/intlayer_with_next-intl.md +446 -0
- package/docs/pl/intlayer_with_nextjs_14.md +1594 -0
- package/docs/pl/intlayer_with_nextjs_15.md +1701 -0
- package/docs/pl/intlayer_with_nextjs_16.md +21 -0
- package/docs/pl/intlayer_with_nextjs_page_router.md +1513 -0
- package/docs/pl/intlayer_with_nuxt.md +885 -0
- package/docs/pl/intlayer_with_react_native+expo.md +698 -0
- package/docs/pl/intlayer_with_react_router_v7.md +503 -0
- package/docs/pl/intlayer_with_tanstack.md +562 -0
- package/docs/pl/intlayer_with_vite+preact.md +1736 -0
- package/docs/pl/intlayer_with_vite+react.md +1438 -0
- package/docs/pl/intlayer_with_vite+solid.md +290 -0
- package/docs/pl/intlayer_with_vite+svelte.md +289 -0
- package/docs/pl/intlayer_with_vite+vue.md +1116 -0
- package/docs/pl/introduction.md +209 -0
- package/docs/pl/locale_mapper.md +242 -0
- package/docs/pl/mcp_server.md +211 -0
- package/docs/pl/packages/express-intlayer/t.md +458 -0
- package/docs/pl/packages/intlayer/getConfiguration.md +146 -0
- package/docs/pl/packages/intlayer/getEnumeration.md +160 -0
- package/docs/pl/packages/intlayer/getHTMLTextDir.md +121 -0
- package/docs/pl/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/pl/packages/intlayer/getLocaleName.md +118 -0
- package/docs/pl/packages/intlayer/getLocalizedUrl.md +300 -0
- package/docs/pl/packages/intlayer/getMultilingualUrls.md +221 -0
- package/docs/pl/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/pl/packages/intlayer/getTranslation.md +190 -0
- package/docs/pl/packages/intlayer/getTranslationContent.md +189 -0
- package/docs/pl/packages/next-intlayer/t.md +353 -0
- package/docs/pl/packages/next-intlayer/useDictionary.md +270 -0
- package/docs/pl/packages/next-intlayer/useIntlayer.md +263 -0
- package/docs/pl/packages/next-intlayer/useLocale.md +166 -0
- package/docs/pl/packages/react-intlayer/t.md +303 -0
- package/docs/pl/packages/react-intlayer/useDictionary.md +289 -0
- package/docs/pl/packages/react-intlayer/useI18n.md +249 -0
- package/docs/pl/packages/react-intlayer/useIntlayer.md +256 -0
- package/docs/pl/packages/react-intlayer/useLocale.md +210 -0
- package/docs/pl/per_locale_file.md +321 -0
- package/docs/pl/readme.md +261 -0
- package/docs/pl/releases/v6.md +305 -0
- package/docs/pl/roadmap.md +362 -0
- package/docs/pl/testing.md +202 -0
- package/docs/pl/vs_code_extension.md +126 -0
- package/docs/pt/component_i18n.md +1 -1
- package/docs/pt/configuration.md +6 -0
- package/docs/pt/intlayer_cli.md +8 -3
- package/docs/pt/intlayer_with_next-i18next.md +627 -0
- package/docs/pt/intlayer_with_next-intl.md +446 -0
- package/docs/pt/intlayer_with_nextjs_16.md +21 -0
- package/docs/pt/intlayer_with_tanstack.md +4 -0
- package/docs/pt/intlayer_with_vite+react.md +4 -0
- package/docs/ru/component_i18n.md +1 -1
- package/docs/ru/configuration.md +6 -0
- package/docs/ru/intlayer_cli.md +301 -22
- package/docs/ru/intlayer_with_next-i18next.md +629 -0
- package/docs/ru/intlayer_with_next-intl.md +448 -0
- package/docs/ru/intlayer_with_nextjs_16.md +21 -0
- package/docs/ru/intlayer_with_tanstack.md +4 -0
- package/docs/ru/intlayer_with_vite+react.md +4 -0
- package/docs/tr/component_i18n.md +1 -1
- package/docs/tr/configuration.md +6 -0
- package/docs/tr/intlayer_cli.md +8 -0
- package/docs/tr/intlayer_with_next-i18next.md +627 -0
- package/docs/tr/intlayer_with_next-intl.md +446 -0
- package/docs/tr/intlayer_with_nextjs_16.md +21 -0
- package/docs/tr/intlayer_with_tanstack.md +4 -0
- package/docs/tr/intlayer_with_vite+react.md +4 -0
- package/docs/vi/CI_CD.md +198 -0
- package/docs/vi/autoFill.md +284 -0
- package/docs/vi/component_i18n.md +186 -0
- package/docs/vi/configuration.md +710 -0
- package/docs/vi/dictionary/condition.md +237 -0
- package/docs/vi/dictionary/content_file.md +1115 -0
- package/docs/vi/dictionary/enumeration.md +255 -0
- package/docs/vi/dictionary/file.md +234 -0
- package/docs/vi/dictionary/function_fetching.md +212 -0
- package/docs/vi/dictionary/gender.md +275 -0
- package/docs/vi/dictionary/insertion.md +191 -0
- package/docs/vi/dictionary/markdown.md +381 -0
- package/docs/vi/dictionary/nesting.md +273 -0
- package/docs/vi/dictionary/translation.md +309 -0
- package/docs/vi/formatters.md +595 -0
- package/docs/vi/how_works_intlayer.md +256 -0
- package/docs/vi/index.md +174 -0
- package/docs/vi/interest_of_intlayer.md +292 -0
- package/docs/vi/intlayer_CMS.md +549 -0
- package/docs/vi/intlayer_cli.md +850 -0
- package/docs/vi/intlayer_visual_editor.md +288 -0
- package/docs/vi/intlayer_with_angular.md +692 -0
- package/docs/vi/intlayer_with_astro.md +252 -0
- package/docs/vi/intlayer_with_create_react_app.md +1230 -0
- package/docs/vi/intlayer_with_express.md +409 -0
- package/docs/vi/intlayer_with_lynx+react.md +520 -0
- package/docs/vi/intlayer_with_nestjs.md +272 -0
- package/docs/vi/intlayer_with_next-i18next.md +628 -0
- package/docs/vi/intlayer_with_next-intl.md +446 -0
- package/docs/vi/intlayer_with_nextjs_14.md +1584 -0
- package/docs/vi/intlayer_with_nextjs_15.md +1738 -0
- package/docs/vi/intlayer_with_nextjs_16.md +21 -0
- package/docs/vi/intlayer_with_nextjs_page_router.md +1504 -0
- package/docs/vi/intlayer_with_nuxt.md +821 -0
- package/docs/vi/intlayer_with_react_native+expo.md +700 -0
- package/docs/vi/intlayer_with_react_router_v7.md +498 -0
- package/docs/vi/intlayer_with_tanstack.md +562 -0
- package/docs/vi/intlayer_with_vite+preact.md +1722 -0
- package/docs/vi/intlayer_with_vite+react.md +1407 -0
- package/docs/vi/intlayer_with_vite+solid.md +287 -0
- package/docs/vi/intlayer_with_vite+svelte.md +289 -0
- package/docs/vi/intlayer_with_vite+vue.md +1071 -0
- package/docs/vi/introduction.md +215 -0
- package/docs/vi/locale_mapper.md +242 -0
- package/docs/vi/mcp_server.md +211 -0
- package/docs/vi/packages/express-intlayer/t.md +457 -0
- package/docs/vi/packages/intlayer/getConfiguration.md +145 -0
- package/docs/vi/packages/intlayer/getEnumeration.md +162 -0
- package/docs/vi/packages/intlayer/getHTMLTextDir.md +121 -0
- package/docs/vi/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/vi/packages/intlayer/getLocaleName.md +129 -0
- package/docs/vi/packages/intlayer/getLocalizedUrl.md +309 -0
- package/docs/vi/packages/intlayer/getMultilingualUrls.md +221 -0
- package/docs/vi/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/vi/packages/intlayer/getTranslation.md +201 -0
- package/docs/vi/packages/intlayer/getTranslationContent.md +188 -0
- package/docs/vi/packages/next-intlayer/t.md +352 -0
- package/docs/vi/packages/next-intlayer/useDictionary.md +273 -0
- package/docs/vi/packages/next-intlayer/useIntlayer.md +264 -0
- package/docs/vi/packages/next-intlayer/useLocale.md +166 -0
- package/docs/vi/packages/react-intlayer/t.md +304 -0
- package/docs/vi/packages/react-intlayer/useDictionary.md +288 -0
- package/docs/vi/packages/react-intlayer/useI18n.md +295 -0
- package/docs/vi/packages/react-intlayer/useIntlayer.md +256 -0
- package/docs/vi/packages/react-intlayer/useLocale.md +210 -0
- package/docs/vi/per_locale_file.md +326 -0
- package/docs/vi/readme.md +261 -0
- package/docs/vi/releases/v6.md +305 -0
- package/docs/vi/roadmap.md +346 -0
- package/docs/vi/testing.md +202 -0
- package/docs/vi/vs_code_extension.md +126 -0
- package/docs/zh/configuration.md +6 -0
- package/docs/zh/intlayer_cli.md +8 -3
- package/docs/zh/intlayer_with_next-i18next.md +628 -0
- package/docs/zh/intlayer_with_next-intl.md +448 -0
- package/docs/zh/intlayer_with_nextjs_16.md +21 -0
- package/docs/zh/intlayer_with_tanstack.md +4 -0
- package/docs/zh/intlayer_with_vite+react.md +4 -0
- package/frequent_questions/ar/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ar/array_as_content_declaration.md +1 -2
- package/frequent_questions/ar/build_dictionaries.md +1 -2
- package/frequent_questions/ar/build_error_CI_CD.md +1 -2
- package/frequent_questions/ar/bun_set_up.md +1 -2
- package/frequent_questions/ar/customized_locale_list.md +1 -2
- package/frequent_questions/ar/domain_routing.md +1 -2
- package/frequent_questions/ar/esbuild_error.md +1 -2
- package/frequent_questions/ar/get_locale_cookie.md +1 -2
- package/frequent_questions/ar/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ar/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ar/static_rendering.md +1 -3
- package/frequent_questions/ar/translated_path_url.md +1 -2
- package/frequent_questions/ar/unknown_command.md +1 -2
- package/frequent_questions/de/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/de/array_as_content_declaration.md +1 -2
- package/frequent_questions/de/build_dictionaries.md +1 -2
- package/frequent_questions/de/build_error_CI_CD.md +1 -2
- package/frequent_questions/de/bun_set_up.md +1 -2
- package/frequent_questions/de/customized_locale_list.md +1 -2
- package/frequent_questions/de/domain_routing.md +1 -2
- package/frequent_questions/de/esbuild_error.md +1 -2
- package/frequent_questions/de/get_locale_cookie.md +1 -2
- package/frequent_questions/de/intlayer_command_undefined.md +1 -2
- package/frequent_questions/de/locale_incorect_in_url.md +1 -2
- package/frequent_questions/de/static_rendering.md +1 -3
- package/frequent_questions/de/translated_path_url.md +1 -2
- package/frequent_questions/de/unknown_command.md +1 -2
- package/frequent_questions/en/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/en/array_as_content_declaration.md +1 -2
- package/frequent_questions/en/build_dictionaries.md +1 -2
- package/frequent_questions/en/build_error_CI_CD.md +1 -2
- package/frequent_questions/en/bun_set_up.md +1 -2
- package/frequent_questions/en/customized_locale_list.md +1 -2
- package/frequent_questions/en/domain_routing.md +1 -2
- package/frequent_questions/en/esbuild_error.md +1 -2
- package/frequent_questions/en/get_locale_cookie.md +1 -2
- package/frequent_questions/en/intlayer_command_undefined.md +1 -2
- package/frequent_questions/en/locale_incorect_in_url.md +1 -2
- package/frequent_questions/en/static_rendering.md +1 -3
- package/frequent_questions/en/translated_path_url.md +1 -2
- package/frequent_questions/en/unknown_command.md +1 -2
- package/frequent_questions/en-GB/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/en-GB/array_as_content_declaration.md +1 -2
- package/frequent_questions/en-GB/build_dictionaries.md +1 -2
- package/frequent_questions/en-GB/build_error_CI_CD.md +1 -2
- package/frequent_questions/en-GB/bun_set_up.md +1 -2
- package/frequent_questions/en-GB/customized_locale_list.md +1 -2
- package/frequent_questions/en-GB/domain_routing.md +1 -2
- package/frequent_questions/en-GB/esbuild_error.md +1 -2
- package/frequent_questions/en-GB/get_locale_cookie.md +1 -2
- package/frequent_questions/en-GB/intlayer_command_undefined.md +1 -2
- package/frequent_questions/en-GB/locale_incorect_in_url.md +1 -2
- package/frequent_questions/en-GB/static_rendering.md +1 -3
- package/frequent_questions/en-GB/translated_path_url.md +1 -2
- package/frequent_questions/en-GB/unknown_command.md +1 -2
- package/frequent_questions/es/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/es/array_as_content_declaration.md +1 -2
- package/frequent_questions/es/build_dictionaries.md +1 -2
- package/frequent_questions/es/build_error_CI_CD.md +1 -2
- package/frequent_questions/es/bun_set_up.md +1 -2
- package/frequent_questions/es/customized_locale_list.md +1 -2
- package/frequent_questions/es/domain_routing.md +1 -2
- package/frequent_questions/es/esbuild_error.md +1 -2
- package/frequent_questions/es/get_locale_cookie.md +1 -2
- package/frequent_questions/es/intlayer_command_undefined.md +1 -2
- package/frequent_questions/es/locale_incorect_in_url.md +1 -2
- package/frequent_questions/es/static_rendering.md +1 -3
- package/frequent_questions/es/translated_path_url.md +1 -2
- package/frequent_questions/es/unknown_command.md +1 -2
- package/frequent_questions/fr/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/fr/array_as_content_declaration.md +1 -2
- package/frequent_questions/fr/build_dictionaries.md +1 -2
- package/frequent_questions/fr/build_error_CI_CD.md +1 -2
- package/frequent_questions/fr/bun_set_up.md +1 -2
- package/frequent_questions/fr/customized_locale_list.md +1 -2
- package/frequent_questions/fr/domain_routing.md +1 -2
- package/frequent_questions/fr/esbuild_error.md +1 -2
- package/frequent_questions/fr/get_locale_cookie.md +1 -2
- package/frequent_questions/fr/intlayer_command_undefined.md +1 -2
- package/frequent_questions/fr/locale_incorect_in_url.md +1 -2
- package/frequent_questions/fr/static_rendering.md +1 -3
- package/frequent_questions/fr/translated_path_url.md +1 -2
- package/frequent_questions/fr/unknown_command.md +1 -2
- package/frequent_questions/hi/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/hi/array_as_content_declaration.md +1 -2
- package/frequent_questions/hi/build_dictionaries.md +1 -2
- package/frequent_questions/hi/build_error_CI_CD.md +1 -2
- package/frequent_questions/hi/bun_set_up.md +1 -2
- package/frequent_questions/hi/customized_locale_list.md +1 -2
- package/frequent_questions/hi/domain_routing.md +1 -2
- package/frequent_questions/hi/esbuild_error.md +1 -2
- package/frequent_questions/hi/get_locale_cookie.md +1 -2
- package/frequent_questions/hi/intlayer_command_undefined.md +1 -2
- package/frequent_questions/hi/locale_incorect_in_url.md +1 -2
- package/frequent_questions/hi/static_rendering.md +1 -3
- package/frequent_questions/hi/translated_path_url.md +1 -2
- package/frequent_questions/hi/unknown_command.md +1 -2
- package/frequent_questions/id/SSR_Next_no_[locale].md +104 -0
- package/frequent_questions/id/array_as_content_declaration.md +71 -0
- package/frequent_questions/id/build_dictionaries.md +58 -0
- package/frequent_questions/id/build_error_CI_CD.md +74 -0
- package/frequent_questions/id/bun_set_up.md +53 -0
- package/frequent_questions/id/customized_locale_list.md +64 -0
- package/frequent_questions/id/domain_routing.md +113 -0
- package/frequent_questions/id/esbuild_error.md +29 -0
- package/frequent_questions/id/get_locale_cookie.md +142 -0
- package/frequent_questions/id/intlayer_command_undefined.md +155 -0
- package/frequent_questions/id/locale_incorect_in_url.md +73 -0
- package/frequent_questions/id/static_rendering.md +44 -0
- package/frequent_questions/id/translated_path_url.md +55 -0
- package/frequent_questions/id/unknown_command.md +97 -0
- package/frequent_questions/it/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/it/array_as_content_declaration.md +1 -2
- package/frequent_questions/it/build_dictionaries.md +1 -2
- package/frequent_questions/it/build_error_CI_CD.md +1 -2
- package/frequent_questions/it/bun_set_up.md +1 -2
- package/frequent_questions/it/customized_locale_list.md +1 -2
- package/frequent_questions/it/domain_routing.md +1 -2
- package/frequent_questions/it/esbuild_error.md +1 -2
- package/frequent_questions/it/get_locale_cookie.md +1 -2
- package/frequent_questions/it/intlayer_command_undefined.md +1 -2
- package/frequent_questions/it/locale_incorect_in_url.md +1 -2
- package/frequent_questions/it/static_rendering.md +1 -3
- package/frequent_questions/it/translated_path_url.md +1 -2
- package/frequent_questions/it/unknown_command.md +1 -2
- package/frequent_questions/ja/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ja/array_as_content_declaration.md +1 -2
- package/frequent_questions/ja/build_dictionaries.md +1 -2
- package/frequent_questions/ja/build_error_CI_CD.md +1 -2
- package/frequent_questions/ja/bun_set_up.md +1 -2
- package/frequent_questions/ja/customized_locale_list.md +1 -2
- package/frequent_questions/ja/domain_routing.md +1 -2
- package/frequent_questions/ja/esbuild_error.md +1 -2
- package/frequent_questions/ja/get_locale_cookie.md +1 -2
- package/frequent_questions/ja/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ja/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ja/static_rendering.md +1 -3
- package/frequent_questions/ja/translated_path_url.md +1 -2
- package/frequent_questions/ja/unknown_command.md +1 -2
- package/frequent_questions/ko/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ko/array_as_content_declaration.md +1 -2
- package/frequent_questions/ko/build_dictionaries.md +1 -2
- package/frequent_questions/ko/build_error_CI_CD.md +1 -2
- package/frequent_questions/ko/bun_set_up.md +1 -2
- package/frequent_questions/ko/customized_locale_list.md +1 -2
- package/frequent_questions/ko/domain_routing.md +1 -2
- package/frequent_questions/ko/esbuild_error.md +1 -2
- package/frequent_questions/ko/get_locale_cookie.md +1 -2
- package/frequent_questions/ko/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ko/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ko/static_rendering.md +1 -3
- package/frequent_questions/ko/translated_path_url.md +1 -2
- package/frequent_questions/ko/unknown_command.md +1 -2
- package/frequent_questions/pl/SSR_Next_no_[locale].md +104 -0
- package/frequent_questions/pl/array_as_content_declaration.md +71 -0
- package/frequent_questions/pl/build_dictionaries.md +58 -0
- package/frequent_questions/pl/build_error_CI_CD.md +74 -0
- package/frequent_questions/pl/bun_set_up.md +54 -0
- package/frequent_questions/pl/customized_locale_list.md +64 -0
- package/frequent_questions/pl/domain_routing.md +113 -0
- package/frequent_questions/pl/esbuild_error.md +29 -0
- package/frequent_questions/pl/get_locale_cookie.md +142 -0
- package/frequent_questions/pl/intlayer_command_undefined.md +155 -0
- package/frequent_questions/pl/locale_incorect_in_url.md +73 -0
- package/frequent_questions/pl/static_rendering.md +44 -0
- package/frequent_questions/pl/translated_path_url.md +55 -0
- package/frequent_questions/pl/unknown_command.md +97 -0
- package/frequent_questions/pt/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/pt/array_as_content_declaration.md +1 -2
- package/frequent_questions/pt/build_dictionaries.md +1 -2
- package/frequent_questions/pt/build_error_CI_CD.md +1 -2
- package/frequent_questions/pt/bun_set_up.md +1 -2
- package/frequent_questions/pt/customized_locale_list.md +1 -2
- package/frequent_questions/pt/domain_routing.md +1 -2
- package/frequent_questions/pt/esbuild_error.md +1 -2
- package/frequent_questions/pt/get_locale_cookie.md +1 -2
- package/frequent_questions/pt/intlayer_command_undefined.md +1 -2
- package/frequent_questions/pt/locale_incorect_in_url.md +1 -2
- package/frequent_questions/pt/static_rendering.md +1 -3
- package/frequent_questions/pt/translated_path_url.md +1 -2
- package/frequent_questions/pt/unknown_command.md +1 -2
- package/frequent_questions/ru/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ru/array_as_content_declaration.md +1 -2
- package/frequent_questions/ru/build_dictionaries.md +1 -2
- package/frequent_questions/ru/build_error_CI_CD.md +1 -2
- package/frequent_questions/ru/bun_set_up.md +1 -2
- package/frequent_questions/ru/customized_locale_list.md +1 -2
- package/frequent_questions/ru/domain_routing.md +1 -2
- package/frequent_questions/ru/esbuild_error.md +1 -2
- package/frequent_questions/ru/get_locale_cookie.md +1 -2
- package/frequent_questions/ru/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ru/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ru/static_rendering.md +1 -2
- package/frequent_questions/ru/translated_path_url.md +1 -2
- package/frequent_questions/ru/unknown_command.md +1 -2
- package/frequent_questions/tr/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/tr/array_as_content_declaration.md +1 -2
- package/frequent_questions/tr/build_dictionaries.md +1 -2
- package/frequent_questions/tr/build_error_CI_CD.md +1 -2
- package/frequent_questions/tr/bun_set_up.md +1 -2
- package/frequent_questions/tr/customized_locale_list.md +1 -2
- package/frequent_questions/tr/domain_routing.md +1 -2
- package/frequent_questions/tr/esbuild_error.md +1 -2
- package/frequent_questions/tr/get_locale_cookie.md +1 -2
- package/frequent_questions/tr/intlayer_command_undefined.md +1 -2
- package/frequent_questions/tr/locale_incorect_in_url.md +1 -2
- package/frequent_questions/tr/static_rendering.md +1 -2
- package/frequent_questions/tr/translated_path_url.md +1 -2
- package/frequent_questions/tr/unknown_command.md +1 -2
- package/frequent_questions/vi/SSR_Next_no_[locale].md +106 -0
- package/frequent_questions/vi/array_as_content_declaration.md +71 -0
- package/frequent_questions/vi/build_dictionaries.md +58 -0
- package/frequent_questions/vi/build_error_CI_CD.md +74 -0
- package/frequent_questions/vi/bun_set_up.md +53 -0
- package/frequent_questions/vi/customized_locale_list.md +64 -0
- package/frequent_questions/vi/domain_routing.md +113 -0
- package/frequent_questions/vi/esbuild_error.md +29 -0
- package/frequent_questions/vi/get_locale_cookie.md +142 -0
- package/frequent_questions/vi/intlayer_command_undefined.md +155 -0
- package/frequent_questions/vi/locale_incorect_in_url.md +73 -0
- package/frequent_questions/vi/static_rendering.md +44 -0
- package/frequent_questions/vi/translated_path_url.md +55 -0
- package/frequent_questions/vi/unknown_command.md +97 -0
- package/frequent_questions/zh/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/zh/array_as_content_declaration.md +1 -2
- package/frequent_questions/zh/build_dictionaries.md +1 -2
- package/frequent_questions/zh/build_error_CI_CD.md +1 -2
- package/frequent_questions/zh/bun_set_up.md +1 -2
- package/frequent_questions/zh/customized_locale_list.md +1 -2
- package/frequent_questions/zh/domain_routing.md +1 -2
- package/frequent_questions/zh/esbuild_error.md +1 -2
- package/frequent_questions/zh/get_locale_cookie.md +1 -2
- package/frequent_questions/zh/intlayer_command_undefined.md +1 -2
- package/frequent_questions/zh/locale_incorect_in_url.md +1 -2
- package/frequent_questions/zh/static_rendering.md +1 -3
- package/frequent_questions/zh/translated_path_url.md +1 -2
- package/frequent_questions/zh/unknown_command.md +1 -2
- package/legal/id/privacy_notice.md +83 -0
- package/legal/id/terms_of_service.md +55 -0
- package/legal/pl/privacy_notice.md +83 -0
- package/legal/pl/terms_of_service.md +55 -0
- package/legal/vi/privacy_notice.md +83 -0
- package/legal/vi/terms_of_service.md +55 -0
- package/package.json +19 -18
- package/src/generated/blog.entry.ts +38 -0
|
@@ -0,0 +1,1071 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2025-04-18
|
|
3
|
+
updatedAt: 2025-06-29
|
|
4
|
+
title: Cách dịch ứng dụng Vite và Vue của bạn – hướng dẫn i18n 2025
|
|
5
|
+
description: Khám phá cách làm cho trang web Vite và Vue của bạn đa ngôn ngữ. Theo dõi tài liệu để quốc tế hóa (i18n) và dịch nó.
|
|
6
|
+
keywords:
|
|
7
|
+
- Quốc tế hóa
|
|
8
|
+
- Tài liệu
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Vite
|
|
11
|
+
- Vue
|
|
12
|
+
- JavaScript
|
|
13
|
+
slugs:
|
|
14
|
+
- doc
|
|
15
|
+
- environment
|
|
16
|
+
- vite-and-vue
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-vue-template
|
|
18
|
+
history:
|
|
19
|
+
- version: 5.5.10
|
|
20
|
+
date: 2025-06-29
|
|
21
|
+
changes: Khởi tạo lịch sử
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Dịch trang web Vite và Vue của bạn bằng Intlayer | Quốc tế hóa (i18n)
|
|
25
|
+
|
|
26
|
+
## Mục lục
|
|
27
|
+
|
|
28
|
+
<TOC/>
|
|
29
|
+
|
|
30
|
+
## Intlayer là gì?
|
|
31
|
+
|
|
32
|
+
**Intlayer** là một thư viện quốc tế hóa (i18n) mã nguồn mở sáng tạo, được thiết kế để đơn giản hóa việc hỗ trợ đa ngôn ngữ trong các ứng dụng web hiện đại.
|
|
33
|
+
|
|
34
|
+
Với Intlayer, bạn có thể:
|
|
35
|
+
|
|
36
|
+
- **Dễ dàng quản lý bản dịch** bằng cách sử dụng từ điển khai báo ở cấp độ component.
|
|
37
|
+
- **Định vị động metadata**, các route và nội dung.
|
|
38
|
+
- **Đảm bảo hỗ trợ TypeScript** với các kiểu tự động tạo, cải thiện tính năng tự động hoàn thành và phát hiện lỗi.
|
|
39
|
+
- **Tận hưởng các tính năng nâng cao**, như phát hiện và chuyển đổi locale động.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Hướng dẫn từng bước để thiết lập Intlayer trong ứng dụng Vite và Vue
|
|
44
|
+
|
|
45
|
+
<iframe
|
|
46
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-vite-vue-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
47
|
+
Xem [Mẫu Ứng Dụng](https://github.com/aymericzip/intlayer-vite-vue-template) trên GitHub.
|
|
48
|
+
|
|
49
|
+
### Bước 1: Cài Đặt Các Phụ Thuộc
|
|
50
|
+
|
|
51
|
+
Cài đặt các gói cần thiết bằng npm:
|
|
52
|
+
|
|
53
|
+
```bash packageManager="npm"
|
|
54
|
+
npm install intlayer vue-intlayer
|
|
55
|
+
npm install vite-intlayer --save-dev
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```bash packageManager="pnpm"
|
|
59
|
+
pnpm add intlayer vue-intlayer
|
|
60
|
+
pnpm add vite-intlayer --save-dev
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```bash packageManager="yarn"
|
|
64
|
+
yarn add intlayer vue-intlayer
|
|
65
|
+
yarn add vite-intlayer --save-dev
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- **intlayer**
|
|
69
|
+
|
|
70
|
+
Gói cốt lõi cung cấp các công cụ quốc tế hóa cho quản lý cấu hình, dịch thuật, [khai báo nội dung](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/dictionary/content_file.md), biên dịch lại, và [các lệnh CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_cli.md).
|
|
71
|
+
|
|
72
|
+
- **vue-intlayer**
|
|
73
|
+
Gói tích hợp Intlayer với ứng dụng Vue. Nó cung cấp các context provider và composable cho việc quốc tế hóa trong Vue.
|
|
74
|
+
|
|
75
|
+
- **vite-intlayer**
|
|
76
|
+
Bao gồm plugin Vite để tích hợp Intlayer với [trình đóng gói Vite](https://vite.dev/guide/why.html#why-bundle-for-production), cũng như middleware để phát hiện ngôn ngữ ưu tiên của người dùng, quản lý cookie, và xử lý chuyển hướng URL.
|
|
77
|
+
|
|
78
|
+
### Bước 2: Cấu hình dự án của bạn
|
|
79
|
+
|
|
80
|
+
Tạo một file cấu hình để cấu hình các ngôn ngữ của ứng dụng của bạn:
|
|
81
|
+
|
|
82
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
83
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
84
|
+
|
|
85
|
+
const config: IntlayerConfig = {
|
|
86
|
+
internationalization: {
|
|
87
|
+
locales: [
|
|
88
|
+
Locales.ENGLISH,
|
|
89
|
+
Locales.FRENCH,
|
|
90
|
+
Locales.SPANISH,
|
|
91
|
+
// Các ngôn ngữ khác của bạn
|
|
92
|
+
],
|
|
93
|
+
defaultLocale: Locales.ENGLISH,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default config;
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
101
|
+
import { Locales } from "intlayer";
|
|
102
|
+
|
|
103
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
104
|
+
const config = {
|
|
105
|
+
internationalization: {
|
|
106
|
+
locales: [
|
|
107
|
+
Locales.ENGLISH,
|
|
108
|
+
Locales.FRENCH,
|
|
109
|
+
Locales.SPANISH,
|
|
110
|
+
// Các ngôn ngữ khác của bạn
|
|
111
|
+
],
|
|
112
|
+
defaultLocale: Locales.ENGLISH,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default config;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
120
|
+
const { Locales } = require("intlayer");
|
|
121
|
+
|
|
122
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
123
|
+
const config = {
|
|
124
|
+
internationalization: {
|
|
125
|
+
locales: [
|
|
126
|
+
Locales.ENGLISH,
|
|
127
|
+
Locales.FRENCH,
|
|
128
|
+
Locales.SPANISH,
|
|
129
|
+
// Các ngôn ngữ khác của bạn
|
|
130
|
+
],
|
|
131
|
+
defaultLocale: Locales.ENGLISH,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
module.exports = config;
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
> Thông qua tệp cấu hình này, bạn có thể thiết lập các URL địa phương hóa, chuyển hướng middleware, tên cookie, vị trí và phần mở rộng của các khai báo nội dung của bạn, tắt các bản ghi Intlayer trên console, và nhiều hơn nữa. Để xem danh sách đầy đủ các tham số có sẵn, hãy tham khảo [tài liệu cấu hình](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/configuration.md).
|
|
139
|
+
|
|
140
|
+
### Bước 3: Tích hợp Intlayer vào cấu hình Vite của bạn
|
|
141
|
+
|
|
142
|
+
Thêm plugin intlayer vào cấu hình của bạn.
|
|
143
|
+
|
|
144
|
+
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
145
|
+
import { defineConfig } from "vite";
|
|
146
|
+
import vue from "@vitejs/plugin-vue";
|
|
147
|
+
import { intlayer } from "vite-intlayer";
|
|
148
|
+
|
|
149
|
+
// https://vitejs.dev/config/
|
|
150
|
+
export default defineConfig({
|
|
151
|
+
plugins: [vue(), intlayer()],
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
156
|
+
import { defineConfig } from "vite";
|
|
157
|
+
import vue from "@vitejs/plugin-vue";
|
|
158
|
+
import { intlayer } from "vite-intlayer";
|
|
159
|
+
|
|
160
|
+
// https://vitejs.dev/config/
|
|
161
|
+
export default defineConfig({
|
|
162
|
+
plugins: [vue(), intlayer()],
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
```javascript fileName="vite.config.cjs" codeFormat="commonjs"
|
|
167
|
+
const { defineConfig } = require("vite");
|
|
168
|
+
const vue = require("@vitejs/plugin-vue");
|
|
169
|
+
const { intlayer } = require("vite-intlayer");
|
|
170
|
+
|
|
171
|
+
// https://vitejs.dev/config/
|
|
172
|
+
module.exports = defineConfig({
|
|
173
|
+
plugins: [vue(), intlayer()],
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
> Plugin Vite `intlayer()` được sử dụng để tích hợp Intlayer với Vite. Nó đảm bảo việc xây dựng các tệp khai báo nội dung và giám sát chúng trong chế độ phát triển. Nó định nghĩa các biến môi trường Intlayer trong ứng dụng Vite. Ngoài ra, nó cung cấp các bí danh để tối ưu hóa hiệu suất.
|
|
178
|
+
|
|
179
|
+
### Bước 4: Khai báo Nội dung của Bạn
|
|
180
|
+
|
|
181
|
+
Tạo và quản lý các khai báo nội dung để lưu trữ các bản dịch:
|
|
182
|
+
|
|
183
|
+
```tsx fileName="src/helloWorld.content.ts" contentDeclarationFormat="typescript"
|
|
184
|
+
import { t, type Dictionary } from "intlayer";
|
|
185
|
+
|
|
186
|
+
const helloWorldContent = {
|
|
187
|
+
key: "helloworld",
|
|
188
|
+
content: {
|
|
189
|
+
count: t({ en: "count is ", fr: "le compte est ", es: "el recuento es " }),
|
|
190
|
+
edit: t({
|
|
191
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
192
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
193
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
194
|
+
}),
|
|
195
|
+
checkOut: t({ en: "Check out ", fr: "Vérifiez ", es: "Compruebe " }),
|
|
196
|
+
officialStarter: t({
|
|
197
|
+
en: ", the official Vue + Vite starter",
|
|
198
|
+
fr: ", le starter officiel Vue + Vite",
|
|
199
|
+
es: ", el starter oficial Vue + Vite",
|
|
200
|
+
}),
|
|
201
|
+
learnMore: t({
|
|
202
|
+
en: "Learn more about IDE Support for Vue in the ",
|
|
203
|
+
fr: "En savoir plus sur le support IDE pour Vue dans le ",
|
|
204
|
+
es: "Aprenda más sobre el soporte IDE para Vue en el ",
|
|
205
|
+
}),
|
|
206
|
+
vueDocs: t({
|
|
207
|
+
en: "Vue Docs Scaling up Guide",
|
|
208
|
+
fr: "Vue Docs Scaling up Guide",
|
|
209
|
+
es: "Vue Docs Scaling up Guide",
|
|
210
|
+
}),
|
|
211
|
+
readTheDocs: t({
|
|
212
|
+
en: "Click on the Vite and Vue logos to learn more",
|
|
213
|
+
fr: "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
214
|
+
es: "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
215
|
+
vi: "Nhấp vào biểu tượng Vite và Vue để tìm hiểu thêm",
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
} satisfies Dictionary;
|
|
219
|
+
|
|
220
|
+
export default helloWorldContent;
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
```javascript fileName="src/helloWorld.content.mjs" contentDeclarationFormat="esm"
|
|
224
|
+
import { t } from "intlayer";
|
|
225
|
+
|
|
226
|
+
/** @type {import('intlayer').Dictionary} */
|
|
227
|
+
const helloWorldContent = {
|
|
228
|
+
key: "helloworld",
|
|
229
|
+
content: {
|
|
230
|
+
count: t({ en: "count is ", fr: "le compte est ", es: "el recuento es ", vi: "số đếm là " }),
|
|
231
|
+
edit: t({
|
|
232
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
233
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
234
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
235
|
+
vi: "Chỉnh sửa <code>components/HelloWorld.vue</code> và lưu để thử HMR",
|
|
236
|
+
}),
|
|
237
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
238
|
+
vi: "Chỉnh sửa <code>components/HelloWorld.vue</code> và lưu để thử HMR",
|
|
239
|
+
}),
|
|
240
|
+
checkOut: t({ en: "Check out ", fr: "Vérifiez ", es: "Compruebe ", vi: "Xem " }),
|
|
241
|
+
officialStarter: t({
|
|
242
|
+
en: "the official Vue + Vite starter",
|
|
243
|
+
fr: "le starter officiel Vue + Vite",
|
|
244
|
+
es: "el starter oficial Vue + Vite",
|
|
245
|
+
vi: "bộ khởi động chính thức Vue + Vite",
|
|
246
|
+
}),
|
|
247
|
+
learnMore: t({
|
|
248
|
+
en: "Learn more about IDE Support for Vue in the ",
|
|
249
|
+
fr: "En savoir plus sur le support IDE pour Vue dans le ",
|
|
250
|
+
es: "Aprenda más sobre el soporte IDE para Vue en el ",
|
|
251
|
+
vi: "Tìm hiểu thêm về Hỗ trợ IDE cho Vue trong ",
|
|
252
|
+
}),
|
|
253
|
+
vueDocs: t({
|
|
254
|
+
en: "Vue Docs Scaling up Guide",
|
|
255
|
+
fr: "Vue Docs Scaling up Guide",
|
|
256
|
+
es: "Vue Docs Scaling up Guide",
|
|
257
|
+
vi: "Hướng dẫn mở rộng Vue Docs",
|
|
258
|
+
}),
|
|
259
|
+
readTheDocs: t({
|
|
260
|
+
en: "Click on the Vite and Vue logos to learn more",
|
|
261
|
+
fr: "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
262
|
+
es: "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
263
|
+
vi: "Nhấp vào biểu tượng Vite và Vue để tìm hiểu thêm",
|
|
264
|
+
}),
|
|
265
|
+
fr: "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
266
|
+
es: "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
267
|
+
vi: "Nhấp vào các biểu tượng Vite và Vue để tìm hiểu thêm",
|
|
268
|
+
}),
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export default helloWorldContent;
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
```javascript fileName="src/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
|
|
276
|
+
const { t } = require("intlayer");
|
|
277
|
+
|
|
278
|
+
/** @type {import('intlayer').Dictionary} */
|
|
279
|
+
const appContent = {
|
|
280
|
+
key: "helloworld",
|
|
281
|
+
content: {
|
|
282
|
+
count: t({
|
|
283
|
+
en: "count is ",
|
|
284
|
+
fr: "le compte est ",
|
|
285
|
+
es: "el recuento es ",
|
|
286
|
+
vi: "số đếm là ",
|
|
287
|
+
}),
|
|
288
|
+
edit: t({
|
|
289
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
290
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
291
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
292
|
+
vi: "Chỉnh sửa <code>components/HelloWorld.vue</code> và lưu để thử nghiệm HMR",
|
|
293
|
+
}),
|
|
294
|
+
checkOut: t({ en: "Check out ", vi: "Xem " }),
|
|
295
|
+
officialStarter: t({
|
|
296
|
+
en: "the official Vue + Vite starter",
|
|
297
|
+
vi: "bộ khởi động chính thức Vue + Vite",
|
|
298
|
+
}),
|
|
299
|
+
learnMore: t({
|
|
300
|
+
en: "Learn more about IDE Support for Vue in the ",
|
|
301
|
+
vi: "Tìm hiểu thêm về Hỗ trợ IDE cho Vue trong ",
|
|
302
|
+
}),
|
|
303
|
+
vueDocs: t({
|
|
304
|
+
en: "Vue Docs Scaling up Guide",
|
|
305
|
+
vi: "Hướng dẫn mở rộng Vue Docs",
|
|
306
|
+
}),
|
|
307
|
+
readTheDocs: t({
|
|
308
|
+
en: "Click on the Vite and Vue logos to learn more",
|
|
309
|
+
vi: "Nhấp vào biểu tượng Vite và Vue để tìm hiểu thêm",
|
|
310
|
+
es: "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
311
|
+
vi: "Nhấp vào các biểu tượng Vite và Vue để tìm hiểu thêm",
|
|
312
|
+
}),
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
module.exports = appContent;
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
```json fileName="src/helloWorld.content.json" contentDeclarationFormat="json"
|
|
320
|
+
{
|
|
321
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
322
|
+
"key": "helloworld",
|
|
323
|
+
"content": {
|
|
324
|
+
"count": {
|
|
325
|
+
"nodeType": "translation",
|
|
326
|
+
"translation": {
|
|
327
|
+
"en": "count is ",
|
|
328
|
+
"fr": "le compte est ",
|
|
329
|
+
"es": "el recuento es ",
|
|
330
|
+
"vi": "số đếm là "
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"edit": {
|
|
334
|
+
"nodeType": "translation",
|
|
335
|
+
"translation": {
|
|
336
|
+
"en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
337
|
+
"fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
338
|
+
"es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
339
|
+
"vi": "Chỉnh sửa <code>components/HelloWorld.vue</code> và lưu để thử nghiệm HMR"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
"checkOut": {
|
|
346
|
+
"nodeType": "translation",
|
|
347
|
+
"translation": {
|
|
348
|
+
"en": "Check out ",
|
|
349
|
+
"fr": "Vérifiez ",
|
|
350
|
+
"es": "Compruebe ",
|
|
351
|
+
"vi": "Xem thử "
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
"officialStarter": {
|
|
355
|
+
"nodeType": "translation",
|
|
356
|
+
"translation": {
|
|
357
|
+
"en": "the official Vue + Vite starter",
|
|
358
|
+
"fr": "le starter officiel Vue + Vite",
|
|
359
|
+
"es": "el starter oficial Vue + Vite",
|
|
360
|
+
"vi": "bộ khởi đầu chính thức Vue + Vite"
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"learnMore": {
|
|
364
|
+
"nodeType": "translation",
|
|
365
|
+
"translation": {
|
|
366
|
+
"en": "Learn more about IDE Support for Vue in the ",
|
|
367
|
+
"fr": "En savoir plus sur le support IDE pour Vue dans le ",
|
|
368
|
+
"es": "Aprenda más sobre el soporte IDE para Vue en el ",
|
|
369
|
+
"vi": "Tìm hiểu thêm về Hỗ trợ IDE cho Vue trong "
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"vueDocs": {
|
|
373
|
+
"nodeType": "translation",
|
|
374
|
+
"translation": {
|
|
375
|
+
"en": "Vue Docs Scaling up Guide",
|
|
376
|
+
"fr": "Vue Docs Scaling up Guide",
|
|
377
|
+
"es": "Vue Docs Scaling up Guide",
|
|
378
|
+
"vi": "Hướng dẫn mở rộng Vue Docs"
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
"readTheDocs": {
|
|
382
|
+
"nodeType": "translation",
|
|
383
|
+
"translation": {
|
|
384
|
+
"en": "Click on the Vite and Vue logos to learn more",
|
|
385
|
+
"fr": "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
386
|
+
"es": "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
387
|
+
"vi": "Nhấp vào biểu tượng Vite và Vue để tìm hiểu thêm"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
> Các khai báo nội dung của bạn có thể được định nghĩa ở bất kỳ đâu trong ứng dụng của bạn miễn là chúng được bao gồm trong thư mục `contentDir` (mặc định là `./src`). Và phù hợp với phần mở rộng tệp khai báo nội dung (mặc định là `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
395
|
+
|
|
396
|
+
> Để biết thêm chi tiết, hãy tham khảo [tài liệu khai báo nội dung](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/dictionary/content_file.md).
|
|
397
|
+
|
|
398
|
+
### Bước 5: Sử dụng Intlayer trong Mã của Bạn
|
|
399
|
+
|
|
400
|
+
Để sử dụng các tính năng quốc tế hóa của Intlayer trong toàn bộ ứng dụng Vue của bạn, trước tiên bạn cần đăng ký thể hiện singleton của Intlayer trong tệp chính của bạn. Bước này rất quan trọng vì nó cung cấp ngữ cảnh quốc tế hóa cho tất cả các thành phần trong ứng dụng của bạn, giúp các bản dịch có thể truy cập được ở bất kỳ đâu trong cây thành phần của bạn.
|
|
401
|
+
|
|
402
|
+
```javascript fileName=main.js
|
|
403
|
+
import { createApp } from "vue";
|
|
404
|
+
import { installIntlayer } from "vue-intlayer";
|
|
405
|
+
import App from "./App.vue";
|
|
406
|
+
import "./style.css";
|
|
407
|
+
|
|
408
|
+
const app = createApp(App);
|
|
409
|
+
|
|
410
|
+
// Tiêm provider ở cấp cao nhất
|
|
411
|
+
installIntlayer(app);
|
|
412
|
+
|
|
413
|
+
// Gắn ứng dụng
|
|
414
|
+
app.mount("#app");
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Truy cập các từ điển nội dung của bạn trong toàn bộ ứng dụng bằng cách tạo một thành phần Vue chính và sử dụng các composable `useIntlayer`:
|
|
418
|
+
|
|
419
|
+
```vue fileName="src/HelloWord.vue"
|
|
420
|
+
<script setup lang="ts">
|
|
421
|
+
import { ref } from "vue";
|
|
422
|
+
import { useIntlayer } from "vue-intlayer";
|
|
423
|
+
|
|
424
|
+
defineProps({
|
|
425
|
+
msg: String,
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
const {
|
|
429
|
+
count,
|
|
430
|
+
edit,
|
|
431
|
+
checkOut,
|
|
432
|
+
officialStarter,
|
|
433
|
+
learnMore,
|
|
434
|
+
vueDocs,
|
|
435
|
+
readTheDocs,
|
|
436
|
+
} = useIntlayer("helloworld");
|
|
437
|
+
const countRef = ref(0);
|
|
438
|
+
</script>
|
|
439
|
+
|
|
440
|
+
<template>
|
|
441
|
+
<h1>{{ msg }}</h1>
|
|
442
|
+
|
|
443
|
+
<div class="card">
|
|
444
|
+
<button type="button" @click="countRef++">
|
|
445
|
+
<count />
|
|
446
|
+
{{ countRef }}
|
|
447
|
+
</button>
|
|
448
|
+
<p v-html="edit"></p>
|
|
449
|
+
</div>
|
|
450
|
+
|
|
451
|
+
<p>
|
|
452
|
+
<checkOut />
|
|
453
|
+
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
|
454
|
+
>create-vue</a
|
|
455
|
+
>, <officialStarter />
|
|
456
|
+
</p>
|
|
457
|
+
<p>
|
|
458
|
+
<learnMore />
|
|
459
|
+
<a
|
|
460
|
+
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
|
461
|
+
target="_blank"
|
|
462
|
+
><vueDocs /></a
|
|
463
|
+
>.
|
|
464
|
+
</p>
|
|
465
|
+
<p class="read-the-docs"><readTheDocs /></p>
|
|
466
|
+
<p class="read-the-docs">{{ readTheDocs }}</p>
|
|
467
|
+
</template>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
#### Truy cập Nội dung trong Intlayer
|
|
471
|
+
|
|
472
|
+
Intlayer cung cấp các API khác nhau để truy cập nội dung của bạn:
|
|
473
|
+
|
|
474
|
+
- **Cú pháp dựa trên Component** (khuyến nghị):
|
|
475
|
+
Sử dụng cú pháp `<myContent />`, hoặc `<Component :is="myContent" />` để render nội dung dưới dạng một Node của Intlayer. Điều này tích hợp liền mạch với [Visual Editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) và [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).
|
|
476
|
+
|
|
477
|
+
- **Cú pháp dựa trên chuỗi**:
|
|
478
|
+
Sử dụng `{{ myContent }}` để render nội dung dưới dạng văn bản thuần, không hỗ trợ Visual Editor.
|
|
479
|
+
|
|
480
|
+
- **Cú pháp HTML thô**:
|
|
481
|
+
Sử dụng `<div v-html="myContent" />` để hiển thị nội dung dưới dạng HTML thô, không hỗ trợ Visual Editor.
|
|
482
|
+
|
|
483
|
+
- **Cú pháp phân rã (Destructuration syntax)**:
|
|
484
|
+
Composable `useIntlayer` trả về một Proxy chứa nội dung. Proxy này có thể được phân rã để truy cập nội dung trong khi vẫn giữ được tính phản ứng.
|
|
485
|
+
- Sử dụng `const content = useIntlayer("myContent");` và `{{ content.myContent }}` / `<content.myContent />`.
|
|
486
|
+
- Hoặc sử dụng `const { myContent } = useIntlayer("myContent");` và `{{ myContent}}` / `<myContent/>` để phân rã nội dung.
|
|
487
|
+
|
|
488
|
+
### (Tùy chọn) Bước 6: Thay đổi ngôn ngữ của nội dung
|
|
489
|
+
|
|
490
|
+
Để thay đổi ngôn ngữ của nội dung, bạn có thể sử dụng hàm `setLocale` được cung cấp bởi composable `useLocale`. Hàm này cho phép bạn thiết lập locale của ứng dụng và cập nhật nội dung tương ứng.
|
|
491
|
+
|
|
492
|
+
Tạo một component để chuyển đổi giữa các ngôn ngữ:
|
|
493
|
+
|
|
494
|
+
```vue fileName="src/components/LocaleSwitcher.vue"
|
|
495
|
+
<template>
|
|
496
|
+
<div class="locale-switcher">
|
|
497
|
+
<select v-model="selectedLocale" @change="changeLocale">
|
|
498
|
+
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
499
|
+
{{ getLocaleName(loc) }}
|
|
500
|
+
</option>
|
|
501
|
+
</select>
|
|
502
|
+
</div>
|
|
503
|
+
</template>
|
|
504
|
+
|
|
505
|
+
<script setup lang="ts">
|
|
506
|
+
import { ref, watch } from "vue";
|
|
507
|
+
import { getLocaleName } from "intlayer";
|
|
508
|
+
import { useLocale } from "vue-intlayer";
|
|
509
|
+
|
|
510
|
+
// Lấy thông tin locale và hàm setLocale
|
|
511
|
+
const { locale, availableLocales, setLocale } = useLocale();
|
|
512
|
+
|
|
513
|
+
// Theo dõi locale được chọn bằng ref
|
|
514
|
+
const selectedLocale = ref(locale.value);
|
|
515
|
+
|
|
516
|
+
// Cập nhật locale khi lựa chọn thay đổi
|
|
517
|
+
const changeLocale = () => setLocale(selectedLocale.value);
|
|
518
|
+
|
|
519
|
+
// Giữ cho selectedLocale đồng bộ với locale toàn cục
|
|
520
|
+
watch(
|
|
521
|
+
() => locale.value,
|
|
522
|
+
(newLocale) => {
|
|
523
|
+
selectedLocale.value = newLocale;
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
</script>
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
Sau đó, sử dụng component này trong App.vue của bạn:
|
|
530
|
+
|
|
531
|
+
```vue fileName="src/App.vue"
|
|
532
|
+
<script setup lang="ts">
|
|
533
|
+
import { useIntlayer } from "vue-intlayer";
|
|
534
|
+
import HelloWorld from "@components/HelloWorld.vue";
|
|
535
|
+
import LocaleSwitcher from "@components/LocaleSwitcher.vue";
|
|
536
|
+
import { ref, watch } from "vue";
|
|
537
|
+
|
|
538
|
+
const content = useIntlayer("app"); // Tạo file khai báo intlayer liên quan
|
|
539
|
+
</script>
|
|
540
|
+
|
|
541
|
+
<template>
|
|
542
|
+
<div>
|
|
543
|
+
<LocaleSwitcher />
|
|
544
|
+
<a href="https://vite.dev" target="_blank">
|
|
545
|
+
<img src="/vite.svg" class="logo" :alt="content.viteLogo" />
|
|
546
|
+
</a>
|
|
547
|
+
<a href="https://vuejs.org/" target="_blank">
|
|
548
|
+
<img src="./assets/vue.svg" class="logo vue" :alt="content.vueLogo" />
|
|
549
|
+
</a>
|
|
550
|
+
</div>
|
|
551
|
+
<HelloWorld :msg="content.title" />
|
|
552
|
+
</template>
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
### (Tùy chọn) Bước 7: Thêm định tuyến có địa phương hóa vào ứng dụng của bạn
|
|
556
|
+
|
|
557
|
+
Thêm định tuyến có địa phương hóa trong ứng dụng Vue thường liên quan đến việc sử dụng Vue Router với tiền tố locale. Điều này tạo ra các tuyến đường riêng biệt cho mỗi ngôn ngữ, rất hữu ích cho SEO và URL thân thiện với SEO.
|
|
558
|
+
|
|
559
|
+
Ví dụ:
|
|
560
|
+
|
|
561
|
+
```plaintext
|
|
562
|
+
- https://example.com/about
|
|
563
|
+
- https://example.com/es/about
|
|
564
|
+
- https://example.com/fr/about
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
Trước tiên, cài đặt Vue Router:
|
|
568
|
+
|
|
569
|
+
```bash packageManager="npm"
|
|
570
|
+
npm install intlayer vue-router
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
```bash packageManager="pnpm"
|
|
574
|
+
pnpm add intlayer vue-router
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
```bash packageManager="yarn"
|
|
578
|
+
yarn add intlayer vue-router
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
Sau đó, tạo một cấu hình router xử lý định tuyến dựa trên ngôn ngữ:
|
|
582
|
+
|
|
583
|
+
```js fileName="src/router/index.ts"
|
|
584
|
+
import {
|
|
585
|
+
configuration,
|
|
586
|
+
getPathWithoutLocale,
|
|
587
|
+
localeFlatMap,
|
|
588
|
+
type Locales,
|
|
589
|
+
} from 'intlayer';
|
|
590
|
+
import { createIntlayerClient } from 'vue-intlayer';
|
|
591
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
592
|
+
import HomeView from './views/home/HomeView.vue';
|
|
593
|
+
import RootView from './views/root/Root.vue';
|
|
594
|
+
|
|
595
|
+
// Lấy cấu hình quốc tế hóa
|
|
596
|
+
const { internationalization, middleware } = configuration;
|
|
597
|
+
const { defaultLocale } = internationalization;
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Khai báo các route với đường dẫn và metadata theo từng ngôn ngữ.
|
|
601
|
+
*/
|
|
602
|
+
const routes = localeFlatMap((localizedData) => [
|
|
603
|
+
{
|
|
604
|
+
path: `${localizedData.urlPrefix}/`,
|
|
605
|
+
name: `Root-${localizedData.locale}`,
|
|
606
|
+
component: RootView,
|
|
607
|
+
meta: {
|
|
608
|
+
locale: localizedData.locale,
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
path: `${localizedData.urlPrefix}/home`,
|
|
613
|
+
name: `Home-${localizedData.locale}`,
|
|
614
|
+
component: HomeView,
|
|
615
|
+
meta: {
|
|
616
|
+
locale: localizedData.locale,
|
|
617
|
+
},
|
|
618
|
+
},
|
|
619
|
+
]);
|
|
620
|
+
|
|
621
|
+
// Tạo instance router
|
|
622
|
+
export const router = createRouter({
|
|
623
|
+
history: createWebHistory(),
|
|
624
|
+
routes,
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
// Thêm navigation guard để xử lý locale
|
|
628
|
+
router.beforeEach((to, _from, next) => {
|
|
629
|
+
const client = createIntlayerClient();
|
|
630
|
+
|
|
631
|
+
const metaLocale = to.meta.locale as Locales | undefined;
|
|
632
|
+
|
|
633
|
+
if (metaLocale) {
|
|
634
|
+
// Tái sử dụng locale đã định nghĩa trong meta của route
|
|
635
|
+
client.setLocale(metaLocale);
|
|
636
|
+
next();
|
|
637
|
+
} else {
|
|
638
|
+
// Trường hợp fallback: không có locale trong meta, có thể là route không khớp
|
|
639
|
+
// Tùy chọn: xử lý 404 hoặc chuyển hướng về locale mặc định
|
|
640
|
+
client.setLocale(defaultLocale);
|
|
641
|
+
|
|
642
|
+
if (middleware.prefixDefault) {
|
|
643
|
+
next(`/${defaultLocale}${getPathWithoutLocale(to.path)}`);
|
|
644
|
+
} else {
|
|
645
|
+
next(getPathWithoutLocale(to.path));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
> Tên được sử dụng để nhận diện route trong router. Nó nên là duy nhất trên tất cả các route để tránh xung đột và đảm bảo điều hướng cũng như liên kết chính xác.
|
|
652
|
+
|
|
653
|
+
Sau đó, đăng ký router trong file main.js của bạn:
|
|
654
|
+
|
|
655
|
+
```js fileName="src/main.ts"
|
|
656
|
+
import { createApp } from "vue";
|
|
657
|
+
import App from "./App.vue";
|
|
658
|
+
import { router } from "./router";
|
|
659
|
+
import "./style.css";
|
|
660
|
+
|
|
661
|
+
const app = createApp(App);
|
|
662
|
+
|
|
663
|
+
// Thêm router vào ứng dụng
|
|
664
|
+
app.use(router);
|
|
665
|
+
|
|
666
|
+
// Gắn ứng dụng lên DOM
|
|
667
|
+
app.mount("#app");
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
Sau đó cập nhật file `App.vue` của bạn để render component RouterView. Component này sẽ hiển thị component phù hợp với route hiện tại.
|
|
671
|
+
|
|
672
|
+
```vue fileName="src/App.vue"
|
|
673
|
+
<script setup lang="ts">
|
|
674
|
+
import LocaleSwitcher from "@components/LocaleSwitcher.vue";
|
|
675
|
+
</script>
|
|
676
|
+
|
|
677
|
+
<template>
|
|
678
|
+
<nav>
|
|
679
|
+
<LocaleSwitcher />
|
|
680
|
+
</nav>
|
|
681
|
+
<RouterView />
|
|
682
|
+
</template>
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
Song song đó, bạn cũng có thể sử dụng `intlayerMiddleware` để thêm routing phía server vào ứng dụng của bạn. Plugin này sẽ tự động phát hiện locale hiện tại dựa trên URL và thiết lập cookie locale phù hợp. Nếu không có locale nào được chỉ định, plugin sẽ xác định locale phù hợp nhất dựa trên sở thích ngôn ngữ trình duyệt của người dùng. Nếu không phát hiện được locale nào, nó sẽ chuyển hướng về locale mặc định.
|
|
686
|
+
|
|
687
|
+
> Lưu ý rằng để sử dụng `intlayerMiddleware` trong môi trường production, bạn cần chuyển gói `vite-intlayer` từ `devDependencies` sang `dependencies`.
|
|
688
|
+
|
|
689
|
+
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
690
|
+
import { defineConfig } from "vite";
|
|
691
|
+
import vue from "@vitejs/plugin-vue";
|
|
692
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
693
|
+
|
|
694
|
+
// https://vitejs.dev/config/
|
|
695
|
+
export default defineConfig({
|
|
696
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
697
|
+
});
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
701
|
+
import { defineConfig } from "vite";
|
|
702
|
+
import vue from "@vitejs/plugin-vue";
|
|
703
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
704
|
+
|
|
705
|
+
// https://vitejs.dev/config/
|
|
706
|
+
export default defineConfig({
|
|
707
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
708
|
+
});
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
712
|
+
const { defineConfig } = require("vite");
|
|
713
|
+
const vue = require("@vitejs/plugin-vue");
|
|
714
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
715
|
+
|
|
716
|
+
// https://vitejs.dev/config/
|
|
717
|
+
module.exports = defineConfig({
|
|
718
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
719
|
+
});
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
### (Tùy chọn) Bước 8: Thay đổi URL khi thay đổi locale
|
|
723
|
+
|
|
724
|
+
Để tự động cập nhật URL khi người dùng thay đổi ngôn ngữ, bạn có thể sửa đổi component `LocaleSwitcher` để sử dụng Vue Router:
|
|
725
|
+
|
|
726
|
+
```vue fileName="src/components/LocaleSwitcher.vue"
|
|
727
|
+
<template>
|
|
728
|
+
<div class="locale-switcher">
|
|
729
|
+
<select v-model="selectedLocale" @change="changeLocale">
|
|
730
|
+
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
731
|
+
{{ getLocaleName(loc) }}
|
|
732
|
+
</option>
|
|
733
|
+
</select>
|
|
734
|
+
</div>
|
|
735
|
+
</template>
|
|
736
|
+
|
|
737
|
+
<script setup lang="ts">
|
|
738
|
+
import { ref, watch } from "vue";
|
|
739
|
+
import { useRouter } from "vue-router";
|
|
740
|
+
import { Locales, getLocaleName, getLocalizedUrl } from "intlayer";
|
|
741
|
+
import { useLocale } from "vue-intlayer";
|
|
742
|
+
|
|
743
|
+
// Lấy Vue Router
|
|
744
|
+
const router = useRouter();
|
|
745
|
+
|
|
746
|
+
// Lấy thông tin locale và hàm setLocale
|
|
747
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
748
|
+
onLocaleChange: (newLocale) => {
|
|
749
|
+
// Lấy route hiện tại và tạo URL đã được địa phương hóa
|
|
750
|
+
const currentPath = router.currentRoute.value.fullPath;
|
|
751
|
+
const localizedPath = getLocalizedUrl(currentPath, newLocale);
|
|
752
|
+
|
|
753
|
+
// Điều hướng đến route đã được địa phương hóa mà không tải lại trang
|
|
754
|
+
router.push(localizedPath);
|
|
755
|
+
},
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
// Theo dõi locale được chọn với một ref
|
|
759
|
+
const selectedLocale = ref(locale.value);
|
|
760
|
+
|
|
761
|
+
// Cập nhật locale khi lựa chọn thay đổi
|
|
762
|
+
const changeLocale = () => {
|
|
763
|
+
setLocale(selectedLocale.value);
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
// Giữ cho selectedLocale đồng bộ với locale toàn cục
|
|
767
|
+
watch(
|
|
768
|
+
() => locale.value,
|
|
769
|
+
(newLocale) => {
|
|
770
|
+
selectedLocale.value = newLocale;
|
|
771
|
+
}
|
|
772
|
+
);
|
|
773
|
+
</script>
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
Mẹo: Để cải thiện SEO và khả năng truy cập, hãy sử dụng thẻ như `<a href="/fr/home" hreflang="fr">` để liên kết đến các trang đã được địa phương hóa, như được trình bày trong Bước 10. Điều này cho phép các công cụ tìm kiếm phát hiện và lập chỉ mục các URL theo ngôn ngữ một cách chính xác. Để giữ nguyên hành vi SPA, bạn có thể ngăn chặn điều hướng mặc định với @click.prevent, thay đổi locale bằng useLocale, và điều hướng chương trình bằng Vue Router.
|
|
777
|
+
|
|
778
|
+
```html
|
|
779
|
+
<ol class="divide-text/20 divide-y divide-dashed overflow-y-auto p-1">
|
|
780
|
+
<li>
|
|
781
|
+
<a
|
|
782
|
+
hreflang="x-default"
|
|
783
|
+
aria-label="Chuyển sang tiếng Anh"
|
|
784
|
+
target="_self"
|
|
785
|
+
aria-current="page"
|
|
786
|
+
href="/doc/get-started"
|
|
787
|
+
>
|
|
788
|
+
<div>
|
|
789
|
+
<span dir="ltr" lang="en">English</span>
|
|
790
|
+
<span>Tiếng Anh</span>
|
|
791
|
+
<span>EN</span>
|
|
792
|
+
</div>
|
|
793
|
+
</a>
|
|
794
|
+
</li>
|
|
795
|
+
<li>
|
|
796
|
+
<a
|
|
797
|
+
hreflang="es"
|
|
798
|
+
aria-label="Chuyển sang tiếng Tây Ban Nha"
|
|
799
|
+
target="_self"
|
|
800
|
+
href="/es/doc/get-started"
|
|
801
|
+
>
|
|
802
|
+
<div>
|
|
803
|
+
<span dir="ltr" lang="es">Español</span>
|
|
804
|
+
<span>Tiếng Tây Ban Nha</span>
|
|
805
|
+
<span>ES</span>
|
|
806
|
+
</div>
|
|
807
|
+
</a>
|
|
808
|
+
</li>
|
|
809
|
+
</ol>
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### (Tùy chọn) Bước 9: Chuyển đổi thuộc tính Ngôn ngữ và Hướng của thẻ HTML
|
|
813
|
+
|
|
814
|
+
Khi ứng dụng của bạn hỗ trợ nhiều ngôn ngữ, việc cập nhật các thuộc tính `lang` và `dir` của thẻ `<html>` để phù hợp với locale hiện tại là rất quan trọng. Việc này đảm bảo:
|
|
815
|
+
|
|
816
|
+
- **Khả năng truy cập**: Các trình đọc màn hình và công nghệ hỗ trợ dựa vào thuộc tính `lang` chính xác để phát âm và hiểu nội dung một cách chính xác.
|
|
817
|
+
- **Hiển thị văn bản**: Thuộc tính `dir` (hướng) đảm bảo văn bản được hiển thị theo đúng thứ tự (ví dụ: từ trái sang phải cho tiếng Anh, từ phải sang trái cho tiếng Ả Rập hoặc tiếng Do Thái), điều này rất cần thiết cho khả năng đọc.
|
|
818
|
+
- **SEO**: Các công cụ tìm kiếm sử dụng thuộc tính `lang` để xác định ngôn ngữ của trang, giúp cung cấp nội dung địa phương hóa phù hợp trong kết quả tìm kiếm.
|
|
819
|
+
|
|
820
|
+
Bằng cách cập nhật các thuộc tính này một cách động khi locale thay đổi, bạn đảm bảo trải nghiệm nhất quán và dễ tiếp cận cho người dùng trên tất cả các ngôn ngữ được hỗ trợ.
|
|
821
|
+
|
|
822
|
+
```js fileName="src/composables/useI18nHTMLAttributes.ts"
|
|
823
|
+
import { watch } from "vue";
|
|
824
|
+
import { useLocale } from "vue-intlayer";
|
|
825
|
+
import { getHTMLTextDir } from "intlayer";
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Composable cập nhật các thuộc tính `lang` và `dir` của phần tử HTML <html>
|
|
829
|
+
* dựa trên locale hiện tại.
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* // Trong App.vue hoặc một component toàn cục
|
|
833
|
+
* import { useI18nHTMLAttributes } from './composables/useI18nHTMLAttributes'
|
|
834
|
+
*
|
|
835
|
+
* useI18nHTMLAttributes()
|
|
836
|
+
*/
|
|
837
|
+
export const useI18nHTMLAttributes = () => {
|
|
838
|
+
const { locale } = useLocale();
|
|
839
|
+
|
|
840
|
+
// Cập nhật các thuộc tính HTML mỗi khi locale thay đổi
|
|
841
|
+
watch(
|
|
842
|
+
() => locale.value,
|
|
843
|
+
(newLocale) => {
|
|
844
|
+
if (!newLocale) return;
|
|
845
|
+
|
|
846
|
+
// Cập nhật thuộc tính ngôn ngữ
|
|
847
|
+
document.documentElement.lang = newLocale;
|
|
848
|
+
|
|
849
|
+
// Đặt hướng văn bản (ltr cho hầu hết các ngôn ngữ, rtl cho tiếng Ả Rập, Do Thái, v.v.)
|
|
850
|
+
document.documentElement.dir = getHTMLTextDir(newLocale);
|
|
851
|
+
},
|
|
852
|
+
{ immediate: true }
|
|
853
|
+
);
|
|
854
|
+
};
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
Sử dụng composable này trong `App.vue` hoặc một component toàn cục của bạn:
|
|
858
|
+
|
|
859
|
+
```vue fileName="src/App.vue"
|
|
860
|
+
<script setup lang="ts">
|
|
861
|
+
import { useI18nHTMLAttributes } from "@composables/useI18nHTMLAttributes";
|
|
862
|
+
|
|
863
|
+
// Áp dụng các thuộc tính HTML dựa trên locale hiện tại
|
|
864
|
+
useI18nHTMLAttributes();
|
|
865
|
+
</script>
|
|
866
|
+
|
|
867
|
+
<template>
|
|
868
|
+
<!-- Mẫu ứng dụng của bạn -->
|
|
869
|
+
</template>
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
### (Tùy chọn) Bước 10: Tạo một Component Link Đa ngôn ngữ
|
|
873
|
+
|
|
874
|
+
Để đảm bảo rằng điều hướng của ứng dụng của bạn tuân thủ ngôn ngữ hiện tại, bạn có thể tạo một component `Link` tùy chỉnh. Component này tự động thêm tiền tố ngôn ngữ hiện tại vào các URL nội bộ. Ví dụ, khi một người dùng nói tiếng Pháp nhấp vào liên kết đến trang "About", họ sẽ được chuyển hướng đến `/fr/about` thay vì `/about`.
|
|
875
|
+
|
|
876
|
+
Hành vi này hữu ích vì một số lý do:
|
|
877
|
+
|
|
878
|
+
- **SEO và Trải nghiệm người dùng**: URL được địa phương hóa giúp các công cụ tìm kiếm lập chỉ mục chính xác các trang theo ngôn ngữ và cung cấp nội dung phù hợp với ngôn ngữ ưu tiên của người dùng.
|
|
879
|
+
- **Tính nhất quán**: Bằng cách sử dụng liên kết địa phương hóa trong toàn bộ ứng dụng của bạn, bạn đảm bảo rằng điều hướng luôn giữ trong ngôn ngữ hiện tại, ngăn chặn việc chuyển đổi ngôn ngữ không mong muốn.
|
|
880
|
+
/// **Khả năng bảo trì**: Tập trung logic địa phương hóa trong một thành phần duy nhất giúp đơn giản hóa việc quản lý URL, làm cho codebase của bạn dễ bảo trì và mở rộng khi ứng dụng phát triển.
|
|
881
|
+
|
|
882
|
+
```vue fileName="src/components/Link.vue"
|
|
883
|
+
<template>
|
|
884
|
+
<a :href="localizedHref" v-bind="$attrs">
|
|
885
|
+
<slot />
|
|
886
|
+
</a>
|
|
887
|
+
</template>
|
|
888
|
+
|
|
889
|
+
<script setup lang="ts">
|
|
890
|
+
import { computed } from "vue";
|
|
891
|
+
import { getLocalizedUrl } from "intlayer";
|
|
892
|
+
import { useLocale } from "vue-intlayer";
|
|
893
|
+
|
|
894
|
+
const props = defineProps({
|
|
895
|
+
href: {
|
|
896
|
+
type: String,
|
|
897
|
+
required: true,
|
|
898
|
+
},
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
const { locale } = useLocale();
|
|
902
|
+
|
|
903
|
+
// Kiểm tra xem liên kết có phải là liên kết bên ngoài không
|
|
904
|
+
const isExternalLink = computed(() => /^https?:\/\//.test(props.href || ""));
|
|
905
|
+
|
|
906
|
+
// Tạo href đã được địa phương hóa cho các liên kết nội bộ
|
|
907
|
+
const localizedHref = computed(() =>
|
|
908
|
+
isExternalLink.value ? props.href : getLocalizedUrl(props.href, locale.value)
|
|
909
|
+
);
|
|
910
|
+
</script>
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
Để sử dụng với Vue Router, tạo một phiên bản dành riêng cho router:
|
|
914
|
+
|
|
915
|
+
```vue fileName="src/components/RouterLink.vue"
|
|
916
|
+
<template>
|
|
917
|
+
<router-link :to="localizedTo" v-bind="$attrs">
|
|
918
|
+
<slot />
|
|
919
|
+
</router-link>
|
|
920
|
+
</template>
|
|
921
|
+
|
|
922
|
+
<script setup lang="ts">
|
|
923
|
+
import { computed } from "vue";
|
|
924
|
+
import { getLocalizedUrl } from "intlayer";
|
|
925
|
+
import { useLocale } from "vue-intlayer";
|
|
926
|
+
|
|
927
|
+
const props = defineProps({
|
|
928
|
+
to: {
|
|
929
|
+
type: [String, Object],
|
|
930
|
+
required: true,
|
|
931
|
+
},
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
const { locale } = useLocale();
|
|
935
|
+
|
|
936
|
+
// Tạo thuộc tính to đã được địa phương hóa cho router-link
|
|
937
|
+
const localizedTo = computed(() => {
|
|
938
|
+
if (typeof props.to === "string") {
|
|
939
|
+
return getLocalizedUrl(props.to, locale.value);
|
|
940
|
+
} else {
|
|
941
|
+
// Nếu 'to' là một đối tượng, địa phương hóa thuộc tính path
|
|
942
|
+
return {
|
|
943
|
+
...props.to,
|
|
944
|
+
path: getLocalizedUrl(props.to.path ?? "/", locale.value),
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
</script>
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
Sử dụng các component này trong ứng dụng của bạn:
|
|
952
|
+
|
|
953
|
+
```vue fileName="src/App.vue"
|
|
954
|
+
<template>
|
|
955
|
+
<div>
|
|
956
|
+
<!-- Vue router -->
|
|
957
|
+
<RouterLink to="/">Gốc</RouterLink>
|
|
958
|
+
<RouterLink to="/home">Trang chủ</RouterLink>
|
|
959
|
+
<!-- Khác -->
|
|
960
|
+
<Link href="/">Gốc</Link>
|
|
961
|
+
<Link href="/home">Trang chủ</Link>
|
|
962
|
+
</div>
|
|
963
|
+
</template>
|
|
964
|
+
|
|
965
|
+
<script setup lang="ts">
|
|
966
|
+
import Link từ "@components/Link.vue";
|
|
967
|
+
import RouterLink từ "@components/RouterLink.vue";
|
|
968
|
+
</script>
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
### (Tùy chọn) Bước 11: Kết xuất Markdown
|
|
972
|
+
|
|
973
|
+
Intlayer hỗ trợ hiển thị nội dung Markdown trực tiếp trong ứng dụng Vue của bạn. Theo mặc định, Markdown được xử lý như văn bản thuần túy. Để chuyển đổi Markdown thành HTML phong phú, bạn có thể tích hợp [markdown-it](https://github.com/markdown-it/markdown-it), một trình phân tích cú pháp Markdown.
|
|
974
|
+
|
|
975
|
+
Điều này đặc biệt hữu ích khi bản dịch của bạn bao gồm các nội dung có định dạng như danh sách, liên kết hoặc nhấn mạnh.
|
|
976
|
+
|
|
977
|
+
Theo mặc định, Intlayer hiển thị markdown dưới dạng chuỗi. Nhưng Intlayer cũng cung cấp một cách để hiển thị markdown thành HTML bằng cách sử dụng hàm `installIntlayerMarkdown`.
|
|
978
|
+
|
|
979
|
+
> Để xem cách khai báo nội dung markdown sử dụng gói `intlayer`, xem tài liệu [markdown doc](https://github.com/aymericzip/intlayer/tree/main/docs/vi/dictionary/markdown.md).
|
|
980
|
+
|
|
981
|
+
```ts fileName="main.ts"
|
|
982
|
+
import MarkdownIt from "markdown-it";
|
|
983
|
+
import { createApp, h } from "vue";
|
|
984
|
+
import { installIntlayer, installIntlayerMarkdown } from "vue-intlayer";
|
|
985
|
+
|
|
986
|
+
const app = createApp(App);
|
|
987
|
+
|
|
988
|
+
installIntlayer(app);
|
|
989
|
+
|
|
990
|
+
const md = new MarkdownIt({
|
|
991
|
+
html: true, // cho phép thẻ HTML
|
|
992
|
+
linkify: true, // tự động liên kết URL
|
|
993
|
+
typographer: true, // bật dấu ngoặc thông minh, dấu gạch nối, v.v.
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
// Yêu cầu Intlayer sử dụng md.render() mỗi khi cần chuyển markdown thành HTML
|
|
997
|
+
installIntlayerMarkdown(app, (markdown) => {
|
|
998
|
+
const html = md.render(markdown);
|
|
999
|
+
return h("div", { innerHTML: html });
|
|
1000
|
+
});
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
Sau khi đăng ký, bạn có thể sử dụng cú pháp dựa trên component để hiển thị nội dung Markdown trực tiếp:
|
|
1004
|
+
|
|
1005
|
+
```vue
|
|
1006
|
+
<template>
|
|
1007
|
+
<div>
|
|
1008
|
+
<myMarkdownContent />
|
|
1009
|
+
</div>
|
|
1010
|
+
</template>
|
|
1011
|
+
|
|
1012
|
+
<script setup lang="ts">
|
|
1013
|
+
import { useIntlayer } from "vue-intlayer";
|
|
1014
|
+
|
|
1015
|
+
const { myMarkdownContent } = useIntlayer("my-component");
|
|
1016
|
+
</script>
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
### Cấu hình TypeScript
|
|
1020
|
+
|
|
1021
|
+
Intlayer sử dụng module augmentation để tận dụng các lợi ích của TypeScript và làm cho codebase của bạn mạnh mẽ hơn.
|
|
1022
|
+
|
|
1023
|
+

|
|
1024
|
+
|
|
1025
|
+

|
|
1026
|
+
|
|
1027
|
+
Đảm bảo cấu hình TypeScript của bạn bao gồm các kiểu được tạo tự động.
|
|
1028
|
+
|
|
1029
|
+
```json5 fileName="tsconfig.json"
|
|
1030
|
+
{
|
|
1031
|
+
// ... Các cấu hình TypeScript hiện có của bạn
|
|
1032
|
+
"include": [
|
|
1033
|
+
// ... Các cấu hình TypeScript hiện có của bạn
|
|
1034
|
+
".intlayer/**/*.ts", // Bao gồm các kiểu được tạo tự động
|
|
1035
|
+
],
|
|
1036
|
+
}
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
### Cấu hình Git
|
|
1040
|
+
|
|
1041
|
+
Nên bỏ qua các tệp được tạo bởi Intlayer. Điều này giúp bạn tránh việc commit chúng vào kho Git của mình.
|
|
1042
|
+
|
|
1043
|
+
Để làm điều này, bạn có thể thêm các hướng dẫn sau vào tệp `.gitignore` của bạn:
|
|
1044
|
+
|
|
1045
|
+
```plaintext
|
|
1046
|
+
# Bỏ qua các tệp được tạo bởi Intlayer
|
|
1047
|
+
.intlayer
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
### Tiện ích mở rộng VS Code
|
|
1051
|
+
|
|
1052
|
+
Để cải thiện trải nghiệm phát triển với Intlayer, bạn có thể cài đặt **Tiện ích mở rộng Intlayer cho VS Code** chính thức.
|
|
1053
|
+
|
|
1054
|
+
[Cài đặt từ VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1055
|
+
|
|
1056
|
+
Tiện ích mở rộng này cung cấp:
|
|
1057
|
+
|
|
1058
|
+
- **Tự động hoàn thành** cho các khóa dịch.
|
|
1059
|
+
- **Phát hiện lỗi thời gian thực** cho các bản dịch bị thiếu.
|
|
1060
|
+
- **Xem trước nội dung dịch ngay trong dòng**.
|
|
1061
|
+
- **Các hành động nhanh** để dễ dàng tạo và cập nhật bản dịch.
|
|
1062
|
+
|
|
1063
|
+
Để biết thêm chi tiết về cách sử dụng extension, hãy tham khảo [tài liệu Extension VS Code của Intlayer](https://intlayer.org/doc/vs-code-extension).
|
|
1064
|
+
|
|
1065
|
+
---
|
|
1066
|
+
|
|
1067
|
+
### Tiến xa hơn
|
|
1068
|
+
|
|
1069
|
+
Để tiến xa hơn, bạn có thể triển khai [trình soạn thảo trực quan](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_visual_editor.md) hoặc tách nội dung của bạn ra bên ngoài bằng cách sử dụng [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/intlayer_CMS.md).
|
|
1070
|
+
|
|
1071
|
+
---
|