@intlayer/docs 7.5.11 → 7.5.13
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/intlayer_with_i18next.md +0 -2
- package/blog/ar/intlayer_with_next-i18next.md +0 -2
- package/blog/ar/intlayer_with_react-i18next.md +0 -2
- package/blog/de/intlayer_with_i18next.md +0 -45
- package/blog/de/intlayer_with_next-i18next.md +0 -46
- package/blog/de/intlayer_with_react-i18next.md +0 -2
- package/blog/en/intlayer_with_i18next.md +0 -46
- package/blog/en/intlayer_with_next-i18next.md +0 -48
- package/blog/en/intlayer_with_next-intl.md +0 -44
- package/blog/en/intlayer_with_react-i18next.md +0 -44
- package/blog/en/intlayer_with_react-intl.md +0 -42
- package/blog/en/intlayer_with_vue-i18n.md +0 -44
- package/blog/en-GB/intlayer_with_i18next.md +0 -45
- package/blog/en-GB/intlayer_with_next-i18next.md +0 -47
- package/blog/en-GB/intlayer_with_next-intl.md +0 -42
- package/blog/en-GB/intlayer_with_react-i18next.md +0 -43
- package/blog/en-GB/intlayer_with_react-intl.md +0 -42
- package/blog/en-GB/intlayer_with_vue-i18n.md +0 -46
- package/blog/es/intlayer_with_i18next.md +0 -45
- package/blog/es/intlayer_with_next-i18next.md +0 -47
- package/blog/es/intlayer_with_next-intl.md +0 -42
- package/blog/es/intlayer_with_react-i18next.md +0 -43
- package/blog/es/intlayer_with_react-intl.md +0 -42
- package/blog/es/intlayer_with_vue-i18n.md +0 -46
- package/blog/fr/intlayer_with_i18next.md +0 -45
- package/blog/fr/intlayer_with_next-i18next.md +0 -47
- package/blog/fr/intlayer_with_next-intl.md +0 -42
- package/blog/fr/intlayer_with_react-i18next.md +0 -43
- package/blog/fr/intlayer_with_react-intl.md +0 -42
- package/blog/fr/intlayer_with_vue-i18n.md +0 -46
- package/blog/hi/intlayer_with_i18next.md +0 -2
- package/blog/hi/intlayer_with_next-i18next.md +0 -2
- package/blog/hi/intlayer_with_react-i18next.md +0 -2
- package/blog/id/intlayer_with_i18next.md +0 -2
- package/blog/id/intlayer_with_next-i18next.md +0 -2
- package/blog/id/intlayer_with_react-i18next.md +0 -2
- package/blog/it/intlayer_with_i18next.md +0 -2
- package/blog/it/intlayer_with_next-i18next.md +0 -2
- package/blog/it/intlayer_with_react-i18next.md +0 -2
- package/blog/ja/intlayer_with_i18next.md +0 -45
- package/blog/ja/intlayer_with_next-i18next.md +0 -46
- package/blog/ja/intlayer_with_next-intl.md +0 -42
- package/blog/ja/intlayer_with_react-i18next.md +0 -42
- package/blog/ja/intlayer_with_react-intl.md +0 -42
- package/blog/ja/intlayer_with_vue-i18n.md +0 -46
- package/blog/ko/intlayer_with_i18next.md +0 -2
- package/blog/ko/intlayer_with_next-i18next.md +0 -2
- package/blog/ko/intlayer_with_react-i18next.md +0 -1
- package/blog/pl/intlayer_with_i18next.md +0 -45
- package/blog/pl/intlayer_with_next-i18next.md +0 -46
- package/blog/pl/intlayer_with_next-intl.md +0 -42
- package/blog/pl/intlayer_with_react-i18next.md +0 -43
- package/blog/pl/intlayer_with_react-intl.md +0 -42
- package/blog/pl/intlayer_with_vue-i18n.md +0 -46
- package/blog/pt/intlayer_with_i18next.md +0 -2
- package/blog/pt/intlayer_with_next-i18next.md +0 -2
- package/blog/pt/intlayer_with_react-i18next.md +0 -2
- package/blog/ru/intlayer_with_i18next.md +0 -45
- package/blog/ru/intlayer_with_next-i18next.md +0 -47
- package/blog/ru/intlayer_with_next-intl.md +0 -42
- package/blog/ru/intlayer_with_react-i18next.md +0 -43
- package/blog/ru/intlayer_with_react-intl.md +0 -42
- package/blog/ru/intlayer_with_vue-i18n.md +0 -46
- package/blog/tr/intlayer_with_i18next.md +0 -2
- package/blog/tr/intlayer_with_next-i18next.md +0 -1
- package/blog/tr/intlayer_with_react-i18next.md +0 -2
- package/blog/uk/compiler_vs_declarative_i18n.md +224 -0
- package/blog/uk/i18n_using_next-i18next.md +1086 -0
- package/blog/uk/i18n_using_next-intl.md +760 -0
- package/blog/uk/index.md +69 -0
- package/blog/uk/internationalization_and_SEO.md +273 -0
- package/blog/uk/intlayer_with_i18next.md +211 -0
- package/blog/uk/intlayer_with_next-i18next.md +202 -0
- package/blog/uk/intlayer_with_next-intl.md +203 -0
- package/blog/uk/intlayer_with_react-i18next.md +200 -0
- package/blog/uk/intlayer_with_react-intl.md +202 -0
- package/blog/uk/intlayer_with_vue-i18n.md +206 -0
- package/blog/uk/l10n_platform_alternative/Lokalise.md +80 -0
- package/blog/uk/l10n_platform_alternative/crowdin.md +80 -0
- package/blog/uk/l10n_platform_alternative/phrase.md +78 -0
- package/blog/uk/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/uk/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/uk/list_i18n_technologies/CMS/wordpress.md +189 -0
- package/blog/uk/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/uk/list_i18n_technologies/frameworks/flutter.md +128 -0
- package/blog/uk/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/uk/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/uk/list_i18n_technologies/frameworks/svelte.md +145 -0
- package/blog/uk/list_i18n_technologies/frameworks/vue.md +144 -0
- package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1499 -0
- package/blog/uk/nextjs-multilingual-seo-comparison.md +360 -0
- package/blog/uk/rag_powered_documentation_assistant.md +288 -0
- package/blog/uk/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/uk/vue-i18n_vs_intlayer.md +279 -0
- package/blog/uk/what_is_internationalization.md +167 -0
- package/blog/vi/intlayer_with_i18next.md +0 -2
- package/blog/vi/intlayer_with_next-i18next.md +0 -2
- package/blog/vi/intlayer_with_react-i18next.md +0 -2
- package/blog/zh/intlayer_with_i18next.md +0 -2
- package/blog/zh/intlayer_with_next-i18next.md +0 -2
- package/blog/zh/intlayer_with_react-i18next.md +0 -2
- package/blog/zh/intlayer_with_vue-i18n.md +0 -46
- package/dist/cjs/generated/blog.entry.cjs +58 -29
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +218 -99
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +50 -15
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +4 -2
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +58 -29
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +218 -99
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +50 -15
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +4 -2
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts +1 -0
- package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
- package/dist/types/generated/legal.entry.d.ts.map +1 -1
- package/docs/ar/configuration.md +6 -1
- package/docs/ar/dictionary/content_file.md +6 -1
- package/docs/ar/intlayer_with_next-i18next.md +0 -1
- package/docs/ar/intlayer_with_nextjs_14.md +28 -0
- package/docs/ar/intlayer_with_nextjs_15.md +28 -0
- package/docs/ar/intlayer_with_nextjs_16.md +28 -0
- package/docs/ar/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/ar/plugins/sync-json.md +6 -2
- package/docs/de/configuration.md +6 -1
- package/docs/de/dictionary/content_file.md +6 -1
- package/docs/de/intlayer_with_next-i18next.md +0 -1
- package/docs/de/intlayer_with_nextjs_14.md +28 -0
- package/docs/de/intlayer_with_nextjs_15.md +28 -0
- package/docs/de/intlayer_with_nextjs_16.md +28 -0
- package/docs/de/intlayer_with_nextjs_no_locale_path.md +1152 -0
- package/docs/de/plugins/sync-json.md +6 -2
- package/docs/en/configuration.md +6 -1
- package/docs/en/dictionary/content_file.md +6 -1
- package/docs/en/intlayer_with_next-i18next.md +0 -1
- package/docs/en/intlayer_with_nextjs_14.md +28 -0
- package/docs/en/intlayer_with_nextjs_15.md +28 -0
- package/docs/en/intlayer_with_nextjs_16.md +31 -1
- package/docs/en/intlayer_with_nextjs_no_locale_path.md +1132 -0
- package/docs/en/plugins/sync-json.md +6 -2
- package/docs/en-GB/configuration.md +6 -1
- package/docs/en-GB/dictionary/content_file.md +3 -1
- package/docs/en-GB/intlayer_with_next-i18next.md +0 -1
- package/docs/en-GB/intlayer_with_nextjs_14.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_15.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_16.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_no_locale_path.md +1154 -0
- package/docs/en-GB/plugins/sync-json.md +6 -2
- package/docs/es/configuration.md +6 -1
- package/docs/es/dictionary/content_file.md +6 -1
- package/docs/es/intlayer_with_next-i18next.md +0 -1
- package/docs/es/intlayer_with_nextjs_14.md +28 -0
- package/docs/es/intlayer_with_nextjs_15.md +28 -0
- package/docs/es/intlayer_with_nextjs_16.md +28 -0
- package/docs/es/intlayer_with_nextjs_no_locale_path.md +1143 -0
- package/docs/es/plugins/sync-json.md +6 -2
- package/docs/fr/configuration.md +6 -1
- package/docs/fr/dictionary/content_file.md +3 -1
- package/docs/fr/intlayer_with_next-i18next.md +0 -1
- package/docs/fr/intlayer_with_nextjs_14.md +28 -0
- package/docs/fr/intlayer_with_nextjs_15.md +28 -0
- package/docs/fr/intlayer_with_nextjs_16.md +28 -0
- package/docs/fr/intlayer_with_nextjs_no_locale_path.md +1174 -0
- package/docs/fr/plugins/sync-json.md +9 -5
- package/docs/hi/configuration.md +6 -1
- package/docs/hi/dictionary/content_file.md +3 -1
- package/docs/hi/intlayer_with_next-i18next.md +0 -1
- package/docs/hi/intlayer_with_nextjs_14.md +28 -0
- package/docs/hi/intlayer_with_nextjs_15.md +28 -0
- package/docs/hi/intlayer_with_nextjs_16.md +28 -0
- package/docs/hi/intlayer_with_nextjs_no_locale_path.md +1151 -0
- package/docs/hi/plugins/sync-json.md +6 -2
- package/docs/id/configuration.md +6 -1
- package/docs/id/dictionary/content_file.md +3 -1
- package/docs/id/intlayer_with_next-i18next.md +0 -1
- package/docs/id/intlayer_with_nextjs_14.md +28 -0
- package/docs/id/intlayer_with_nextjs_15.md +28 -0
- package/docs/id/intlayer_with_nextjs_16.md +28 -0
- package/docs/id/intlayer_with_nextjs_no_locale_path.md +1154 -0
- package/docs/id/plugins/sync-json.md +6 -2
- package/docs/it/configuration.md +6 -1
- package/docs/it/dictionary/content_file.md +3 -1
- package/docs/it/intlayer_with_next-i18next.md +0 -1
- package/docs/it/intlayer_with_nextjs_14.md +28 -0
- package/docs/it/intlayer_with_nextjs_15.md +28 -0
- package/docs/it/intlayer_with_nextjs_16.md +28 -0
- package/docs/it/intlayer_with_nextjs_no_locale_path.md +1148 -0
- package/docs/it/plugins/sync-json.md +6 -2
- package/docs/ja/configuration.md +6 -1
- package/docs/ja/dictionary/content_file.md +3 -1
- package/docs/ja/intlayer_with_next-i18next.md +0 -1
- package/docs/ja/intlayer_with_nextjs_14.md +28 -0
- package/docs/ja/intlayer_with_nextjs_15.md +28 -0
- package/docs/ja/intlayer_with_nextjs_16.md +28 -0
- package/docs/ja/intlayer_with_nextjs_no_locale_path.md +1222 -0
- package/docs/ja/plugins/sync-json.md +6 -2
- package/docs/ko/configuration.md +6 -1
- package/docs/ko/dictionary/content_file.md +3 -1
- package/docs/ko/intlayer_with_next-i18next.md +0 -1
- package/docs/ko/intlayer_with_nextjs_14.md +28 -0
- package/docs/ko/intlayer_with_nextjs_15.md +28 -0
- package/docs/ko/intlayer_with_nextjs_16.md +28 -0
- package/docs/ko/intlayer_with_nextjs_no_locale_path.md +1205 -0
- package/docs/ko/plugins/sync-json.md +6 -2
- package/docs/pl/configuration.md +3 -1
- package/docs/pl/dictionary/content_file.md +3 -1
- package/docs/pl/intlayer_with_next-i18next.md +0 -1
- package/docs/pl/intlayer_with_nextjs_14.md +28 -0
- package/docs/pl/intlayer_with_nextjs_15.md +28 -0
- package/docs/pl/intlayer_with_nextjs_16.md +28 -0
- package/docs/pl/intlayer_with_nextjs_no_locale_path.md +1149 -0
- package/docs/pl/plugins/sync-json.md +6 -2
- package/docs/pt/configuration.md +6 -1
- package/docs/pt/dictionary/content_file.md +3 -1
- package/docs/pt/intlayer_with_next-i18next.md +0 -1
- package/docs/pt/intlayer_with_nextjs_14.md +28 -0
- package/docs/pt/intlayer_with_nextjs_15.md +28 -0
- package/docs/pt/intlayer_with_nextjs_16.md +28 -0
- package/docs/pt/intlayer_with_nextjs_no_locale_path.md +1152 -0
- package/docs/pt/plugins/sync-json.md +6 -2
- package/docs/ru/configuration.md +6 -1
- package/docs/ru/dictionary/content_file.md +6 -1
- package/docs/ru/intlayer_with_next-i18next.md +0 -1
- package/docs/ru/intlayer_with_nextjs_14.md +28 -0
- package/docs/ru/intlayer_with_nextjs_15.md +28 -0
- package/docs/ru/intlayer_with_nextjs_16.md +28 -0
- package/docs/ru/intlayer_with_nextjs_no_locale_path.md +1204 -0
- package/docs/ru/plugins/sync-json.md +6 -2
- package/docs/tr/configuration.md +6 -1
- package/docs/tr/dictionary/content_file.md +3 -1
- package/docs/tr/intlayer_with_next-i18next.md +0 -1
- package/docs/tr/intlayer_with_nextjs_14.md +28 -0
- package/docs/tr/intlayer_with_nextjs_15.md +28 -0
- package/docs/tr/intlayer_with_nextjs_16.md +28 -0
- package/docs/tr/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/tr/plugins/sync-json.md +6 -2
- package/docs/uk/CI_CD.md +198 -0
- package/docs/uk/autoFill.md +307 -0
- package/docs/uk/bundle_optimization.md +185 -0
- package/docs/uk/cli/build.md +64 -0
- package/docs/uk/cli/ci.md +137 -0
- package/docs/uk/cli/configuration.md +63 -0
- package/docs/uk/cli/debug.md +46 -0
- package/docs/uk/cli/doc-review.md +43 -0
- package/docs/uk/cli/doc-translate.md +132 -0
- package/docs/uk/cli/editor.md +28 -0
- package/docs/uk/cli/fill.md +130 -0
- package/docs/uk/cli/index.md +190 -0
- package/docs/uk/cli/init.md +84 -0
- package/docs/uk/cli/list.md +90 -0
- package/docs/uk/cli/list_projects.md +128 -0
- package/docs/uk/cli/live.md +41 -0
- package/docs/uk/cli/login.md +157 -0
- package/docs/uk/cli/pull.md +78 -0
- package/docs/uk/cli/push.md +98 -0
- package/docs/uk/cli/sdk.md +71 -0
- package/docs/uk/cli/test.md +76 -0
- package/docs/uk/cli/transform.md +65 -0
- package/docs/uk/cli/version.md +24 -0
- package/docs/uk/cli/watch.md +37 -0
- package/docs/uk/compiler.md +133 -0
- package/docs/uk/component_i18n.md +194 -0
- package/docs/uk/configuration.md +742 -0
- package/docs/uk/dictionary/condition.md +237 -0
- package/docs/uk/dictionary/content_file.md +1134 -0
- package/docs/uk/dictionary/enumeration.md +245 -0
- package/docs/uk/dictionary/file.md +232 -0
- package/docs/uk/dictionary/function_fetching.md +212 -0
- package/docs/uk/dictionary/gender.md +273 -0
- package/docs/uk/dictionary/insertion.md +187 -0
- package/docs/uk/dictionary/markdown.md +383 -0
- package/docs/uk/dictionary/nesting.md +273 -0
- package/docs/uk/dictionary/translation.md +332 -0
- package/docs/uk/formatters.md +595 -0
- package/docs/uk/how_works_intlayer.md +256 -0
- package/docs/uk/index.md +175 -0
- package/docs/uk/interest_of_intlayer.md +297 -0
- package/docs/uk/intlayer_CMS.md +569 -0
- package/docs/uk/intlayer_visual_editor.md +292 -0
- package/docs/uk/intlayer_with_angular.md +710 -0
- package/docs/uk/intlayer_with_astro.md +256 -0
- package/docs/uk/intlayer_with_create_react_app.md +1258 -0
- package/docs/uk/intlayer_with_express.md +429 -0
- package/docs/uk/intlayer_with_fastify.md +446 -0
- package/docs/uk/intlayer_with_lynx+react.md +548 -0
- package/docs/uk/intlayer_with_nestjs.md +283 -0
- package/docs/uk/intlayer_with_next-i18next.md +640 -0
- package/docs/uk/intlayer_with_next-intl.md +456 -0
- package/docs/uk/intlayer_with_nextjs_14.md +1646 -0
- package/docs/uk/intlayer_with_nextjs_15.md +1910 -0
- package/docs/uk/intlayer_with_nextjs_16.md +1763 -0
- package/docs/uk/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/uk/intlayer_with_nextjs_page_router.md +1541 -0
- package/docs/uk/intlayer_with_nuxt.md +711 -0
- package/docs/uk/intlayer_with_react_native+expo.md +715 -0
- package/docs/uk/intlayer_with_react_router_v7.md +600 -0
- package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +669 -0
- package/docs/uk/intlayer_with_svelte_kit.md +579 -0
- package/docs/uk/intlayer_with_tanstack.md +818 -0
- package/docs/uk/intlayer_with_vite+preact.md +1748 -0
- package/docs/uk/intlayer_with_vite+react.md +1449 -0
- package/docs/uk/intlayer_with_vite+solid.md +302 -0
- package/docs/uk/intlayer_with_vite+svelte.md +520 -0
- package/docs/uk/intlayer_with_vite+vue.md +1113 -0
- package/docs/uk/introduction.md +222 -0
- package/docs/uk/locale_mapper.md +242 -0
- package/docs/uk/mcp_server.md +211 -0
- package/docs/uk/packages/express-intlayer/t.md +465 -0
- package/docs/uk/packages/intlayer/getConfiguration.md +145 -0
- package/docs/uk/packages/intlayer/getEnumeration.md +159 -0
- package/docs/uk/packages/intlayer/getHTMLTextDir.md +121 -0
- package/docs/uk/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/uk/packages/intlayer/getLocaleName.md +135 -0
- package/docs/uk/packages/intlayer/getLocalizedUrl.md +338 -0
- package/docs/uk/packages/intlayer/getMultilingualUrls.md +359 -0
- package/docs/uk/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/uk/packages/intlayer/getPrefix.md +213 -0
- package/docs/uk/packages/intlayer/getTranslation.md +190 -0
- package/docs/uk/packages/intlayer/getTranslationContent.md +189 -0
- package/docs/uk/packages/next-intlayer/t.md +365 -0
- package/docs/uk/packages/next-intlayer/useDictionary.md +276 -0
- package/docs/uk/packages/next-intlayer/useIntlayer.md +263 -0
- package/docs/uk/packages/next-intlayer/useLocale.md +166 -0
- package/docs/uk/packages/react-intlayer/t.md +311 -0
- package/docs/uk/packages/react-intlayer/useDictionary.md +295 -0
- package/docs/uk/packages/react-intlayer/useI18n.md +250 -0
- package/docs/uk/packages/react-intlayer/useIntlayer.md +251 -0
- package/docs/uk/packages/react-intlayer/useLocale.md +210 -0
- package/docs/uk/per_locale_file.md +345 -0
- package/docs/uk/plugins/sync-json.md +398 -0
- package/docs/uk/readme.md +265 -0
- package/docs/uk/releases/v6.md +305 -0
- package/docs/uk/releases/v7.md +624 -0
- package/docs/uk/roadmap.md +346 -0
- package/docs/uk/testing.md +204 -0
- package/docs/uk/vs_code_extension.md +133 -0
- package/docs/vi/configuration.md +6 -1
- package/docs/vi/dictionary/content_file.md +6 -1
- package/docs/vi/intlayer_with_next-i18next.md +0 -1
- package/docs/vi/intlayer_with_nextjs_14.md +28 -0
- package/docs/vi/intlayer_with_nextjs_15.md +28 -0
- package/docs/vi/intlayer_with_nextjs_16.md +28 -0
- package/docs/vi/intlayer_with_nextjs_no_locale_path.md +1151 -0
- package/docs/vi/plugins/sync-json.md +6 -2
- package/docs/zh/configuration.md +6 -1
- package/docs/zh/dictionary/content_file.md +6 -1
- package/docs/zh/intlayer_with_next-i18next.md +0 -1
- package/docs/zh/intlayer_with_nextjs_14.md +28 -0
- package/docs/zh/intlayer_with_nextjs_15.md +28 -0
- package/docs/zh/intlayer_with_nextjs_16.md +28 -0
- package/docs/zh/intlayer_with_nextjs_no_locale_path.md +1206 -0
- package/docs/zh/plugins/sync-json.md +9 -5
- package/frequent_questions/ar/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ar/error-vite-env-only.md +77 -0
- package/frequent_questions/de/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/de/error-vite-env-only.md +77 -0
- package/frequent_questions/en/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/en/error-vite-env-only.md +77 -0
- package/frequent_questions/en-GB/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/en-GB/error-vite-env-only.md +77 -0
- package/frequent_questions/es/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/es/error-vite-env-only.md +76 -0
- package/frequent_questions/fr/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/fr/error-vite-env-only.md +77 -0
- package/frequent_questions/hi/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/hi/error-vite-env-only.md +77 -0
- package/frequent_questions/id/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/id/error-vite-env-only.md +77 -0
- package/frequent_questions/it/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/it/error-vite-env-only.md +77 -0
- package/frequent_questions/ja/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ja/error-vite-env-only.md +77 -0
- package/frequent_questions/ko/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ko/error-vite-env-only.md +77 -0
- package/frequent_questions/pl/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/pl/error-vite-env-only.md +77 -0
- package/frequent_questions/pt/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/pt/error-vite-env-only.md +77 -0
- package/frequent_questions/ru/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ru/error-vite-env-only.md +77 -0
- package/frequent_questions/tr/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/tr/error-vite-env-only.md +77 -0
- package/frequent_questions/uk/SSR_Next_no_[locale].md +104 -0
- package/frequent_questions/uk/array_as_content_declaration.md +72 -0
- package/frequent_questions/uk/build_dictionaries.md +58 -0
- package/frequent_questions/uk/build_error_CI_CD.md +74 -0
- package/frequent_questions/uk/bun_set_up.md +53 -0
- package/frequent_questions/uk/customized_locale_list.md +64 -0
- package/frequent_questions/uk/domain_routing.md +113 -0
- package/frequent_questions/uk/error-vite-env-only.md +77 -0
- package/frequent_questions/uk/esbuild_error.md +29 -0
- package/frequent_questions/uk/get_locale_cookie.md +142 -0
- package/frequent_questions/uk/intlayer_command_undefined.md +155 -0
- package/frequent_questions/uk/locale_incorect_in_url.md +73 -0
- package/frequent_questions/uk/package_version_error.md +181 -0
- package/frequent_questions/uk/static_rendering.md +44 -0
- package/frequent_questions/uk/translated_path_url.md +55 -0
- package/frequent_questions/uk/unknown_command.md +97 -0
- package/frequent_questions/vi/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/vi/error-vite-env-only.md +77 -0
- package/frequent_questions/zh/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/zh/error-vite-env-only.md +77 -0
- package/legal/uk/privacy_notice.md +83 -0
- package/legal/uk/terms_of_service.md +55 -0
- package/package.json +6 -6
- package/src/generated/blog.entry.ts +29 -0
- package/src/generated/docs.entry.ts +119 -0
- package/src/generated/frequentQuestions.entry.ts +35 -0
- package/src/generated/legal.entry.ts +2 -0
|
@@ -0,0 +1,1113 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2025-04-18
|
|
3
|
+
updatedAt: 2025-12-30
|
|
4
|
+
title: Як перекласти ваш додаток на Vite і Vue – посібник з i18n 2026
|
|
5
|
+
description: Дізнайтеся, як зробити свій вебсайт на Vite і Vue багатомовним. Дотримуйтеся документації, щоб інтернаціоналізувати (i18n) та перекласти його.
|
|
6
|
+
keywords:
|
|
7
|
+
- Інтернаціоналізація (i18n)
|
|
8
|
+
- Документація
|
|
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
|
+
youtubeVideo: https://www.youtube.com/watch?v=IE3XWkZ6a5U
|
|
19
|
+
history:
|
|
20
|
+
- version: 7.5.9
|
|
21
|
+
date: 2025-12-30
|
|
22
|
+
changes: Add init command
|
|
23
|
+
- version: 5.5.10
|
|
24
|
+
date: 2025-06-29
|
|
25
|
+
changes: Init history
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# Перекладіть свій вебсайт на Vite і Vue за допомогою Intlayer | Інтернаціоналізація (i18n)
|
|
29
|
+
|
|
30
|
+
## Зміст
|
|
31
|
+
|
|
32
|
+
<TOC/>
|
|
33
|
+
|
|
34
|
+
## Що таке Intlayer?
|
|
35
|
+
|
|
36
|
+
**Intlayer** — інноваційна відкрита бібліотека для інтернаціоналізації (i18n), створена для спрощення підтримки багатомовності в сучасних веб-додатках.
|
|
37
|
+
|
|
38
|
+
За допомогою Intlayer ви можете:
|
|
39
|
+
|
|
40
|
+
- **Легко керувати перекладами** за допомогою декларативних словників на рівні компонентів.
|
|
41
|
+
- **Динамічно локалізувати метадані**, маршрути та контент.
|
|
42
|
+
- **Забезпечити підтримку TypeScript** за допомогою автоматично згенерованих типів, що покращує автодоповнення та виявлення помилок.
|
|
43
|
+
- **Отримати переваги від розширених можливостей**, таких як динамічне визначення локалі та перемикання.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Покроковий посібник з налаштування Intlayer у Vite і Vue додатку
|
|
48
|
+
|
|
49
|
+
<Tab defaultTab="video">
|
|
50
|
+
<TabItem label="Відео" value="video">
|
|
51
|
+
|
|
52
|
+
<iframe title="Найкраще i18n-рішення для Vite і Vue? Дізнайтеся про Intlayer" class="m-auto aspect-16/9 w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/IE3XWkZ6a5U?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
53
|
+
|
|
54
|
+
</TabItem>
|
|
55
|
+
<TabItem label="Код" value="code">
|
|
56
|
+
|
|
57
|
+
<iframe
|
|
58
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-vite-vue-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
59
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
60
|
+
title="Демо CodeSandbox — Як інтернаціоналізувати ваш додаток за допомогою Intlayer"
|
|
61
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
62
|
+
loading="lazy"
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
</TabItem>
|
|
66
|
+
</Tab>
|
|
67
|
+
|
|
68
|
+
Див. [Application Template](https://github.com/aymericzip/intlayer-vite-vue-template) на GitHub.
|
|
69
|
+
|
|
70
|
+
### Крок 1: Встановлення залежностей
|
|
71
|
+
|
|
72
|
+
Встановіть необхідні пакети, використовуючи один із наведених пакетних менеджерів:
|
|
73
|
+
|
|
74
|
+
```bash packageManager="npm"
|
|
75
|
+
npm install intlayer vue-intlayer
|
|
76
|
+
npm install vite-intlayer --save-dev
|
|
77
|
+
npx intlayer init
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash packageManager="pnpm"
|
|
81
|
+
pnpm add intlayer vue-intlayer
|
|
82
|
+
pnpm add vite-intlayer --save-dev
|
|
83
|
+
pnpm intlayer init
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```bash packageManager="yarn"
|
|
87
|
+
yarn add intlayer vue-intlayer
|
|
88
|
+
yarn add vite-intlayer --save-dev
|
|
89
|
+
yarn intlayer init
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```bash packageManager="bun"
|
|
93
|
+
bun add intlayer vue-intlayer
|
|
94
|
+
bun add vite-intlayer --dev
|
|
95
|
+
bunx intlayer init
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- **intlayer**
|
|
99
|
+
|
|
100
|
+
Основний пакет, який надає інструменти інтернаціоналізації для управління конфігурацією, перекладу, [декларування контенту](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/dictionary/content_file.md), транспіляції та [CLI-команд](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/cli/index.md).
|
|
101
|
+
|
|
102
|
+
- **vue-intlayer**
|
|
103
|
+
Пакет, який інтегрує Intlayer із Vue-додатком. Надає провайдери контексту та composables для інтернаціоналізації у Vue.
|
|
104
|
+
|
|
105
|
+
- **vite-intlayer**
|
|
106
|
+
Містить Vite-плагін для інтеграції Intlayer з [бандлером Vite](https://vite.dev/guide/why.html#why-bundle-for-production), а також middleware для виявлення преференційної локалі користувача, керування кукі та обробки перенаправлень URL.
|
|
107
|
+
|
|
108
|
+
### Крок 2: Налаштування вашого проєкту
|
|
109
|
+
|
|
110
|
+
Створіть файл конфігурації для налаштування мов вашого застосунку:
|
|
111
|
+
|
|
112
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
113
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
114
|
+
|
|
115
|
+
const config: IntlayerConfig = {
|
|
116
|
+
internationalization: {
|
|
117
|
+
locales: [
|
|
118
|
+
Locales.ENGLISH,
|
|
119
|
+
Locales.FRENCH,
|
|
120
|
+
Locales.SPANISH,
|
|
121
|
+
// Ваші інші локалі
|
|
122
|
+
],
|
|
123
|
+
defaultLocale: Locales.ENGLISH,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export default config;
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
131
|
+
import { Locales } from "intlayer";
|
|
132
|
+
|
|
133
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
134
|
+
const config = {
|
|
135
|
+
internationalization: {
|
|
136
|
+
locales: [
|
|
137
|
+
Locales.ENGLISH,
|
|
138
|
+
Locales.FRENCH,
|
|
139
|
+
Locales.SPANISH,
|
|
140
|
+
// Ваші інші локалі
|
|
141
|
+
],
|
|
142
|
+
defaultLocale: Locales.ENGLISH,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export default config;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
150
|
+
const { Locales } = require("intlayer");
|
|
151
|
+
|
|
152
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
153
|
+
const config = {
|
|
154
|
+
internationalization: {
|
|
155
|
+
locales: [
|
|
156
|
+
Locales.ENGLISH,
|
|
157
|
+
Locales.FRENCH,
|
|
158
|
+
Locales.SPANISH,
|
|
159
|
+
// Ваші інші locales
|
|
160
|
+
],
|
|
161
|
+
defaultLocale: Locales.ENGLISH,
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
module.exports = config;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
> За допомогою цього файлу конфігурації ви можете налаштувати локалізовані URL-адреси, перенаправлення в middleware, назви cookie, розташування та розширення ваших декларацій контенту, відключити логи Intlayer у консолі та інше. Повний перелік доступних параметрів див. у [документації з конфігурації](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/configuration.md).
|
|
169
|
+
|
|
170
|
+
### Крок 3: Інтегруйте Intlayer у вашу конфігурацію Vite
|
|
171
|
+
|
|
172
|
+
Додайте плагін intlayer до вашої конфігурації.
|
|
173
|
+
|
|
174
|
+
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
175
|
+
import { defineConfig } from "vite";
|
|
176
|
+
import vue from "@vitejs/plugin-vue";
|
|
177
|
+
import { intlayer } from "vite-intlayer";
|
|
178
|
+
|
|
179
|
+
// https://vitejs.dev/config/
|
|
180
|
+
export default defineConfig({
|
|
181
|
+
plugins: [vue(), intlayer()],
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```javascript fileName="vite.config.mjs" codeFormat="esm"
|
|
186
|
+
import { defineConfig } from "vite";
|
|
187
|
+
import vue from "@vitejs/plugin-vue";
|
|
188
|
+
import { intlayer } from "vite-intlayer";
|
|
189
|
+
|
|
190
|
+
// Документація конфігурації: https://vitejs.dev/config/
|
|
191
|
+
export default defineConfig({
|
|
192
|
+
plugins: [vue(), intlayer()],
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
```javascript fileName="vite.config.cjs" codeFormat="commonjs"
|
|
197
|
+
const { defineConfig } = require("vite");
|
|
198
|
+
const vue = require("@vitejs/plugin-vue");
|
|
199
|
+
const { intlayer } = require("vite-intlayer");
|
|
200
|
+
|
|
201
|
+
// Документація конфігурації: https://vitejs.dev/config/
|
|
202
|
+
module.exports = defineConfig({
|
|
203
|
+
plugins: [vue(), intlayer()],
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
> Плагін Vite `intlayer()` використовується для інтеграції Intlayer з Vite. Він забезпечує побудову файлів декларацій контенту та відслідковує їх у режимі розробки. Він визначає змінні середовища Intlayer у додатку Vite. Крім того, він надає aliases для оптимізації продуктивності.
|
|
208
|
+
|
|
209
|
+
### Крок 4: Оголосіть свій контент
|
|
210
|
+
|
|
211
|
+
Створіть і керуйте деклараціями контенту для збереження перекладів:
|
|
212
|
+
|
|
213
|
+
```tsx fileName="src/helloWorld.content.ts" contentDeclarationFormat="typescript"
|
|
214
|
+
import { t, type Dictionary } from "intlayer";
|
|
215
|
+
|
|
216
|
+
const helloWorldContent = {
|
|
217
|
+
key: "helloworld",
|
|
218
|
+
content: {
|
|
219
|
+
count: t({
|
|
220
|
+
uk: "лічильник: ",
|
|
221
|
+
en: "count is ",
|
|
222
|
+
fr: "le compte est ",
|
|
223
|
+
es: "el recuento es ",
|
|
224
|
+
}),
|
|
225
|
+
edit: t({
|
|
226
|
+
uk: "Редагуйте <code>components/HelloWorld.vue</code> і збережіть, щоб перевірити HMR",
|
|
227
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
228
|
+
uk: "Редагуйте <code>components/HelloWorld.vue</code> і збережіть, щоб протестувати HMR",
|
|
229
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
230
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
231
|
+
}),
|
|
232
|
+
checkOut: t({
|
|
233
|
+
uk: "Ознайомтеся з ",
|
|
234
|
+
en: "Check out ",
|
|
235
|
+
fr: "Vérifiez ",
|
|
236
|
+
es: "Compruebe ",
|
|
237
|
+
}),
|
|
238
|
+
officialStarter: t({
|
|
239
|
+
uk: ", офіційним стартером Vue + Vite",
|
|
240
|
+
en: ", the official Vue + Vite starter",
|
|
241
|
+
fr: ", le starter officiel Vue + Vite",
|
|
242
|
+
es: ", el starter oficial Vue + Vite",
|
|
243
|
+
}),
|
|
244
|
+
learnMore: t({
|
|
245
|
+
uk: "Дізнайтеся більше про підтримку IDE для Vue в ",
|
|
246
|
+
en: "Learn more about IDE Support for Vue in the ",
|
|
247
|
+
fr: "En savoir plus sur le support IDE pour Vue dans le ",
|
|
248
|
+
es: "Aprenda más sobre el soporte IDE para Vue en el ",
|
|
249
|
+
}),
|
|
250
|
+
vueDocs: t({
|
|
251
|
+
uk: "Керівництво Vue Docs — Scaling up",
|
|
252
|
+
en: "Vue Docs Scaling up Guide",
|
|
253
|
+
fr: "Vue Docs Scaling up Guide",
|
|
254
|
+
es: "Vue Docs Scaling up Guide",
|
|
255
|
+
}),
|
|
256
|
+
readTheDocs: t({
|
|
257
|
+
uk: "Натисніть на логотипи Vite та Vue, щоб дізнатися більше",
|
|
258
|
+
en: "Click on the Vite and Vue logos to learn more",
|
|
259
|
+
fr: "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
260
|
+
es: "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
261
|
+
}),
|
|
262
|
+
},
|
|
263
|
+
} satisfies Dictionary;
|
|
264
|
+
|
|
265
|
+
export default helloWorldContent;
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```javascript fileName="src/helloWorld.content.mjs" contentDeclarationFormat="esm"
|
|
269
|
+
import { t } from "intlayer";
|
|
270
|
+
|
|
271
|
+
/** @type {import('intlayer').Dictionary} */
|
|
272
|
+
const helloWorldContent = {
|
|
273
|
+
key: "helloworld",
|
|
274
|
+
content: {
|
|
275
|
+
count: t({
|
|
276
|
+
uk: "лічильник: ",
|
|
277
|
+
en: "count is ",
|
|
278
|
+
fr: "le compte est ",
|
|
279
|
+
es: "el recuento es ",
|
|
280
|
+
}),
|
|
281
|
+
edit: t({
|
|
282
|
+
uk: "Редагуйте <code>components/HelloWorld.vue</code> і збережіть, щоб перевірити HMR",
|
|
283
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
284
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
285
|
+
uk: "Редагуйте <code>components/HelloWorld.vue</code> і збережіть, щоб перевірити HMR",
|
|
286
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
287
|
+
}),
|
|
288
|
+
checkOut: t({
|
|
289
|
+
uk: "Ознайомтеся з ",
|
|
290
|
+
en: "Check out ",
|
|
291
|
+
fr: "Vérifiez ",
|
|
292
|
+
es: "Compruebe ",
|
|
293
|
+
}),
|
|
294
|
+
officialStarter: t({
|
|
295
|
+
uk: "офіційним стартовим шаблоном Vue + Vite",
|
|
296
|
+
en: "the official Vue + Vite starter",
|
|
297
|
+
fr: "le starter officiel Vue + Vite",
|
|
298
|
+
es: "el starter oficial Vue + Vite",
|
|
299
|
+
}),
|
|
300
|
+
learnMore: t({
|
|
301
|
+
uk: "Дізнайтеся більше про підтримку IDE для Vue в ",
|
|
302
|
+
en: "Learn more about IDE Support for Vue in the ",
|
|
303
|
+
fr: "En savoir plus sur le support IDE pour Vue dans le ",
|
|
304
|
+
es: "Aprenda más sobre el soporte IDE para Vue en el ",
|
|
305
|
+
}),
|
|
306
|
+
vueDocs: t({
|
|
307
|
+
uk: "Vue Docs Scaling up Guide",
|
|
308
|
+
en: "Vue Docs Scaling up Guide",
|
|
309
|
+
fr: "Vue Docs Scaling up Guide",
|
|
310
|
+
es: "Vue Docs Scaling up Guide",
|
|
311
|
+
}),
|
|
312
|
+
readTheDocs: t({
|
|
313
|
+
uk: "Натисніть на логотипи Vite та Vue, щоб дізнатися більше",
|
|
314
|
+
en: "Click on the Vite and Vue logos to learn more",
|
|
315
|
+
fr: "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
316
|
+
es: "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
317
|
+
}),
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
export default helloWorldContent;
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```javascript fileName="src/helloWorld.content.cjs" contentDeclarationFormat="commonjs"
|
|
325
|
+
const { t } = require("intlayer");
|
|
326
|
+
|
|
327
|
+
/** @type {import('intlayer').Dictionary} */
|
|
328
|
+
const appContent = {
|
|
329
|
+
key: "helloworld",
|
|
330
|
+
content: {
|
|
331
|
+
count: t({
|
|
332
|
+
uk: "кількість: ",
|
|
333
|
+
en: "count is ",
|
|
334
|
+
fr: "le compte est ",
|
|
335
|
+
es: "el recuento es ",
|
|
336
|
+
}),
|
|
337
|
+
edit: t({
|
|
338
|
+
uk: "Редагуйте <code>components/HelloWorld.vue</code> і збережіть, щоб перевірити HMR",
|
|
339
|
+
en: "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
340
|
+
fr: "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
341
|
+
es: "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR",
|
|
342
|
+
}),
|
|
343
|
+
checkOut: t({
|
|
344
|
+
uk: "Ознайомтеся з ",
|
|
345
|
+
en: "Check out ",
|
|
346
|
+
fr: "Vérifiez ",
|
|
347
|
+
es: "Compruebe ",
|
|
348
|
+
}),
|
|
349
|
+
officialStarter: t({
|
|
350
|
+
uk: "офіційний starter Vue + Vite",
|
|
351
|
+
en: "the official Vue + Vite starter",
|
|
352
|
+
fr: "le starter officiel Vue + Vite",
|
|
353
|
+
es: "el starter oficial Vue + Vite",
|
|
354
|
+
}),
|
|
355
|
+
learnMore: t({
|
|
356
|
+
uk: "Дізнайтеся більше про підтримку IDE для Vue в ",
|
|
357
|
+
en: "Learn more about IDE Support for Vue in the ",
|
|
358
|
+
fr: "En savoir plus sur le support IDE pour Vue dans le ",
|
|
359
|
+
es: "Aprenda más sobre el soporte IDE para Vue en el ",
|
|
360
|
+
}),
|
|
361
|
+
vueDocs: t({
|
|
362
|
+
uk: "Керівництво зі масштабування (Vue Docs)",
|
|
363
|
+
en: "Vue Docs Scaling up Guide",
|
|
364
|
+
fr: "Vue Docs Scaling up Guide",
|
|
365
|
+
es: "Vue Docs Scaling up Guide",
|
|
366
|
+
}),
|
|
367
|
+
readTheDocs: t({
|
|
368
|
+
uk: "Натисніть на логотипи Vite і Vue, щоб дізнатися більше",
|
|
369
|
+
en: "Click on the Vite and Vue logos to learn more",
|
|
370
|
+
fr: "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
371
|
+
uk: "Натисніть на логотипи Vite і Vue, щоб дізнатися більше",
|
|
372
|
+
es: "Haga clic en los logotipos de Vite y Vue para obtener más información",
|
|
373
|
+
}),
|
|
374
|
+
},
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
module.exports = appContent;
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
```json fileName="src/helloWorld.content.json" contentDeclarationFormat="json"
|
|
381
|
+
{
|
|
382
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
383
|
+
"key": "helloworld",
|
|
384
|
+
"content": {
|
|
385
|
+
"count": {
|
|
386
|
+
"nodeType": "translation",
|
|
387
|
+
"translation": {
|
|
388
|
+
"uk": "кількість ",
|
|
389
|
+
"en": "count is ",
|
|
390
|
+
"fr": "le compte est ",
|
|
391
|
+
"es": "el recuento es "
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"edit": {
|
|
395
|
+
"nodeType": "translation",
|
|
396
|
+
"translation": {
|
|
397
|
+
"uk": "Редагуйте <code>components/HelloWorld.vue</code> і збережіть, щоб протестувати HMR",
|
|
398
|
+
"en": "Edit <code>components/HelloWorld.vue</code> and save to test HMR",
|
|
399
|
+
"fr": "Éditez <code>components/HelloWorld.vue</code> et enregistrez pour tester HMR",
|
|
400
|
+
"es": "Edita <code>components/HelloWorld.vue</code> y guarda para probar HMR"
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"checkOut": {
|
|
404
|
+
"nodeType": "translation",
|
|
405
|
+
"translation": {
|
|
406
|
+
"uk": "Перегляньте ",
|
|
407
|
+
"en": "Check out ",
|
|
408
|
+
"fr": "Vérifiez ",
|
|
409
|
+
"es": "Compruebe "
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"officialStarter": {
|
|
413
|
+
"nodeType": "translation",
|
|
414
|
+
"translation": {
|
|
415
|
+
"uk": "офіційний starter Vue + Vite",
|
|
416
|
+
"en": "the official Vue + Vite starter",
|
|
417
|
+
"fr": "le starter officiel Vue + Vite",
|
|
418
|
+
"es": "el starter oficial Vue + Vite"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
"learnMore": {
|
|
422
|
+
"nodeType": "translation",
|
|
423
|
+
"translation": {
|
|
424
|
+
"uk": "Дізнайтеся більше про підтримку IDE для Vue у ",
|
|
425
|
+
"en": "Learn more about IDE Support for Vue in the ",
|
|
426
|
+
"fr": "En savoir plus sur le support IDE pour Vue dans le ",
|
|
427
|
+
"es": "Aprenda más sobre el soporte IDE para Vue en el "
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"vueDocs": {
|
|
431
|
+
"nodeType": "translation",
|
|
432
|
+
"translation": {
|
|
433
|
+
"uk": "Посібник зі масштабування документації Vue",
|
|
434
|
+
"en": "Vue Docs Scaling up Guide",
|
|
435
|
+
"fr": "Vue Docs Scaling up Guide",
|
|
436
|
+
"es": "Vue Docs Scaling up Guide"
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"readTheDocs": {
|
|
440
|
+
"nodeType": "translation",
|
|
441
|
+
"translation": {
|
|
442
|
+
"uk": "Натисніть на логотипи Vite та Vue, щоб дізнатися більше",
|
|
443
|
+
"en": "Click on the Vite and Vue logos to learn more",
|
|
444
|
+
"fr": "Cliquez sur les logos Vite et Vue pour en savoir plus",
|
|
445
|
+
"es": "Haga clic en los logotipos de Vite y Vue para obtener más información"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
> Ваші декларації контенту можуть бути визначені будь-де у вашому додатку, щойно вони будуть додані до директорії `contentDir` (за замовчуванням, `./src`). Та мають відповідати розширенню файлу декларації контенту (за замовчуванням, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
453
|
+
|
|
454
|
+
> Для детальнішої інформації див. [документацію щодо файлу декларації контенту](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/dictionary/content_file.md).
|
|
455
|
+
|
|
456
|
+
### Крок 5: Використання Intlayer у вашому коді
|
|
457
|
+
|
|
458
|
+
Щоб використовувати можливості інтернаціоналізації Intlayer у всьому вашому Vue-застосунку, спочатку потрібно зареєструвати singleton-екземпляр Intlayer у вашому файлі main. Цей крок є критично важливим, оскільки він надає контекст інтернаціоналізації всім компонентам вашого застосунку, роблячи переклади доступними в будь-якій частині дерева компонентів.
|
|
459
|
+
|
|
460
|
+
```javascript fileName=main.js
|
|
461
|
+
import { createApp } from "vue";
|
|
462
|
+
import { installIntlayer } from "vue-intlayer";
|
|
463
|
+
import App from "./App.vue";
|
|
464
|
+
import "./style.css";
|
|
465
|
+
|
|
466
|
+
const app = createApp(App);
|
|
467
|
+
|
|
468
|
+
// Зареєструвати провайдера на верхньому рівні
|
|
469
|
+
installIntlayer(app);
|
|
470
|
+
|
|
471
|
+
// Змонтувати застосунок
|
|
472
|
+
app.mount("#app");
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Отримуйте доступ до своїх словників вмісту в усьому застосунку, створивши головний Vue-компонент і використовуючи composables `useIntlayer`:
|
|
476
|
+
|
|
477
|
+
```vue fileName="src/HelloWord.vue"
|
|
478
|
+
<script setup lang="ts">
|
|
479
|
+
import { ref } from "vue";
|
|
480
|
+
import { useIntlayer } from "vue-intlayer";
|
|
481
|
+
|
|
482
|
+
defineProps({
|
|
483
|
+
msg: String,
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
const {
|
|
487
|
+
count,
|
|
488
|
+
edit,
|
|
489
|
+
checkOut,
|
|
490
|
+
officialStarter,
|
|
491
|
+
learnMore,
|
|
492
|
+
vueDocs,
|
|
493
|
+
readTheDocs,
|
|
494
|
+
} = useIntlayer("helloworld");
|
|
495
|
+
const countRef = ref(0);
|
|
496
|
+
</script>
|
|
497
|
+
|
|
498
|
+
<template>
|
|
499
|
+
<h1>{{ msg }}</h1>
|
|
500
|
+
|
|
501
|
+
<div class="card">
|
|
502
|
+
<button type="button" @click="countRef++">
|
|
503
|
+
<count />
|
|
504
|
+
{{ countRef }}
|
|
505
|
+
</button>
|
|
506
|
+
<p v-html="edit"></p>
|
|
507
|
+
</div>
|
|
508
|
+
|
|
509
|
+
<p>
|
|
510
|
+
<checkOut />
|
|
511
|
+
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
|
512
|
+
>create-vue</a
|
|
513
|
+
>, <officialStarter />
|
|
514
|
+
</p>
|
|
515
|
+
<p>
|
|
516
|
+
<learnMore />
|
|
517
|
+
<a
|
|
518
|
+
href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support"
|
|
519
|
+
target="_blank"
|
|
520
|
+
><vueDocs /></a
|
|
521
|
+
>.
|
|
522
|
+
</p>
|
|
523
|
+
<p class="read-the-docs"><readTheDocs /></p>
|
|
524
|
+
<p class="read-the-docs">{{ readTheDocs }}</p>
|
|
525
|
+
</template>
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
#### Доступ до вмісту в Intlayer
|
|
529
|
+
|
|
530
|
+
Intlayer пропонує різні API для доступу до вашого вмісту:
|
|
531
|
+
|
|
532
|
+
- **Синтаксис на основі компонентів** (рекомендується):
|
|
533
|
+
Використовуйте `<myContent />` або `<Component :is="myContent" />`, щоб відобразити вміст як Intlayer Node. Це безшовно інтегрується з [Візуальний редактор](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_visual_editor.md) та [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_CMS.md).
|
|
534
|
+
|
|
535
|
+
- **Синтаксис рядка**:
|
|
536
|
+
Використовуйте `{{ myContent }}`, щоб відобразити вміст як простий текст, без підтримки Візуального редактора.
|
|
537
|
+
|
|
538
|
+
- **Сирий HTML-синтаксис**:
|
|
539
|
+
Використовуйте `<div v-html="myContent" />` щоб відобразити вміст як необроблений HTML, без підтримки Visual Editor.
|
|
540
|
+
|
|
541
|
+
- **Синтаксис деструктуризації**:
|
|
542
|
+
Композиція `useIntlayer` повертає Proxy з вмістом. Цей proxy можна деструктурувати, щоб отримати доступ до вмісту, зберігаючи реактивність.
|
|
543
|
+
- Використовуйте `const content = useIntlayer("myContent");` та `{{ content.myContent }}` / `<content.myContent />`.
|
|
544
|
+
- Або використовуйте `const { myContent } = useIntlayer("myContent");` та `{{ myContent}}` / `<myContent/>` щоб деструктурувати вміст.
|
|
545
|
+
|
|
546
|
+
### (Необов'язково) Крок 6: Змініть мову вашого вмісту
|
|
547
|
+
|
|
548
|
+
Щоб змінити мову вмісту, ви можете використати функцію `setLocale`, яку надає композиція `useLocale`. Ця функція дозволяє встановити локаль застосунку та відповідно оновити вміст.
|
|
549
|
+
|
|
550
|
+
Створіть компонент для перемикання між мовами:
|
|
551
|
+
|
|
552
|
+
```vue fileName="src/components/LocaleSwitcher.vue"
|
|
553
|
+
<script setup lang="ts">
|
|
554
|
+
import { getLocaleName } from "intlayer";
|
|
555
|
+
import { ref, watch } from "vue";
|
|
556
|
+
import { useLocale } from "vue-intlayer";
|
|
557
|
+
|
|
558
|
+
// Отримати інформацію про локаль та функцію setLocale
|
|
559
|
+
const { locale, availableLocales, setLocale } = useLocale();
|
|
560
|
+
|
|
561
|
+
// Відстежувати вибрану локаль за допомогою ref
|
|
562
|
+
const selectedLocale = ref(locale.value);
|
|
563
|
+
|
|
564
|
+
// Оновлювати локаль при зміні вибору
|
|
565
|
+
const changeLocale = () => setLocale(selectedLocale.value);
|
|
566
|
+
|
|
567
|
+
// Підтримувати selectedLocale синхронною зі глобальною локаллю
|
|
568
|
+
watch(
|
|
569
|
+
() => locale.value,
|
|
570
|
+
(newLocale) => {
|
|
571
|
+
selectedLocale.value = newLocale;
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
</script>
|
|
575
|
+
|
|
576
|
+
<template>
|
|
577
|
+
<div class="locale-switcher">
|
|
578
|
+
<select v-model="selectedLocale" @change="changeLocale">
|
|
579
|
+
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
580
|
+
{{ getLocaleName(loc) }}
|
|
581
|
+
</option>
|
|
582
|
+
</select>
|
|
583
|
+
</div>
|
|
584
|
+
</template>
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
Потім використайте цей компонент у вашому App.vue:
|
|
588
|
+
|
|
589
|
+
```vue fileName="src/App.vue"
|
|
590
|
+
<script setup lang="ts">
|
|
591
|
+
import { useIntlayer } from "vue-intlayer";
|
|
592
|
+
import HelloWorld from "@components/HelloWorld.vue";
|
|
593
|
+
import LocaleSwitcher from "@components/LocaleSwitcher.vue";
|
|
594
|
+
import { ref, watch } from "vue";
|
|
595
|
+
|
|
596
|
+
const content = useIntlayer("app"); // Створіть пов'язаний файл декларації intlayer
|
|
597
|
+
</script>
|
|
598
|
+
|
|
599
|
+
<template>
|
|
600
|
+
<div>
|
|
601
|
+
<LocaleSwitcher />
|
|
602
|
+
<a href="https://vite.dev" target="_blank">
|
|
603
|
+
<img src="/vite.svg" class="logo" :alt="content.viteLogo" />
|
|
604
|
+
</a>
|
|
605
|
+
<a href="https://vuejs.org/" target="_blank">
|
|
606
|
+
<img src="./assets/vue.svg" class="logo vue" :alt="content.vueLogo" />
|
|
607
|
+
</a>
|
|
608
|
+
</div>
|
|
609
|
+
<HelloWorld :msg="content.title" />
|
|
610
|
+
</template>
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### (Необов'язково) Крок 7: Додайте локалізовану маршрутизацію до вашого застосунку
|
|
614
|
+
|
|
615
|
+
Додавання локалізованої маршрутизації в додатку на Vue зазвичай передбачає використання Vue Router з префіксами локалі. Це створює унікальні маршрути для кожної мови, що корисно для SEO і для отримання SEO-дружніх URL.
|
|
616
|
+
|
|
617
|
+
Приклад:
|
|
618
|
+
|
|
619
|
+
```plaintext
|
|
620
|
+
- https://example.com/about
|
|
621
|
+
- https://example.com/es/about
|
|
622
|
+
- https://example.com/fr/about
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
Спочатку встановіть Vue Router:
|
|
626
|
+
|
|
627
|
+
```bash packageManager="npm"
|
|
628
|
+
npm install vue-router
|
|
629
|
+
npx intlayer init
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
```bash packageManager="pnpm"
|
|
633
|
+
pnpm add vue-router
|
|
634
|
+
pnpm intlayer init
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
```bash packageManager="yarn"
|
|
638
|
+
yarn add vue-router
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
Потім створіть конфігурацію роутера, яка обробляє маршрутизацію на основі локалі:
|
|
642
|
+
|
|
643
|
+
```js fileName="src/router/index.ts"
|
|
644
|
+
import {
|
|
645
|
+
localeFlatMap,
|
|
646
|
+
type Locale,
|
|
647
|
+
} from 'intlayer';
|
|
648
|
+
import { createIntlayerClient } from 'vue-intlayer';
|
|
649
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
650
|
+
import HomeView from './views/home/HomeView.vue';
|
|
651
|
+
import RootView from './views/root/Root.vue';
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Оголосіть маршрути зі шляхами, специфічними для локалі, та метаданими.
|
|
655
|
+
*/
|
|
656
|
+
const routes = localeFlatMap(({ urlPrefix, locale }) => [
|
|
657
|
+
{
|
|
658
|
+
path: `${urlPrefix}/`,
|
|
659
|
+
name: `Root-${locale}`,
|
|
660
|
+
component: RootView,
|
|
661
|
+
meta: {
|
|
662
|
+
locale,
|
|
663
|
+
},
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
path: `${urlPrefix}/home`,
|
|
667
|
+
name: `Home-${locale}`,
|
|
668
|
+
component: HomeView,
|
|
669
|
+
meta: {
|
|
670
|
+
locale,
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
]);
|
|
674
|
+
|
|
675
|
+
// Створіть екземпляр роутера
|
|
676
|
+
export const router = createRouter({
|
|
677
|
+
history: createWebHistory(),
|
|
678
|
+
routes,
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// Додайте навігаційний guard для обробки локалі
|
|
682
|
+
router.beforeEach((to, _from, next) => {
|
|
683
|
+
const client = createIntlayerClient();
|
|
684
|
+
|
|
685
|
+
const metaLocale = to.meta.locale as Locale;
|
|
686
|
+
|
|
687
|
+
// Використовуємо локаль, визначену в meta маршруту
|
|
688
|
+
client.setLocale(metaLocale);
|
|
689
|
+
next();
|
|
690
|
+
});
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
> Ім'я використовується для ідентифікації маршруту в роутері. Воно має бути унікальним серед усіх маршрутів, щоб уникнути конфліктів та забезпечити коректну навігацію й лінкування.
|
|
694
|
+
|
|
695
|
+
Потім зареєструйте роутер у файлі main.js:
|
|
696
|
+
|
|
697
|
+
```js fileName="src/main.ts"
|
|
698
|
+
import { createApp } from "vue";
|
|
699
|
+
import App from "./App.vue";
|
|
700
|
+
import { router } from "./router";
|
|
701
|
+
import "./style.css";
|
|
702
|
+
|
|
703
|
+
const app = createApp(App);
|
|
704
|
+
|
|
705
|
+
// Додайте роутер до додатку
|
|
706
|
+
app.use(router);
|
|
707
|
+
|
|
708
|
+
// Монтуємо додаток
|
|
709
|
+
app.mount("#app");
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
Далі оновіть файл `App.vue`, щоб відрендерити компонент RouterView. Цей компонент відобразить компонент, що відповідає поточному маршруту.
|
|
713
|
+
|
|
714
|
+
```vue fileName="src/App.vue"
|
|
715
|
+
<script setup lang="ts">
|
|
716
|
+
import LocaleSwitcher from "@components/LocaleSwitcher.vue";
|
|
717
|
+
</script>
|
|
718
|
+
|
|
719
|
+
<template>
|
|
720
|
+
<nav>
|
|
721
|
+
<LocaleSwitcher />
|
|
722
|
+
</nav>
|
|
723
|
+
<RouterView />
|
|
724
|
+
</template>
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
Паралельно ви також можете використовувати `intlayerProxy` для додавання серверної маршрутизації до вашого додатку. Цей плагін автоматично визначає поточну локаль на основі URL і встановлює відповідний cookie локалі. Якщо локаль не вказана, плагін визначатиме найбільш підходящу локаль на основі налаштувань мови браузера користувача. Якщо локаль не виявлена, він перенаправить на локаль за замовчуванням.
|
|
728
|
+
|
|
729
|
+
> Зверніть увагу, що для використання `intlayerProxy` у production потрібно перемістити пакет `vite-intlayer` з `devDependencies` до `dependencies`.
|
|
730
|
+
|
|
731
|
+
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
732
|
+
import { defineConfig } from "vite";
|
|
733
|
+
import vue from "@vitejs/plugin-vue";
|
|
734
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
735
|
+
|
|
736
|
+
// https://vitejs.dev/config/
|
|
737
|
+
export default defineConfig({
|
|
738
|
+
plugins: [vue(), intlayer(), intlayerProxy()],
|
|
739
|
+
});
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
743
|
+
import { defineConfig } from "vite";
|
|
744
|
+
import vue from "@vitejs/plugin-vue";
|
|
745
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
746
|
+
|
|
747
|
+
// https://vitejs.dev/config/ — документація Vite
|
|
748
|
+
export default defineConfig({
|
|
749
|
+
plugins: [vue(), intlayer(), intlayerProxy()],
|
|
750
|
+
});
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
754
|
+
const { defineConfig } = require("vite");
|
|
755
|
+
const vue = require("@vitejs/plugin-vue");
|
|
756
|
+
const { intlayer, intlayerProxy } = require("vite-intlayer");
|
|
757
|
+
|
|
758
|
+
// https://vitejs.dev/config/ — документація Vite
|
|
759
|
+
module.exports = defineConfig({
|
|
760
|
+
plugins: [vue(), intlayer(), intlayerProxy()],
|
|
761
|
+
});
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### (Необов'язково) Крок 8: Змінювати URL при зміні локалі
|
|
765
|
+
|
|
766
|
+
Щоб автоматично оновлювати URL при зміні мови користувачем, ви можете змінити компонент `LocaleSwitcher`, щоб він використовував Vue Router:
|
|
767
|
+
|
|
768
|
+
```vue fileName="src/components/LocaleSwitcher.vue"
|
|
769
|
+
<script setup lang="ts">
|
|
770
|
+
import { Locales, getLocaleName, getLocalizedUrl } from "intlayer";
|
|
771
|
+
import { ref, watch } from "vue";
|
|
772
|
+
import { useLocale } from "vue-intlayer";
|
|
773
|
+
import { useRouter } from "vue-router";
|
|
774
|
+
|
|
775
|
+
// Отримати Vue Router
|
|
776
|
+
const router = useRouter();
|
|
777
|
+
|
|
778
|
+
// Отримати інформацію про локаль та функцію setLocale
|
|
779
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
780
|
+
onLocaleChange: (newLocale) => {
|
|
781
|
+
// Отримати поточний маршрут та створити локалізований URL
|
|
782
|
+
const currentPath = router.currentRoute.value.fullPath;
|
|
783
|
+
const localizedPath = getLocalizedUrl(currentPath, newLocale);
|
|
784
|
+
|
|
785
|
+
// Перехід на локалізований маршрут без перезавантаження сторінки
|
|
786
|
+
router.push(localizedPath);
|
|
787
|
+
},
|
|
788
|
+
});
|
|
789
|
+
|
|
790
|
+
// Відстежувати вибрану локаль за допомогою ref
|
|
791
|
+
const selectedLocale = ref(locale.value);
|
|
792
|
+
|
|
793
|
+
// Оновити локаль, коли змінюється вибір
|
|
794
|
+
const changeLocale = () => {
|
|
795
|
+
setLocale(selectedLocale.value);
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
// Узгоджувати selectedLocale з глобальною локаллю
|
|
799
|
+
watch(
|
|
800
|
+
() => locale.value,
|
|
801
|
+
(newLocale) => {
|
|
802
|
+
selectedLocale.value = newLocale;
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
</script>
|
|
806
|
+
|
|
807
|
+
<template>
|
|
808
|
+
<div class="locale-switcher">
|
|
809
|
+
<select v-model="selectedLocale" @change="changeLocale">
|
|
810
|
+
<option v-for="loc in availableLocales" :key="loc" :value="loc">
|
|
811
|
+
{{ getLocaleName(loc) }}
|
|
812
|
+
</option>
|
|
813
|
+
</select>
|
|
814
|
+
</div>
|
|
815
|
+
</template>
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
Порада: Для кращого SEO та доступності використовуйте теги на кшталт `<a href="/fr/home" hreflang="fr">` для посилань на локалізовані сторінки, як показано в Кроці 10. Це дозволяє пошуковим системам виявляти та індексувати URL-адреси для певних мов коректно. Щоб зберегти поведінку SPA, ви можете запобігти стандартній навігації за допомогою @click.prevent, змінити локаль за допомогою useLocale і програмно переходити за допомогою Vue Router.
|
|
819
|
+
|
|
820
|
+
```html
|
|
821
|
+
<ol>
|
|
822
|
+
<li>
|
|
823
|
+
<a
|
|
824
|
+
hreflang="x-default"
|
|
825
|
+
aria-label="Переключити на англійську"
|
|
826
|
+
target="_self"
|
|
827
|
+
aria-current="page"
|
|
828
|
+
href="/doc/get-started"
|
|
829
|
+
>
|
|
830
|
+
<div>
|
|
831
|
+
<span dir="ltr" lang="en">English</span>
|
|
832
|
+
<span>Англійська</span>
|
|
833
|
+
<span>EN</span>
|
|
834
|
+
</div>
|
|
835
|
+
</a>
|
|
836
|
+
</li>
|
|
837
|
+
<li>
|
|
838
|
+
<a
|
|
839
|
+
hreflang="es"
|
|
840
|
+
aria-label="Switch to Spanish"
|
|
841
|
+
target="_self"
|
|
842
|
+
href="/es/doc/get-started"
|
|
843
|
+
>
|
|
844
|
+
<div>
|
|
845
|
+
<span dir="ltr" lang="es">Іспанська</span>
|
|
846
|
+
<span>Іспанська</span>
|
|
847
|
+
<span>ES</span>
|
|
848
|
+
</div>
|
|
849
|
+
</a>
|
|
850
|
+
</li>
|
|
851
|
+
</ol>
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
### (Необов'язково) Крок 9: Змінити атрибути мови та напрямку в HTML
|
|
855
|
+
|
|
856
|
+
Коли ваш додаток підтримує кілька мов, дуже важливо оновлювати атрибути `lang` і `dir` тегу `<html>` відповідно до поточної локалі. Це гарантує:
|
|
857
|
+
|
|
858
|
+
- **Доступність**: програми для читання з екрана та допоміжні технології покладаються на правильний атрибут `lang`, щоб правильно вимовляти та інтерпретувати вміст.
|
|
859
|
+
- **Відображення тексту**: атрибут `dir` (напрям) гарантує, що текст відображається в правильному порядку (наприклад, зліва направо для англійської, справа наліво для арабської чи івриту), що є критично важливим для читабельності.
|
|
860
|
+
- **SEO**: Пошукові системи використовують атрибут `lang` для визначення мови вашої сторінки, що допомагає показувати відповідний локалізований контент у результатах пошуку.
|
|
861
|
+
|
|
862
|
+
Оновлюючи ці атрибути динамічно при зміні локалі, ви гарантуєте узгоджений та доступний досвід для користувачів на всіх підтримуваних мовах.
|
|
863
|
+
|
|
864
|
+
```js fileName="src/composables/useI18nHTMLAttributes.ts"
|
|
865
|
+
import { watch } from "vue";
|
|
866
|
+
import { useLocale } from "vue-intlayer";
|
|
867
|
+
import { getHTMLTextDir } from "intlayer";
|
|
868
|
+
|
|
869
|
+
/**
|
|
870
|
+
* Composable, який оновлює атрибути `lang` та `dir` елементу <html>
|
|
871
|
+
* на основі поточної локалі.
|
|
872
|
+
*
|
|
873
|
+
* @example
|
|
874
|
+
* // У вашому App.vue або глобальному компоненті
|
|
875
|
+
* import { useI18nHTMLAttributes } from './composables/useI18nHTMLAttributes'
|
|
876
|
+
*
|
|
877
|
+
* useI18nHTMLAttributes()
|
|
878
|
+
*/
|
|
879
|
+
export const useI18nHTMLAttributes = () => {
|
|
880
|
+
const { locale } = useLocale();
|
|
881
|
+
|
|
882
|
+
// Оновлює атрибути HTML щоразу при зміні локалі
|
|
883
|
+
watch(
|
|
884
|
+
() => locale.value,
|
|
885
|
+
(newLocale) => {
|
|
886
|
+
if (!newLocale) return;
|
|
887
|
+
|
|
888
|
+
// Оновити атрибут мови
|
|
889
|
+
document.documentElement.lang = newLocale;
|
|
890
|
+
|
|
891
|
+
// Встановити напрямок тексту (ltr для більшості мов, rtl для арабської, івриту тощо.)
|
|
892
|
+
document.documentElement.dir = getHTMLTextDir(newLocale);
|
|
893
|
+
},
|
|
894
|
+
{ immediate: true }
|
|
895
|
+
);
|
|
896
|
+
};
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
Використайте цей composable у вашому `App.vue` або в глобальному компоненті:
|
|
900
|
+
|
|
901
|
+
```vue fileName="src/App.vue"
|
|
902
|
+
<script setup lang="ts">
|
|
903
|
+
import { useI18nHTMLAttributes } from "@composables/useI18nHTMLAttributes";
|
|
904
|
+
|
|
905
|
+
// Застосувати атрибути HTML відповідно до поточної локалі
|
|
906
|
+
useI18nHTMLAttributes();
|
|
907
|
+
</script>
|
|
908
|
+
|
|
909
|
+
<template>
|
|
910
|
+
<!-- Ваш шаблон додатка -->
|
|
911
|
+
</template>
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
### (Необов'язково) Крок 10: Створення локалізованого компонента `Link`
|
|
915
|
+
|
|
916
|
+
Щоб гарантувати, що навігація вашого додатка поважає поточну локаль, ви можете створити власний компонент `Link`. Цей компонент автоматично додає префікс поточної мови до внутрішніх URL-адрес. Наприклад, коли франкомовний користувач натискає на посилання на сторінку "About", його перенаправляє на `/fr/about` замість `/about`.
|
|
917
|
+
|
|
918
|
+
Ця поведінка корисна з кількох причин:
|
|
919
|
+
|
|
920
|
+
- **SEO and User Experience**: Локалізовані URL-адреси допомагають пошуковим системам правильно індексувати сторінки для конкретних мов і надавати користувачам контент їхньою мовою.
|
|
921
|
+
- **Послідовність**: Використовуючи локалізоване посилання в усьому застосунку, ви гарантуєте, що навігація залишатиметься в поточній локалі, запобігаючи несподіваним змінам мови.
|
|
922
|
+
- **Зручність підтримки**: Централізація логіки локалізації в одному компоненті спрощує управління URL-адресами, роблячи вашу кодову базу легшою для підтримки та розширення в міру зростання застосунку.
|
|
923
|
+
|
|
924
|
+
```vue fileName="src/components/Link.vue"
|
|
925
|
+
<script setup lang="ts">
|
|
926
|
+
import { getLocalizedUrl } from "intlayer";
|
|
927
|
+
import { computed } from "vue";
|
|
928
|
+
import { useLocale } from "vue-intlayer";
|
|
929
|
+
|
|
930
|
+
const props = defineProps({
|
|
931
|
+
href: {
|
|
932
|
+
type: String,
|
|
933
|
+
required: true,
|
|
934
|
+
},
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
const { locale } = useLocale();
|
|
938
|
+
|
|
939
|
+
// Перевірити, чи є посилання зовнішнім
|
|
940
|
+
const isExternalLink = computed(() => /^https?:\/\//.test(props.href || ""));
|
|
941
|
+
|
|
942
|
+
// Створити локалізований href для внутрішніх посилань
|
|
943
|
+
const localizedHref = computed(() =>
|
|
944
|
+
isExternalLink.value ? props.href : getLocalizedUrl(props.href, locale.value)
|
|
945
|
+
);
|
|
946
|
+
</script>
|
|
947
|
+
|
|
948
|
+
<template>
|
|
949
|
+
<a :href="localizedHref" v-bind="$attrs">
|
|
950
|
+
<slot />
|
|
951
|
+
</a>
|
|
952
|
+
</template>
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
Для використання з Vue Router створіть версію, специфічну для роутера:
|
|
956
|
+
|
|
957
|
+
```vue fileName="src/components/RouterLink.vue"
|
|
958
|
+
<script setup lang="ts">
|
|
959
|
+
import { getLocalizedUrl } from "intlayer";
|
|
960
|
+
import { computed } from "vue";
|
|
961
|
+
import { useLocale } from "vue-intlayer";
|
|
962
|
+
|
|
963
|
+
const props = defineProps({
|
|
964
|
+
to: {
|
|
965
|
+
type: [String, Object],
|
|
966
|
+
required: true,
|
|
967
|
+
},
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
const { locale } = useLocale();
|
|
971
|
+
|
|
972
|
+
// Створити локалізований to-prop для router-link
|
|
973
|
+
const localizedTo = computed(() => {
|
|
974
|
+
if (typeof props.to === "string") {
|
|
975
|
+
return getLocalizedUrl(props.to, locale.value);
|
|
976
|
+
} else {
|
|
977
|
+
// Якщо 'to' є об'єктом, локалізуйте властивість path
|
|
978
|
+
return {
|
|
979
|
+
...props.to,
|
|
980
|
+
path: getLocalizedUrl(props.to.path ?? "/", locale.value),
|
|
981
|
+
};
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
</script>
|
|
985
|
+
|
|
986
|
+
<template>
|
|
987
|
+
<router-link :to="localizedTo" v-bind="$attrs">
|
|
988
|
+
<slot />
|
|
989
|
+
</router-link>
|
|
990
|
+
</template>
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
Використовуйте ці компоненти у вашому застосунку:
|
|
994
|
+
|
|
995
|
+
```vue fileName="src/App.vue"
|
|
996
|
+
<script setup lang="ts">
|
|
997
|
+
import Link from "@components/Link.vue";
|
|
998
|
+
import RouterLink from "@components/RouterLink.vue";
|
|
999
|
+
</script>
|
|
1000
|
+
|
|
1001
|
+
<template>
|
|
1002
|
+
<div>
|
|
1003
|
+
<!-- Маршрутизатор Vue -->
|
|
1004
|
+
<RouterLink to="/">Корінь</RouterLink>
|
|
1005
|
+
<RouterLink to="/home">Головна</RouterLink>
|
|
1006
|
+
<!-- Інше -->
|
|
1007
|
+
<Link href="/">Корінь</Link>
|
|
1008
|
+
<Link href="/home">Головна</Link>
|
|
1009
|
+
</div>
|
|
1010
|
+
</template>
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
### (Необов'язково) Крок 11: Відображення Markdown
|
|
1014
|
+
|
|
1015
|
+
Intlayer підтримує відображення вмісту Markdown безпосередньо у вашому Vue-додатку. За замовчуванням Markdown обробляється як звичайний текст. Щоб перетворити Markdown на структурований HTML, можна інтегрувати [markdown-it](https://github.com/markdown-it/markdown-it) — парсер Markdown.
|
|
1016
|
+
|
|
1017
|
+
Це особливо корисно, коли ваші переклади містять форматований контент, наприклад списки, посилання або виділення.
|
|
1018
|
+
|
|
1019
|
+
За замовчуванням Intlayer рендерить Markdown як рядок. Але Intlayer також надає спосіб рендерити Markdown у HTML за допомогою функції `installIntlayerMarkdown`.
|
|
1020
|
+
|
|
1021
|
+
> Щоб побачити, як оголосити вміст Markdown з використанням пакета `intlayer`, див. [документацію з Markdown](https://github.com/aymericzip/intlayer/tree/main/docs/uk/dictionary/markdown.md).
|
|
1022
|
+
|
|
1023
|
+
```ts fileName="main.ts"
|
|
1024
|
+
import MarkdownIt from "markdown-it";
|
|
1025
|
+
import { createApp, h } from "vue";
|
|
1026
|
+
import { installIntlayer, installIntlayerMarkdown } from "vue-intlayer";
|
|
1027
|
+
|
|
1028
|
+
const app = createApp(App);
|
|
1029
|
+
|
|
1030
|
+
installIntlayer(app);
|
|
1031
|
+
|
|
1032
|
+
const md = new MarkdownIt({
|
|
1033
|
+
html: true, // дозволити HTML-теги
|
|
1034
|
+
linkify: true, // автоматично робити посилання з URL
|
|
1035
|
+
typographer: true, // ввімкнути "розумні" лапки, тире тощо.
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
// Скажіть Intlayer використовувати md.render(), коли потрібно перетворити Markdown у HTML
|
|
1039
|
+
installIntlayerMarkdown(app, (markdown) => {
|
|
1040
|
+
const html = md.render(markdown);
|
|
1041
|
+
return h("div", { innerHTML: html });
|
|
1042
|
+
});
|
|
1043
|
+
```
|
|
1044
|
+
|
|
1045
|
+
Після реєстрації ви можете використовувати компонентний синтаксис, щоб відображати вміст Markdown безпосередньо:
|
|
1046
|
+
|
|
1047
|
+
```vue
|
|
1048
|
+
<script setup lang="ts">
|
|
1049
|
+
import { useIntlayer } from "vue-intlayer";
|
|
1050
|
+
|
|
1051
|
+
const { myMarkdownContent } = useIntlayer("my-component");
|
|
1052
|
+
</script>
|
|
1053
|
+
|
|
1054
|
+
<template>
|
|
1055
|
+
<div>
|
|
1056
|
+
<myMarkdownContent />
|
|
1057
|
+
</div>
|
|
1058
|
+
</template>
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1061
|
+
### Налаштування TypeScript
|
|
1062
|
+
|
|
1063
|
+
Intlayer використовує module augmentation, щоб скористатися перевагами TypeScript і зробити ваш codebase більш надійним.
|
|
1064
|
+
|
|
1065
|
+

|
|
1066
|
+
|
|
1067
|
+

|
|
1068
|
+
|
|
1069
|
+
Переконайтеся, що ваша конфігурація TypeScript включає автогенеровані типи.
|
|
1070
|
+
|
|
1071
|
+
```json5 fileName="tsconfig.json"
|
|
1072
|
+
{
|
|
1073
|
+
// ... Ваші існуючі конфігурації TypeScript
|
|
1074
|
+
"include": [
|
|
1075
|
+
// ... Ваші існуючі конфігурації TypeScript
|
|
1076
|
+
".intlayer/**/*.ts", // Включити автоматично згенеровані типи
|
|
1077
|
+
],
|
|
1078
|
+
}
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
### Налаштування Git
|
|
1082
|
+
|
|
1083
|
+
Рекомендується ігнорувати файли, які генерує Intlayer. Це дозволить уникнути їх коміту у ваш Git-репозиторій.
|
|
1084
|
+
|
|
1085
|
+
Для цього можна додати такі інструкції до вашого файлу `.gitignore`:
|
|
1086
|
+
|
|
1087
|
+
```plaintext
|
|
1088
|
+
# Ігнорувати файли, згенеровані Intlayer
|
|
1089
|
+
.intlayer
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
### Розширення VS Code
|
|
1093
|
+
|
|
1094
|
+
Щоб покращити досвід розробки з Intlayer, ви можете встановити офіційне розширення **Intlayer VS Code Extension**.
|
|
1095
|
+
|
|
1096
|
+
[Встановити з VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1097
|
+
|
|
1098
|
+
Це розширення надає:
|
|
1099
|
+
|
|
1100
|
+
- **Автодоповнення** для ключів перекладу.
|
|
1101
|
+
- **Виявлення помилок у реальному часі** для відсутніх перекладів.
|
|
1102
|
+
- **Вбудовані попередні перегляди** перекладеного контенту.
|
|
1103
|
+
- **Швидкі дії** для зручного створення та оновлення перекладів.
|
|
1104
|
+
|
|
1105
|
+
Для детальнішої інформації про використання розширення зверніться до [документації Intlayer VS Code Extension](https://intlayer.org/doc/vs-code-extension).
|
|
1106
|
+
|
|
1107
|
+
---
|
|
1108
|
+
|
|
1109
|
+
### Щоб піти далі
|
|
1110
|
+
|
|
1111
|
+
Щоб рухатися далі, ви можете реалізувати [візуальний редактор](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_visual_editor.md) або винести свій контент за допомогою [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_CMS.md).
|
|
1112
|
+
|
|
1113
|
+
---
|