@intlayer/docs 7.0.7 → 7.0.8-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,1235 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2025-08-23
|
|
3
|
+
updatedAt: 2025-08-23
|
|
4
|
+
title: Jak przetłumaczyć swoją aplikację Create React App – przewodnik i18n 2025
|
|
5
|
+
description: Dowiedz się, jak uczynić swoją stronę Create React App (CRA) wielojęzyczną. Postępuj zgodnie z dokumentacją, aby zrealizować internacjonalizację (i18n) i tłumaczenie.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internacjonalizacja
|
|
8
|
+
- Dokumentacja
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Create React App
|
|
11
|
+
- CRA
|
|
12
|
+
- JavaScript
|
|
13
|
+
- React
|
|
14
|
+
slugs:
|
|
15
|
+
- doc
|
|
16
|
+
- environment
|
|
17
|
+
- create-react-app
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-react-cra-template
|
|
19
|
+
history:
|
|
20
|
+
- version: 5.5.10
|
|
21
|
+
date: 2025-06-29
|
|
22
|
+
changes: Inicjalizacja historii
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# Przetłumacz swoją stronę Create React App za pomocą Intlayer | Internacjonalizacja (i18n)
|
|
26
|
+
|
|
27
|
+
<iframe
|
|
28
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-react-cra-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
29
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
30
|
+
title="Demo CodeSandbox - Jak internacjonalizować swoją aplikację za pomocą Intlayer"
|
|
31
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
32
|
+
loading="lazy"
|
|
33
|
+
/>
|
|
34
|
+
|
|
35
|
+
Zobacz [Szablon aplikacji](https://github.com/aymericzip/intlayer-react-cra-template) na GitHub.
|
|
36
|
+
|
|
37
|
+
## Czym jest Intlayer?
|
|
38
|
+
|
|
39
|
+
**Intlayer** to innowacyjna, open-source’owa biblioteka do internacjonalizacji (i18n), zaprojektowana, aby uprościć wsparcie wielojęzyczne w nowoczesnych aplikacjach webowych.
|
|
40
|
+
|
|
41
|
+
Dzięki Intlayer możesz:
|
|
42
|
+
|
|
43
|
+
- **Łatwe zarządzanie tłumaczeniami** za pomocą deklaratywnych słowników na poziomie komponentów.
|
|
44
|
+
- **Dynamiczna lokalizacja metadanych**, tras i treści.
|
|
45
|
+
- **Zapewnienie wsparcia dla TypeScript** dzięki automatycznie generowanym typom, co poprawia autouzupełnianie i wykrywanie błędów.
|
|
46
|
+
- **Korzystanie z zaawansowanych funkcji**, takich jak dynamiczne wykrywanie i zmiana lokalizacji.
|
|
47
|
+
|
|
48
|
+
## Przewodnik krok po kroku, jak skonfigurować Intlayer w aplikacji React
|
|
49
|
+
|
|
50
|
+
### Krok 1: Instalacja zależności
|
|
51
|
+
|
|
52
|
+
Zainstaluj niezbędne pakiety za pomocą npm:
|
|
53
|
+
|
|
54
|
+
```bash packageManager="npm"
|
|
55
|
+
npm install intlayer react-intlayer react-scripts-intlayer
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```bash packageManager="pnpm"
|
|
59
|
+
pnpm add intlayer react-intlayer react-scripts-intlayer
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```bash packageManager="yarn"
|
|
63
|
+
yarn add intlayer react-intlayer react-scripts-intlayer
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **intlayer**
|
|
67
|
+
|
|
68
|
+
- **intlayer**
|
|
69
|
+
|
|
70
|
+
Główny pakiet, który dostarcza narzędzia do internacjonalizacji do zarządzania konfiguracją, tłumaczeń, [deklaracji treści](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/dictionary/content_file.md), transpilecji oraz [poleceń CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_cli.md).
|
|
71
|
+
|
|
72
|
+
- **react-intlayer**
|
|
73
|
+
|
|
74
|
+
Pakiet integrujący Intlayer z aplikacją React. Zapewnia dostawców kontekstu oraz hooki do internacjonalizacji w React.
|
|
75
|
+
|
|
76
|
+
- **react-scripts-intlayer**
|
|
77
|
+
|
|
78
|
+
Zawiera polecenia `react-scripts-intlayer` oraz wtyczki do integracji Intlayer z aplikacją opartą na Create React App. Te wtyczki bazują na [craco](https://craco.js.org/) i zawierają dodatkową konfigurację dla bundlera [Webpack](https://webpack.js.org/).
|
|
79
|
+
|
|
80
|
+
### Krok 2: Konfiguracja Twojego projektu
|
|
81
|
+
|
|
82
|
+
Utwórz plik konfiguracyjny, aby skonfigurować języki swojej aplikacji:
|
|
83
|
+
|
|
84
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
85
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
86
|
+
|
|
87
|
+
const config: IntlayerConfig = {
|
|
88
|
+
internationalization: {
|
|
89
|
+
locales: [
|
|
90
|
+
Locales.ENGLISH,
|
|
91
|
+
Locales.FRENCH,
|
|
92
|
+
Locales.SPANISH,
|
|
93
|
+
// Twoje inne lokalizacje
|
|
94
|
+
],
|
|
95
|
+
defaultLocale: Locales.ENGLISH,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default config;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
103
|
+
import { Locales } from "intlayer";
|
|
104
|
+
|
|
105
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
106
|
+
const config = {
|
|
107
|
+
internationalization: {
|
|
108
|
+
locales: [
|
|
109
|
+
Locales.ENGLISH,
|
|
110
|
+
Locales.FRENCH,
|
|
111
|
+
Locales.SPANISH,
|
|
112
|
+
// Twoje inne lokalizacje
|
|
113
|
+
],
|
|
114
|
+
defaultLocale: Locales.ENGLISH,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default config;
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
122
|
+
const { Locales } = require("intlayer");
|
|
123
|
+
|
|
124
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
125
|
+
const config = {
|
|
126
|
+
internationalization: {
|
|
127
|
+
locales: [
|
|
128
|
+
Locales.ENGLISH,
|
|
129
|
+
Locales.FRENCH,
|
|
130
|
+
Locales.SPANISH,
|
|
131
|
+
// Twoje inne lokalizacje
|
|
132
|
+
],
|
|
133
|
+
defaultLocale: Locales.ENGLISH,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
module.exports = config;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
> Za pomocą tego pliku konfiguracyjnego możesz ustawić lokalizowane adresy URL, przekierowania w middleware, nazwy ciasteczek, lokalizację i rozszerzenie deklaracji zawartości, wyłączyć logi Intlayer w konsoli i wiele więcej. Pełną listę dostępnych parametrów znajdziesz w [dokumentacji konfiguracyjnej](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/configuration.md).
|
|
141
|
+
|
|
142
|
+
### Krok 3: Zintegruj Intlayer w swojej konfiguracji CRA
|
|
143
|
+
|
|
144
|
+
Zmień swoje skrypty, aby używać react-intlayer
|
|
145
|
+
|
|
146
|
+
```json fileName="package.json"
|
|
147
|
+
"scripts": {
|
|
148
|
+
"build": "react-scripts-intlayer build",
|
|
149
|
+
"start": "react-scripts-intlayer start",
|
|
150
|
+
"transpile": "intlayer build"
|
|
151
|
+
},
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
> Skrypty `react-scripts-intlayer` bazują na [CRACO](https://craco.js.org/). Możesz również zaimplementować własną konfigurację opartą na wtyczce intlayer craco. [Zobacz przykład tutaj](https://github.com/aymericzip/intlayer/blob/main/examples/react-app/craco.config.js).
|
|
155
|
+
|
|
156
|
+
### Krok 4: Zadeklaruj swoją zawartość
|
|
157
|
+
|
|
158
|
+
Utwórz i zarządzaj deklaracjami zawartości, aby przechowywać tłumaczenia:
|
|
159
|
+
|
|
160
|
+
```tsx fileName="src/app.content.tsx" codeFormat="typescript"
|
|
161
|
+
import { t, type Dictionary } from "intlayer";
|
|
162
|
+
import React, { type ReactNode } from "react";
|
|
163
|
+
|
|
164
|
+
const appContent = {
|
|
165
|
+
key: "app",
|
|
166
|
+
content: {
|
|
167
|
+
getStarted: t<ReactNode>({
|
|
168
|
+
en: (
|
|
169
|
+
<>
|
|
170
|
+
Edit <code>src/App.tsx</code> and save to reload
|
|
171
|
+
</>
|
|
172
|
+
),
|
|
173
|
+
fr: (
|
|
174
|
+
<>
|
|
175
|
+
Éditez <code>src/App.tsx</code> et enregistrez pour recharger
|
|
176
|
+
</>
|
|
177
|
+
),
|
|
178
|
+
es: (
|
|
179
|
+
<>
|
|
180
|
+
Edytuj <code>src/App.tsx</code> i zapisz, aby przeładować
|
|
181
|
+
</>
|
|
182
|
+
),
|
|
183
|
+
}),
|
|
184
|
+
reactLink: {
|
|
185
|
+
href: "https://reactjs.org",
|
|
186
|
+
content: t({
|
|
187
|
+
en: "Learn React",
|
|
188
|
+
fr: "Apprendre React",
|
|
189
|
+
es: "Aprender React",
|
|
190
|
+
}),
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
} satisfies Dictionary;
|
|
194
|
+
|
|
195
|
+
export default appContent;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
```jsx fileName="src/app.content.mjx" codeFormat="esm"
|
|
199
|
+
import { t } from "intlayer";
|
|
200
|
+
|
|
201
|
+
/** @type {import('intlayer').Dictionary} */
|
|
202
|
+
const appContent = {
|
|
203
|
+
key: "app",
|
|
204
|
+
content: {
|
|
205
|
+
getStarted: t({
|
|
206
|
+
en: "Get started by editing",
|
|
207
|
+
fr: "Commencez par éditer",
|
|
208
|
+
es: "Comience por editar",
|
|
209
|
+
}),
|
|
210
|
+
reactLink: {
|
|
211
|
+
href: "https://reactjs.org",
|
|
212
|
+
content: t({
|
|
213
|
+
en: "Learn React",
|
|
214
|
+
fr: "Apprendre React",
|
|
215
|
+
es: "Aprender React",
|
|
216
|
+
}),
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export default appContent;
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```jsx fileName="src/app.content.csx" codeFormat="commonjs"
|
|
225
|
+
const { t } = require("intlayer");
|
|
226
|
+
|
|
227
|
+
/** @type {import('intlayer').Dictionary} */
|
|
228
|
+
const appContent = {
|
|
229
|
+
key: "app",
|
|
230
|
+
content: {
|
|
231
|
+
getStarted: t({
|
|
232
|
+
en: "Get started by editing",
|
|
233
|
+
fr: "Commencez par éditer",
|
|
234
|
+
es: "Comience por editar",
|
|
235
|
+
pl: "Rozpocznij od edycji", // komentarz po polsku
|
|
236
|
+
}),
|
|
237
|
+
reactLink: {
|
|
238
|
+
href: "https://reactjs.org",
|
|
239
|
+
content: t({
|
|
240
|
+
en: "Learn React",
|
|
241
|
+
fr: "Apprendre React",
|
|
242
|
+
es: "Aprender React",
|
|
243
|
+
pl: "Poznaj React", // komentarz po polsku
|
|
244
|
+
}),
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
module.exports = appContent;
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
> Twoje deklaracje zawartości mogą być definiowane w dowolnym miejscu w Twojej aplikacji, pod warunkiem, że zostaną umieszczone w katalogu `contentDir` (domyślnie `./src`). I będą miały rozszerzenie pliku deklaracji zawartości (domyślnie `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
253
|
+
|
|
254
|
+
> Aby uzyskać więcej szczegółów, zapoznaj się z [dokumentacją deklaracji zawartości](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/dictionary/content_file.md).
|
|
255
|
+
|
|
256
|
+
> Jeśli Twój plik zawartości zawiera kod TSX, powinieneś rozważyć import `import React from "react";` w swoim pliku zawartości.
|
|
257
|
+
|
|
258
|
+
### Krok 5: Wykorzystaj Intlayer w swoim kodzie
|
|
259
|
+
|
|
260
|
+
Uzyskaj dostęp do swoich słowników zawartości w całej aplikacji:
|
|
261
|
+
|
|
262
|
+
```tsx {4,7} fileName="src/App.tsx" codeFormat="typescript"
|
|
263
|
+
import logo from "./logo.svg";
|
|
264
|
+
import "./App.css";
|
|
265
|
+
import type { FC } from "react";
|
|
266
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
267
|
+
|
|
268
|
+
const AppContent: FC = () => {
|
|
269
|
+
const content = useIntlayer("app");
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
<div className="App">
|
|
273
|
+
<img src={logo} className="App-logo" alt="logo" />
|
|
274
|
+
|
|
275
|
+
{content.getStarted}
|
|
276
|
+
<a
|
|
277
|
+
className="App-link"
|
|
278
|
+
href={content.reactLink.href.value}
|
|
279
|
+
target="_blank"
|
|
280
|
+
rel="noopener noreferrer"
|
|
281
|
+
>
|
|
282
|
+
{content.reactLink.content}
|
|
283
|
+
</a>
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const App: FC = () => (
|
|
289
|
+
<IntlayerProvider>
|
|
290
|
+
<AppContent />
|
|
291
|
+
</IntlayerProvider>
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
export default App;
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
```jsx {3,6} fileName="src/App.mjx" codeFormat="esm"
|
|
298
|
+
import "./App.css";
|
|
299
|
+
import logo from "./logo.svg";
|
|
300
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
301
|
+
|
|
302
|
+
const AppContent = () => {
|
|
303
|
+
const content = useIntlayer("app");
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<div className="App">
|
|
307
|
+
<img src={logo} className="App-logo" alt="logo" />
|
|
308
|
+
|
|
309
|
+
{content.getStarted}
|
|
310
|
+
<a
|
|
311
|
+
className="App-link"
|
|
312
|
+
href={content.reactLink.href.value}
|
|
313
|
+
target="_blank"
|
|
314
|
+
rel="noopener noreferrer"
|
|
315
|
+
>
|
|
316
|
+
{content.reactLink.content}
|
|
317
|
+
</a>
|
|
318
|
+
</div>
|
|
319
|
+
);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
const App = () => (
|
|
323
|
+
<IntlayerProvider>
|
|
324
|
+
<AppContent />
|
|
325
|
+
</IntlayerProvider>
|
|
326
|
+
);
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
```jsx {3,6} fileName="src/App.csx" codeFormat="commonjs"
|
|
330
|
+
require("./App.css");
|
|
331
|
+
const logo = require("./logo.svg");
|
|
332
|
+
const { IntlayerProvider, useIntlayer } = require("react-intlayer");
|
|
333
|
+
|
|
334
|
+
const AppContent = () => {
|
|
335
|
+
const content = useIntlayer("app");
|
|
336
|
+
|
|
337
|
+
return (
|
|
338
|
+
<div className="App">
|
|
339
|
+
<img src={logo} className="App-logo" alt="logo" />
|
|
340
|
+
|
|
341
|
+
{content.getStarted}
|
|
342
|
+
<a
|
|
343
|
+
className="App-link"
|
|
344
|
+
href={content.reactLink.href.value}
|
|
345
|
+
target="_blank"
|
|
346
|
+
rel="noopener noreferrer"
|
|
347
|
+
>
|
|
348
|
+
{content.reactLink.content}
|
|
349
|
+
</a>
|
|
350
|
+
</div>
|
|
351
|
+
);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const App = () => (
|
|
355
|
+
<IntlayerProvider>
|
|
356
|
+
<AppContent />
|
|
357
|
+
</IntlayerProvider>
|
|
358
|
+
);
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
> Uwaga: Jeśli chcesz użyć swojej zawartości w atrybucie typu `string`, takim jak `alt`, `title`, `href`, `aria-label` itp., musisz wywołać wartość funkcji, na przykład:
|
|
362
|
+
|
|
363
|
+
> ```jsx
|
|
364
|
+
> <img src={content.image.src.value} alt={content.image.value} />
|
|
365
|
+
> ```
|
|
366
|
+
|
|
367
|
+
> Aby dowiedzieć się więcej o hooku `useIntlayer`, zapoznaj się z [dokumentacją](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/react-intlayer/useIntlayer.md).
|
|
368
|
+
|
|
369
|
+
### (Opcjonalny) Krok 6: Zmień język swojej zawartości
|
|
370
|
+
|
|
371
|
+
Aby zmienić język swojej zawartości, możesz użyć funkcji `setLocale` dostarczonej przez hook `useLocale`. Funkcja ta pozwala ustawić lokalizację aplikacji i odpowiednio zaktualizować zawartość.
|
|
372
|
+
|
|
373
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
374
|
+
import { Locales } from "intlayer";
|
|
375
|
+
import { useLocale } from "react-intlayer";
|
|
376
|
+
|
|
377
|
+
const LocaleSwitcher = () => {
|
|
378
|
+
const { setLocale } = useLocale();
|
|
379
|
+
|
|
380
|
+
return (
|
|
381
|
+
<button onClick={() => setLocale(Locales.English)}>
|
|
382
|
+
Change Language to English
|
|
383
|
+
</button>
|
|
384
|
+
);
|
|
385
|
+
};
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
```jsx fileName="src/components/LocaleSwitcher.mjx" codeFormat="esm"
|
|
389
|
+
import { Locales } from "intlayer";
|
|
390
|
+
import { useLocale } from "react-intlayer";
|
|
391
|
+
|
|
392
|
+
const LocaleSwitcher = () => {
|
|
393
|
+
const { setLocale } = useLocale();
|
|
394
|
+
|
|
395
|
+
return (
|
|
396
|
+
<button onClick={() => setLocale(Locales.English)}>
|
|
397
|
+
Zmień język na angielski
|
|
398
|
+
</button>
|
|
399
|
+
);
|
|
400
|
+
};
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
```jsx fileName="src/components/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
404
|
+
const { Locales } = require("intlayer");
|
|
405
|
+
const { useLocale } = require("react-intlayer");
|
|
406
|
+
|
|
407
|
+
const LocaleSwitcher = () => {
|
|
408
|
+
const { setLocale } = useLocale();
|
|
409
|
+
|
|
410
|
+
return (
|
|
411
|
+
<button onClick={() => setLocale(Locales.English)}>
|
|
412
|
+
Zmień język na angielski
|
|
413
|
+
</button>
|
|
414
|
+
);
|
|
415
|
+
};
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
> Aby dowiedzieć się więcej o hooku `useLocale`, zapoznaj się z [dokumentacją](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/react-intlayer/useLocale.md).
|
|
419
|
+
|
|
420
|
+
### (Opcjonalny) Krok 7: Dodaj lokalizowane routingi do swojej aplikacji
|
|
421
|
+
|
|
422
|
+
Celem tego kroku jest utworzenie unikalnych ścieżek dla każdego języka. Jest to przydatne dla SEO oraz przyjaznych dla SEO adresów URL.
|
|
423
|
+
Przykład:
|
|
424
|
+
|
|
425
|
+
```plaintext
|
|
426
|
+
- https://example.com/about
|
|
427
|
+
- https://example.com/es/about
|
|
428
|
+
- https://example.com/fr/about
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
> Domyślnie trasy nie mają prefiksu dla domyślnej lokalizacji. Jeśli chcesz dodać prefiks dla domyślnej lokalizacji, możesz ustawić opcję `middleware.prefixDefault` na `true` w swojej konfiguracji. Więcej informacji znajdziesz w [dokumentacji konfiguracji](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/configuration.md).
|
|
432
|
+
|
|
433
|
+
Aby dodać lokalizowane routingi do swojej aplikacji, możesz utworzyć komponent `LocaleRouter`, który opakuje trasy Twojej aplikacji i obsłuży routing oparty na lokalizacji. Oto przykład użycia [React Router](https://reactrouter.com/home):
|
|
434
|
+
|
|
435
|
+
```tsx fileName="src/components/LocaleRouter.tsx" codeFormat="typescript"
|
|
436
|
+
// Importowanie niezbędnych zależności i funkcji
|
|
437
|
+
import { type Locales, configuration, getPathWithoutLocale } from "intlayer"; // Funkcje narzędziowe i typy z 'intlayer'
|
|
438
|
+
// Funkcje narzędziowe i typy z 'intlayer'
|
|
439
|
+
import type { FC, PropsWithChildren } from "react"; // Typy React dla komponentów funkcyjnych i propsów
|
|
440
|
+
import { IntlayerProvider } from "react-intlayer"; // Provider dla kontekstu internacjonalizacji
|
|
441
|
+
import {
|
|
442
|
+
BrowserRouter,
|
|
443
|
+
Routes,
|
|
444
|
+
Route,
|
|
445
|
+
Navigate,
|
|
446
|
+
useLocation,
|
|
447
|
+
} from "react-router-dom"; // Komponenty routera do zarządzania nawigacją
|
|
448
|
+
|
|
449
|
+
// Destrukturyzacja konfiguracji z Intlayer
|
|
450
|
+
const { internationalization, middleware } = configuration;
|
|
451
|
+
const { locales, defaultLocale } = internationalization;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Komponent obsługujący lokalizację i opakowujący dzieci w odpowiedni kontekst lokalizacji.
|
|
455
|
+
* Zarządza wykrywaniem i walidacją lokalizacji na podstawie URL.
|
|
456
|
+
*/
|
|
457
|
+
const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
458
|
+
children,
|
|
459
|
+
locale,
|
|
460
|
+
}) => {
|
|
461
|
+
const { pathname, search } = useLocation(); // Pobierz aktualną ścieżkę URL
|
|
462
|
+
|
|
463
|
+
// Określ bieżącą lokalizację, domyślnie używając domyślnej, jeśli nie jest podana
|
|
464
|
+
const currentLocale = locale ?? defaultLocale;
|
|
465
|
+
|
|
466
|
+
// Usuń prefiks lokalizacji ze ścieżki, aby utworzyć bazową ścieżkę
|
|
467
|
+
const pathWithoutLocale = getPathWithoutLocale(
|
|
468
|
+
pathname // Aktualna ścieżka URL
|
|
469
|
+
);
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Jeśli middleware.prefixDefault jest prawdziwe, domyślna lokalizacja powinna zawsze mieć prefiks.
|
|
473
|
+
*/
|
|
474
|
+
if (middleware.prefixDefault) {
|
|
475
|
+
// Waliduj lokalizację
|
|
476
|
+
if (!locale || !locales.includes(locale)) {
|
|
477
|
+
// Przekieruj do domyślnej lokalizacji z zaktualizowaną ścieżką
|
|
478
|
+
return (
|
|
479
|
+
<Navigate
|
|
480
|
+
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
481
|
+
replace // Zamień bieżący wpis w historii na nowy
|
|
482
|
+
/>
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// Opakuj dzieci w IntlayerProvider i ustaw bieżącą lokalizację
|
|
487
|
+
return (
|
|
488
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
489
|
+
);
|
|
490
|
+
} else {
|
|
491
|
+
/**
|
|
492
|
+
* Gdy middleware.prefixDefault jest false, domyślna lokalizacja nie jest poprzedzona prefiksem.
|
|
493
|
+
* Upewnij się, że bieżąca lokalizacja jest prawidłowa i nie jest domyślną lokalizacją.
|
|
494
|
+
*/
|
|
495
|
+
if (
|
|
496
|
+
currentLocale.toString() !== defaultLocale.toString() &&
|
|
497
|
+
!locales
|
|
498
|
+
.filter(
|
|
499
|
+
(locale) => locale.toString() !== defaultLocale.toString() // Wyklucz domyślną lokalizację
|
|
500
|
+
)
|
|
501
|
+
.includes(currentLocale) // Sprawdź, czy bieżąca lokalizacja znajduje się na liście ważnych lokalizacji
|
|
502
|
+
) {
|
|
503
|
+
// Przekieruj do ścieżki bez prefiksu lokalizacji
|
|
504
|
+
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// Opakuj dzieci w IntlayerProvider i ustaw bieżącą lokalizację
|
|
508
|
+
return (
|
|
509
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Komponent routera, który ustawia trasy specyficzne dla lokalizacji.
|
|
516
|
+
* Używa React Router do zarządzania nawigacją i renderowania zlokalizowanych komponentów.
|
|
517
|
+
*/
|
|
518
|
+
export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
519
|
+
<BrowserRouter>
|
|
520
|
+
<Routes>
|
|
521
|
+
{locales
|
|
522
|
+
.filter(
|
|
523
|
+
(locale) => middleware.prefixDefault || locale !== defaultLocale
|
|
524
|
+
)
|
|
525
|
+
.map((locale) => (
|
|
526
|
+
<Route
|
|
527
|
+
// Wzorzec ścieżki do przechwycenia lokalizacji (np. /en/, /fr/) i dopasowania wszystkich kolejnych ścieżek
|
|
528
|
+
path={`/${locale}/*`}
|
|
529
|
+
key={locale}
|
|
530
|
+
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Opakowuje dzieci zarządzaniem lokalizacją
|
|
531
|
+
/>
|
|
532
|
+
))}
|
|
533
|
+
|
|
534
|
+
{
|
|
535
|
+
// Jeśli prefiksowanie domyślnej lokalizacji jest wyłączone, renderuj dzieci bezpośrednio na ścieżce głównej
|
|
536
|
+
!middleware.prefixDefault && (
|
|
537
|
+
<Route
|
|
538
|
+
path="*"
|
|
539
|
+
element={
|
|
540
|
+
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
541
|
+
} // Opakowuje dzieci zarządzaniem lokalizacją
|
|
542
|
+
/>
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
</Routes>
|
|
546
|
+
</BrowserRouter>
|
|
547
|
+
);
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
```jsx fileName="src/components/LocaleRouter.mjx" codeFormat="esm"
|
|
551
|
+
// Importowanie niezbędnych zależności i funkcji
|
|
552
|
+
import { configuration, getPathWithoutLocale } from "intlayer"; // Funkcje narzędziowe i typy z 'intlayer'
|
|
553
|
+
// Funkcje narzędziowe i typy z 'intlayer'
|
|
554
|
+
import { IntlayerProvider } from "react-intlayer"; // Provider kontekstu internacjonalizacji
|
|
555
|
+
import {
|
|
556
|
+
BrowserRouter,
|
|
557
|
+
Routes,
|
|
558
|
+
Route,
|
|
559
|
+
Navigate,
|
|
560
|
+
useLocation,
|
|
561
|
+
} from "react-router-dom"; // Komponenty routera do zarządzania nawigacją
|
|
562
|
+
|
|
563
|
+
// Destrukturyzacja konfiguracji z Intlayer
|
|
564
|
+
const { internationalization, middleware } = configuration;
|
|
565
|
+
const { locales, defaultLocale } = internationalization;
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Komponent obsługujący lokalizację i opakowujący dzieci w odpowiedni kontekst lokalizacji.
|
|
569
|
+
|
|
570
|
+
* Zarządza wykrywaniem i walidacją lokalizacji na podstawie URL.
|
|
571
|
+
*/
|
|
572
|
+
const AppLocalized = ({ children, locale }) => {
|
|
573
|
+
const { pathname, search } = useLocation(); // Pobierz aktualną ścieżkę URL
|
|
574
|
+
|
|
575
|
+
// Określ bieżącą lokalizację, domyślnie ustawiając na defaultLocale, jeśli nie podano
|
|
576
|
+
const currentLocale = locale ?? defaultLocale;
|
|
577
|
+
|
|
578
|
+
// Usuń prefiks lokalizacji ze ścieżki, aby utworzyć ścieżkę bazową
|
|
579
|
+
const pathWithoutLocale = getPathWithoutLocale(
|
|
580
|
+
pathname // Aktualna ścieżka URL
|
|
581
|
+
);
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Jeśli middleware.prefixDefault jest true, domyślna lokalizacja powinna zawsze mieć prefiks.
|
|
585
|
+
*/
|
|
586
|
+
if (middleware.prefixDefault) {
|
|
587
|
+
// Waliduj lokalizację
|
|
588
|
+
if (!locale || !locales.includes(locale)) {
|
|
589
|
+
// Przekieruj do domyślnej lokalizacji z zaktualizowaną ścieżką
|
|
590
|
+
return (
|
|
591
|
+
<Navigate
|
|
592
|
+
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
593
|
+
replace // Zamień bieżący wpis w historii na nowy
|
|
594
|
+
/>
|
|
595
|
+
);
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// Opakuj dzieci w IntlayerProvider i ustaw bieżącą lokalizację
|
|
599
|
+
return (
|
|
600
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
601
|
+
);
|
|
602
|
+
} else {
|
|
603
|
+
/**
|
|
604
|
+
* Gdy middleware.prefixDefault jest false, domyślna lokalizacja nie jest poprzedzona prefiksem.
|
|
605
|
+
* Upewnij się, że bieżąca lokalizacja jest poprawna i nie jest domyślną lokalizacją.
|
|
606
|
+
*/
|
|
607
|
+
if (
|
|
608
|
+
currentLocale.toString() !== defaultLocale.toString() &&
|
|
609
|
+
!locales
|
|
610
|
+
.filter(
|
|
611
|
+
(locale) => locale.toString() !== defaultLocale.toString() // Wyklucz domyślną lokalizację
|
|
612
|
+
)
|
|
613
|
+
.includes(currentLocale) // Sprawdź, czy bieżąca lokalizacja znajduje się na liście ważnych lokalizacji
|
|
614
|
+
) {
|
|
615
|
+
// Przekieruj do ścieżki bez prefiksu lokalizacji
|
|
616
|
+
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// Opakuj dzieci w IntlayerProvider i ustaw bieżącą lokalizację
|
|
620
|
+
return (
|
|
621
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Komponent routera, który ustawia trasy specyficzne dla lokalizacji.
|
|
628
|
+
* Używa React Router do zarządzania nawigacją i renderowania zlokalizowanych komponentów.
|
|
629
|
+
*/
|
|
630
|
+
export const LocaleRouter = ({ children }) => (
|
|
631
|
+
<BrowserRouter>
|
|
632
|
+
<Routes>
|
|
633
|
+
{locales
|
|
634
|
+
.filter(
|
|
635
|
+
(locale) => middleware.prefixDefault || locale !== defaultLocale
|
|
636
|
+
)
|
|
637
|
+
.map((locale) => (
|
|
638
|
+
<Route
|
|
639
|
+
// Wzorzec trasy do przechwytywania lokalizacji (np. /en/, /fr/) i dopasowywania wszystkich kolejnych ścieżek
|
|
640
|
+
path={`/${locale}/*`}
|
|
641
|
+
key={locale}
|
|
642
|
+
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Otacza dzieci zarządzaniem lokalizacją
|
|
643
|
+
/>
|
|
644
|
+
))}
|
|
645
|
+
|
|
646
|
+
{
|
|
647
|
+
// Jeśli prefiksowanie domyślnej lokalizacji jest wyłączone, renderuj dzieci bezpośrednio na ścieżce głównej
|
|
648
|
+
!middleware.prefixDefault && (
|
|
649
|
+
<Route
|
|
650
|
+
path="*"
|
|
651
|
+
element={
|
|
652
|
+
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
653
|
+
} // Otacza dzieci zarządzaniem lokalizacją
|
|
654
|
+
/>
|
|
655
|
+
)
|
|
656
|
+
}
|
|
657
|
+
</Routes>
|
|
658
|
+
</BrowserRouter>
|
|
659
|
+
);
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
```jsx fileName="src/components/LocaleRouter.cjx" codeFormat="commonjs"
|
|
663
|
+
// Importowanie niezbędnych zależności i funkcji
|
|
664
|
+
const { configuration, getPathWithoutLocale } = require("intlayer"); // Funkcje narzędziowe i typy z 'intlayer'
|
|
665
|
+
const { IntlayerProvider, useLocale } = require("react-intlayer"); // Provider kontekstu internacjonalizacji
|
|
666
|
+
const {
|
|
667
|
+
BrowserRouter,
|
|
668
|
+
Routes,
|
|
669
|
+
Route,
|
|
670
|
+
Navigate,
|
|
671
|
+
useLocation,
|
|
672
|
+
} = require("react-router-dom"); // Komponenty routera do zarządzania nawigacją
|
|
673
|
+
|
|
674
|
+
// Destrukturyzacja konfiguracji z Intlayer
|
|
675
|
+
const { internationalization, middleware } = configuration;
|
|
676
|
+
const { locales, defaultLocale } = internationalization;
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Komponent obsługujący lokalizację i opakowujący dzieci w odpowiedni kontekst lokalizacji.
|
|
680
|
+
* Zarządza wykrywaniem i walidacją lokalizacji na podstawie URL.
|
|
681
|
+
*/
|
|
682
|
+
const AppLocalized = ({ children, locale }) => {
|
|
683
|
+
const { pathname, search } = useLocation(); // Pobierz aktualną ścieżkę URL
|
|
684
|
+
|
|
685
|
+
// Określ bieżący język, domyślnie ustawiając na domyślny, jeśli nie podano
|
|
686
|
+
const currentLocale = locale ?? defaultLocale;
|
|
687
|
+
|
|
688
|
+
// Usuń prefiks języka ze ścieżki, aby utworzyć bazową ścieżkę
|
|
689
|
+
const pathWithoutLocale = getPathWithoutLocale(
|
|
690
|
+
pathname // Aktualna ścieżka URL
|
|
691
|
+
);
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Jeśli middleware.prefixDefault jest prawdziwe, domyślny język powinien być zawsze poprzedzony prefiksem.
|
|
695
|
+
*/
|
|
696
|
+
if (middleware.prefixDefault) {
|
|
697
|
+
// Waliduj język
|
|
698
|
+
if (!locale || !locales.includes(locale)) {
|
|
699
|
+
// Przekieruj do domyślnego języka z zaktualizowaną ścieżką
|
|
700
|
+
return (
|
|
701
|
+
<Navigate
|
|
702
|
+
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
703
|
+
replace // Zamień bieżący wpis w historii na nowy
|
|
704
|
+
/>
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// Opakuj dzieci w IntlayerProvider i ustaw bieżącą lokalizację
|
|
709
|
+
return (
|
|
710
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
711
|
+
);
|
|
712
|
+
} else {
|
|
713
|
+
/**
|
|
714
|
+
* Gdy middleware.prefixDefault jest false, domyślna lokalizacja nie jest prefiksem.
|
|
715
|
+
* Upewnij się, że bieżąca lokalizacja jest poprawna i nie jest domyślną lokalizacją.
|
|
716
|
+
*/
|
|
717
|
+
if (
|
|
718
|
+
currentLocale.toString() !== defaultLocale.toString() &&
|
|
719
|
+
!locales
|
|
720
|
+
.filter(
|
|
721
|
+
(locale) => locale.toString() !== defaultLocale.toString() // Wyklucz domyślną lokalizację
|
|
722
|
+
)
|
|
723
|
+
.includes(currentLocale) // Sprawdź, czy bieżąca lokalizacja jest na liście poprawnych lokalizacji
|
|
724
|
+
) {
|
|
725
|
+
// Przekieruj do ścieżki bez prefiksu języka
|
|
726
|
+
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
// Opakuj dzieci w IntlayerProvider i ustaw bieżący język
|
|
730
|
+
return (
|
|
731
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Komponent routera, który ustawia trasy specyficzne dla języka.
|
|
738
|
+
* Używa React Router do zarządzania nawigacją i renderowania zlokalizowanych komponentów.
|
|
739
|
+
*/
|
|
740
|
+
const LocaleRouter = ({ children }) => (
|
|
741
|
+
<BrowserRouter>
|
|
742
|
+
<Routes>
|
|
743
|
+
{locales
|
|
744
|
+
.filter(
|
|
745
|
+
(locale) => middleware.prefixDefault || locale !== defaultLocale
|
|
746
|
+
)
|
|
747
|
+
.map((locale) => (
|
|
748
|
+
<Route
|
|
749
|
+
// Wzorzec trasy do przechwycenia języka (np. /en/, /fr/) i dopasowania wszystkich kolejnych ścieżek
|
|
750
|
+
path={`/${locale}/*`}
|
|
751
|
+
key={locale}
|
|
752
|
+
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Otacza dzieci zarządzaniem lokalizacją
|
|
753
|
+
/>
|
|
754
|
+
))}
|
|
755
|
+
|
|
756
|
+
{
|
|
757
|
+
// Jeśli prefiksowanie domyślnej lokalizacji jest wyłączone, renderuj dzieci bezpośrednio na ścieżce głównej
|
|
758
|
+
!middleware.prefixDefault && (
|
|
759
|
+
<Route
|
|
760
|
+
path="*"
|
|
761
|
+
element={
|
|
762
|
+
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
763
|
+
} // Otacza dzieci zarządzaniem lokalizacją
|
|
764
|
+
/>
|
|
765
|
+
)
|
|
766
|
+
}
|
|
767
|
+
</Routes>
|
|
768
|
+
</BrowserRouter>
|
|
769
|
+
);
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
Następnie możesz użyć komponentu `LocaleRouter` w swojej aplikacji:
|
|
773
|
+
|
|
774
|
+
```tsx fileName="src/App.tsx" codeFormat="typescript"
|
|
775
|
+
import { LocaleRouter } from "./components/LocaleRouter";
|
|
776
|
+
import type { FC } from "react";
|
|
777
|
+
|
|
778
|
+
// ... Twój komponent AppContent
|
|
779
|
+
|
|
780
|
+
const App: FC = () => (
|
|
781
|
+
<LocaleRouter>
|
|
782
|
+
<AppContent />
|
|
783
|
+
</LocaleRouter>
|
|
784
|
+
);
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
```jsx fileName="src/App.mjx" codeFormat="esm"
|
|
788
|
+
import { LocaleRouter } from "./components/LocaleRouter";
|
|
789
|
+
|
|
790
|
+
// ... Twój komponent AppContent
|
|
791
|
+
|
|
792
|
+
const App = () => (
|
|
793
|
+
<LocaleRouter>
|
|
794
|
+
<AppContent />
|
|
795
|
+
</LocaleRouter>
|
|
796
|
+
);
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
```jsx fileName="src/App.cjx" codeFormat="commonjs"
|
|
800
|
+
const { LocaleRouter } = require("./components/LocaleRouter");
|
|
801
|
+
|
|
802
|
+
// ... Twój komponent AppContent
|
|
803
|
+
|
|
804
|
+
const App = () => (
|
|
805
|
+
<LocaleRouter>
|
|
806
|
+
<AppContent />
|
|
807
|
+
</LocaleRouter>
|
|
808
|
+
);
|
|
809
|
+
```
|
|
810
|
+
|
|
811
|
+
### (Opcjonalny) Krok 8: Zmiana URL po zmianie lokalizacji
|
|
812
|
+
|
|
813
|
+
Aby zmienić URL podczas zmiany lokalizacji, możesz użyć właściwości `onLocaleChange` dostarczonej przez hook `useLocale`. Równolegle możesz użyć hooków `useLocation` i `useNavigate` z `react-router-dom`, aby zaktualizować ścieżkę URL.
|
|
814
|
+
|
|
815
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
816
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
817
|
+
import {
|
|
818
|
+
Locales,
|
|
819
|
+
getHTMLTextDir,
|
|
820
|
+
getLocaleName,
|
|
821
|
+
getLocalizedUrl,
|
|
822
|
+
} from "intlayer";
|
|
823
|
+
import { useLocale } from "react-intlayer";
|
|
824
|
+
import { type FC } from "react";
|
|
825
|
+
|
|
826
|
+
const LocaleSwitcher: FC = () => {
|
|
827
|
+
const { pathname, search } = useLocation(); // Pobierz aktualną ścieżkę URL. Przykład: /fr/about?foo=bar
|
|
828
|
+
const navigate = useNavigate();
|
|
829
|
+
|
|
830
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
831
|
+
onLocaleChange: (locale) => {
|
|
832
|
+
// Konstrukcja URL z zaktualizowaną lokalizacją
|
|
833
|
+
// Przykład: /es/about?foo=bar
|
|
834
|
+
const pathWithLocale = getLocalizedUrl(`${pathname}${search}`, locale);
|
|
835
|
+
|
|
836
|
+
// Aktualizacja ścieżki URL
|
|
837
|
+
navigate(pathWithLocale);
|
|
838
|
+
},
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
return (
|
|
842
|
+
<div>
|
|
843
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
844
|
+
<div id="localePopover" popover="auto">
|
|
845
|
+
{availableLocales.map((localeItem) => (
|
|
846
|
+
<a
|
|
847
|
+
href={getLocalizedUrl(location.pathname, localeItem)}
|
|
848
|
+
hrefLang={localeItem}
|
|
849
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
850
|
+
onClick={(e) => {
|
|
851
|
+
e.preventDefault();
|
|
852
|
+
setLocale(localeItem);
|
|
853
|
+
}}
|
|
854
|
+
key={localeItem}
|
|
855
|
+
>
|
|
856
|
+
<span>
|
|
857
|
+
{/* Lokalizacja - np. FR */}
|
|
858
|
+
{localeItem}
|
|
859
|
+
</span>
|
|
860
|
+
<span>
|
|
861
|
+
{/* Język w swojej własnej lokalizacji - np. Français */}
|
|
862
|
+
{getLocaleName(localeItem, locale)}
|
|
863
|
+
</span>
|
|
864
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
865
|
+
{/* Język w bieżącej lokalizacji - np. Francés przy ustawionej lokalizacji Locales.SPANISH */}
|
|
866
|
+
{getLocaleName(localeItem)}
|
|
867
|
+
</span>
|
|
868
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
869
|
+
{/* Język po angielsku - np. French */}
|
|
870
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
871
|
+
</span>
|
|
872
|
+
</a>
|
|
873
|
+
))}
|
|
874
|
+
</div>
|
|
875
|
+
</div>
|
|
876
|
+
);
|
|
877
|
+
};
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
```jsx fileName="src/components/LocaleSwitcher.msx" codeFormat="esm"
|
|
881
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
882
|
+
import {
|
|
883
|
+
Locales,
|
|
884
|
+
getHTMLTextDir,
|
|
885
|
+
getLocaleName,
|
|
886
|
+
getLocalizedUrl,
|
|
887
|
+
} from "intlayer";
|
|
888
|
+
import { useLocale } from "react-intlayer";
|
|
889
|
+
|
|
890
|
+
const LocaleSwitcher = () => {
|
|
891
|
+
const { pathname, search } = useLocation(); // Pobierz aktualną ścieżkę URL. Przykład: /fr/about?foo=bar
|
|
892
|
+
const navigate = useNavigate();
|
|
893
|
+
|
|
894
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
895
|
+
onLocaleChange: (locale) => {
|
|
896
|
+
// Utwórz URL z zaktualizowanym locale
|
|
897
|
+
// Przykład: /es/about?foo=bar
|
|
898
|
+
const pathWithLocale = getLocalizedUrl(`${pathname}${search}`, locale);
|
|
899
|
+
|
|
900
|
+
// Zaktualizuj ścieżkę URL
|
|
901
|
+
navigate(pathWithLocale);
|
|
902
|
+
},
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
return (
|
|
906
|
+
<div>
|
|
907
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
908
|
+
<div id="localePopover" popover="auto">
|
|
909
|
+
{availableLocales.map((localeItem) => (
|
|
910
|
+
<a
|
|
911
|
+
href={getLocalizedUrl(location.pathname, localeItem)}
|
|
912
|
+
hrefLang={localeItem}
|
|
913
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
914
|
+
onClick={(e) => {
|
|
915
|
+
e.preventDefault();
|
|
916
|
+
setLocale(localeItem);
|
|
917
|
+
}}
|
|
918
|
+
key={localeItem}
|
|
919
|
+
>
|
|
920
|
+
<span>
|
|
921
|
+
{/* Lokalizacja - np. FR */}
|
|
922
|
+
{localeItem}
|
|
923
|
+
</span>
|
|
924
|
+
<span>
|
|
925
|
+
{/* Język w jego własnej lokalizacji - np. Français */}
|
|
926
|
+
{getLocaleName(localeItem, locale)}
|
|
927
|
+
</span>
|
|
928
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
929
|
+
{/* Język w bieżącej lokalizacji - np. Francés przy ustawionej lokalizacji Locales.SPANISH */}
|
|
930
|
+
{getLocaleName(localeItem)}
|
|
931
|
+
</span>
|
|
932
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
933
|
+
{/* Język po angielsku - np. French */}
|
|
934
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
935
|
+
</span>
|
|
936
|
+
</a>
|
|
937
|
+
))}
|
|
938
|
+
</div>
|
|
939
|
+
</div>
|
|
940
|
+
);
|
|
941
|
+
};
|
|
942
|
+
```
|
|
943
|
+
|
|
944
|
+
```jsx fileName="src/components/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
945
|
+
const { useLocation, useNavigate } = require("react-router-dom");
|
|
946
|
+
const {
|
|
947
|
+
Locales,
|
|
948
|
+
getHTMLTextDir,
|
|
949
|
+
getLocaleName,
|
|
950
|
+
getLocalizedUrl,
|
|
951
|
+
} = require("intlayer");
|
|
952
|
+
const { useLocale } = require("react-intlayer");
|
|
953
|
+
|
|
954
|
+
const LocaleSwitcher = () => {
|
|
955
|
+
const { pathname, search } = useLocation(); // Pobierz aktualną ścieżkę URL. Przykład: /fr/about?foo=bar
|
|
956
|
+
const navigate = useNavigate();
|
|
957
|
+
|
|
958
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
959
|
+
onLocaleChange: (locale) => {
|
|
960
|
+
// Utwórz URL z zaktualizowaną lokalizacją
|
|
961
|
+
// Przykład: /es/about?foo=bar
|
|
962
|
+
const pathWithLocale = getLocalizedUrl(`${pathname}${search}`, locale);
|
|
963
|
+
|
|
964
|
+
// Zaktualizuj ścieżkę URL
|
|
965
|
+
navigate(pathWithLocale);
|
|
966
|
+
},
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
return (
|
|
970
|
+
<div>
|
|
971
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
972
|
+
<div id="localePopover" popover="auto">
|
|
973
|
+
{availableLocales.map((localeItem) => (
|
|
974
|
+
<a
|
|
975
|
+
href={getLocalizedUrl(location.pathname, localeItem)}
|
|
976
|
+
hrefLang={localeItem}
|
|
977
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
978
|
+
onClick={(e) => {
|
|
979
|
+
e.preventDefault();
|
|
980
|
+
setLocale(localeItem);
|
|
981
|
+
}}
|
|
982
|
+
key={localeItem}
|
|
983
|
+
>
|
|
984
|
+
<span>
|
|
985
|
+
{/* Lokalizacja - np. FR */}
|
|
986
|
+
{localeItem}
|
|
987
|
+
</span>
|
|
988
|
+
<span>
|
|
989
|
+
{/* Język w jego własnej lokalizacji - np. Français */}
|
|
990
|
+
{getLocaleName(localeItem, locale)}
|
|
991
|
+
</span>
|
|
992
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
993
|
+
{/* Język w bieżącej lokalizacji - np. Francés przy ustawionej lokalizacji Locales.SPANISH */}
|
|
994
|
+
{getLocaleName(localeItem)}
|
|
995
|
+
</span>
|
|
996
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
997
|
+
{/* Język po angielsku - np. French */}
|
|
998
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
999
|
+
</span>
|
|
1000
|
+
</a>
|
|
1001
|
+
))}
|
|
1002
|
+
</div>
|
|
1003
|
+
</div>
|
|
1004
|
+
);
|
|
1005
|
+
};
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
> Odwołania do dokumentacji:
|
|
1009
|
+
>
|
|
1010
|
+
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/react-intlayer/useLocale.md)
|
|
1011
|
+
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/intlayer/getLocaleName.md)
|
|
1012
|
+
> - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/intlayer/getLocalizedUrl.md)
|
|
1013
|
+
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/intlayer/getHTMLTextDir.md)
|
|
1014
|
+
> - [`hrefLang` atrybut](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
|
|
1015
|
+
> - [`lang` atrybut](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
|
|
1016
|
+
> - [`dir` atrybut](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
|
|
1017
|
+
> - [`aria-current` atrybut](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
|
|
1018
|
+
|
|
1019
|
+
### (Opcjonalny) Krok 9: Zmiana atrybutów języka i kierunku w tagu HTML
|
|
1020
|
+
|
|
1021
|
+
Gdy Twoja aplikacja obsługuje wiele języków, kluczowe jest, aby zaktualizować atrybuty `lang` i `dir` w tagu `<html>`, tak aby odpowiadały bieżącej lokalizacji. Zapewnia to:
|
|
1022
|
+
|
|
1023
|
+
- **Dostępność**: Czytniki ekranu i technologie wspomagające polegają na poprawnym atrybucie `lang`, aby prawidłowo wymawiać i interpretować zawartość.
|
|
1024
|
+
- **Renderowanie tekstu**: Atrybut `dir` (kierunek) zapewnia, że tekst jest wyświetlany w odpowiedniej kolejności (np. od lewej do prawej dla języka angielskiego, od prawej do lewej dla arabskiego lub hebrajskiego), co jest kluczowe dla czytelności.
|
|
1025
|
+
- **SEO**: Wyszukiwarki używają atrybutu `lang`, aby określić język strony, co pomaga w dostarczaniu odpowiednio zlokalizowanych treści w wynikach wyszukiwania.
|
|
1026
|
+
|
|
1027
|
+
Poprzez dynamiczną aktualizację tych atrybutów przy zmianie lokalizacji, zapewniasz spójne i dostępne doświadczenie dla użytkowników we wszystkich obsługiwanych językach.
|
|
1028
|
+
|
|
1029
|
+
#### Implementacja hooka
|
|
1030
|
+
|
|
1031
|
+
Utwórz niestandardowy hook do zarządzania atrybutami HTML. Hook nasłuchuje zmian lokalizacji i odpowiednio aktualizuje atrybuty:
|
|
1032
|
+
|
|
1033
|
+
```tsx fileName="src/hooks/useI18nHTMLAttributes.tsx" codeFormat="typescript"
|
|
1034
|
+
import { useEffect } from "react";
|
|
1035
|
+
import { useLocale } from "react-intlayer";
|
|
1036
|
+
import { getHTMLTextDir } from "intlayer";
|
|
1037
|
+
|
|
1038
|
+
/**
|
|
1039
|
+
* Aktualizuje atrybuty `lang` i `dir` elementu HTML <html> na podstawie bieżącej lokalizacji.
|
|
1040
|
+
* - `lang`: Informuje przeglądarki i wyszukiwarki o języku strony.
|
|
1041
|
+
* - `dir`: Zapewnia poprawny kierunek czytania (np. 'ltr' dla angielskiego, 'rtl' dla arabskiego).
|
|
1042
|
+
*
|
|
1043
|
+
* Ta dynamiczna aktualizacja jest niezbędna dla prawidłowego renderowania tekstu, dostępności i SEO.
|
|
1044
|
+
*/
|
|
1045
|
+
export const useI18nHTMLAttributes = () => {
|
|
1046
|
+
const { locale } = useLocale();
|
|
1047
|
+
|
|
1048
|
+
useEffect(() => {
|
|
1049
|
+
// Aktualizuje atrybut języka na bieżącą lokalizację.
|
|
1050
|
+
document.documentElement.lang = locale;
|
|
1051
|
+
|
|
1052
|
+
// Ustawia kierunek tekstu na podstawie bieżącej lokalizacji.
|
|
1053
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
1054
|
+
}, [locale]);
|
|
1055
|
+
};
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
```jsx fileName="src/hooks/useI18nHTMLAttributes.msx" codeFormat="esm"
|
|
1059
|
+
import { useEffect } from "react";
|
|
1060
|
+
import { useLocale } from "react-intlayer";
|
|
1061
|
+
import { getHTMLTextDir } from "intlayer";
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Aktualizuje atrybuty `lang` i `dir` elementu HTML <html> na podstawie bieżącej lokalizacji.
|
|
1065
|
+
* - `lang`: Informuje przeglądarki i wyszukiwarki o języku strony.
|
|
1066
|
+
* - `dir`: Zapewnia prawidłowy kierunek czytania (np. 'ltr' dla angielskiego, 'rtl' dla arabskiego).
|
|
1067
|
+
*
|
|
1068
|
+
* Ta dynamiczna aktualizacja jest niezbędna dla prawidłowego renderowania tekstu, dostępności i SEO.
|
|
1069
|
+
*/
|
|
1070
|
+
export const useI18nHTMLAttributes = () => {
|
|
1071
|
+
const { locale } = useLocale();
|
|
1072
|
+
|
|
1073
|
+
useEffect(() => {
|
|
1074
|
+
// Aktualizuje atrybut języka na aktualny locale.
|
|
1075
|
+
document.documentElement.lang = locale;
|
|
1076
|
+
|
|
1077
|
+
// Ustawia kierunek tekstu na podstawie aktualnego locale.
|
|
1078
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
1079
|
+
}, [locale]);
|
|
1080
|
+
};
|
|
1081
|
+
```
|
|
1082
|
+
|
|
1083
|
+
```jsx fileName="src/hooks/useI18nHTMLAttributes.csx" codeFormat="commonjs"
|
|
1084
|
+
const { useEffect } = require("react");
|
|
1085
|
+
const { useLocale } = require("react-intlayer");
|
|
1086
|
+
const { getHTMLTextDir } = require("intlayer");
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Aktualizuje atrybuty `lang` i `dir` elementu HTML <html> na podstawie aktualnego locale.
|
|
1090
|
+
* - `lang`: Informuje przeglądarki i wyszukiwarki o języku strony.
|
|
1091
|
+
* - `dir`: Zapewnia prawidłowy kierunek czytania (np. 'ltr' dla angielskiego, 'rtl' dla arabskiego).
|
|
1092
|
+
*
|
|
1093
|
+
* Ta dynamiczna aktualizacja jest niezbędna dla poprawnego renderowania tekstu, dostępności oraz SEO.
|
|
1094
|
+
*/
|
|
1095
|
+
const useI18nHTMLAttributes = () => {
|
|
1096
|
+
const { locale } = useLocale();
|
|
1097
|
+
|
|
1098
|
+
useEffect(() => {
|
|
1099
|
+
// Aktualizuj atrybut języka na bieżący locale.
|
|
1100
|
+
document.documentElement.lang = locale;
|
|
1101
|
+
|
|
1102
|
+
// Ustaw kierunek tekstu na podstawie bieżącego locale.
|
|
1103
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
1104
|
+
}, [locale]);
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1107
|
+
module.exports = { useI18nHTMLAttributes };
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
#### Użycie Hooka w Twojej Aplikacji
|
|
1111
|
+
|
|
1112
|
+
Zintegruj hook w swoim głównym komponencie, aby atrybuty HTML były aktualizowane za każdym razem, gdy zmienia się locale:
|
|
1113
|
+
|
|
1114
|
+
```tsx fileName="src/App.tsx" codeFormat="typescript"
|
|
1115
|
+
import type { FC } from "react";
|
|
1116
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
1117
|
+
import { useI18nHTMLAttributes } from "./hooks/useI18nHTMLAttributes";
|
|
1118
|
+
import "./App.css";
|
|
1119
|
+
|
|
1120
|
+
const AppContent: FC = () => {
|
|
1121
|
+
// Zastosuj hook do aktualizacji atrybutów lang i dir tagu <html> na podstawie lokalizacji.
|
|
1122
|
+
useI18nHTMLAttributes();
|
|
1123
|
+
|
|
1124
|
+
// ... Reszta twojego komponentu
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
const App: FC = () => (
|
|
1128
|
+
<IntlayerProvider>
|
|
1129
|
+
<AppContent />
|
|
1130
|
+
</IntlayerProvider>
|
|
1131
|
+
);
|
|
1132
|
+
|
|
1133
|
+
export default App;
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
```jsx fileName="src/App.msx" codeFormat="esm"
|
|
1137
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
1138
|
+
import { useI18nHTMLAttributes } from "./hooks/useI18nHTMLAttributes";
|
|
1139
|
+
import "./App.css";
|
|
1140
|
+
|
|
1141
|
+
const AppContent = () => {
|
|
1142
|
+
// Zastosuj hook, aby zaktualizować atrybuty lang i dir tagu <html> na podstawie lokalizacji.
|
|
1143
|
+
useI18nHTMLAttributes();
|
|
1144
|
+
|
|
1145
|
+
// ... Reszta twojego komponentu
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
const App = () => (
|
|
1149
|
+
<IntlayerProvider>
|
|
1150
|
+
<AppContent />
|
|
1151
|
+
</IntlayerProvider>
|
|
1152
|
+
);
|
|
1153
|
+
|
|
1154
|
+
export default App;
|
|
1155
|
+
```
|
|
1156
|
+
|
|
1157
|
+
```jsx fileName="src/App.csx" codeFormat="commonjs"
|
|
1158
|
+
const { FC } = require("react");
|
|
1159
|
+
const { IntlayerProvider, useIntlayer } = require("react-intlayer");
|
|
1160
|
+
const { useI18nHTMLAttributes } = require("./hooks/useI18nHTMLAttributes");
|
|
1161
|
+
require("./App.css");
|
|
1162
|
+
|
|
1163
|
+
const AppContent = () => {
|
|
1164
|
+
// Zastosuj hook, aby zaktualizować atrybuty lang i dir tagu <html> na podstawie lokalizacji.
|
|
1165
|
+
useI18nHTMLAttributes();
|
|
1166
|
+
|
|
1167
|
+
// ... Reszta twojego komponentu
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
const App = () => (
|
|
1171
|
+
<IntlayerProvider>
|
|
1172
|
+
<AppContent />
|
|
1173
|
+
</IntlayerProvider>
|
|
1174
|
+
);
|
|
1175
|
+
|
|
1176
|
+
module.exports = App;
|
|
1177
|
+
|
|
1178
|
+
module.exports = App;
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1181
|
+
Wprowadzając te zmiany, Twoja aplikacja:
|
|
1182
|
+
|
|
1183
|
+
- Zapewni, że atrybut **language** (`lang`) poprawnie odzwierciedla bieżącą lokalizację, co jest ważne dla SEO i zachowania przeglądarki.
|
|
1184
|
+
- Dostosuje **kierunek tekstu** (`dir`) zgodnie z lokalizacją, poprawiając czytelność i użyteczność dla języków o różnych kierunkach czytania.
|
|
1185
|
+
- Zapewni bardziej **dostępne** doświadczenie, ponieważ technologie wspomagające polegają na tych atrybutach, aby działać optymalnie.
|
|
1186
|
+
|
|
1187
|
+
### Konfiguracja TypeScript
|
|
1188
|
+
|
|
1189
|
+
Intlayer używa rozszerzenia modułów (module augmentation), aby wykorzystać zalety TypeScript i wzmocnić Twoją bazę kodu.
|
|
1190
|
+
|
|
1191
|
+

|
|
1192
|
+
|
|
1193
|
+

|
|
1194
|
+
|
|
1195
|
+
Upewnij się, że Twoja konfiguracja TypeScript zawiera automatycznie generowane typy.
|
|
1196
|
+
|
|
1197
|
+
```json5 fileName="tsconfig.json"
|
|
1198
|
+
{
|
|
1199
|
+
// ... Twoje istniejące konfiguracje TypeScript
|
|
1200
|
+
"include": [
|
|
1201
|
+
// ... Twoje istniejące konfiguracje TypeScript
|
|
1202
|
+
".intlayer/**/*.ts", // Dołącz automatycznie generowane typy
|
|
1203
|
+
],
|
|
1204
|
+
}
|
|
1205
|
+
```
|
|
1206
|
+
|
|
1207
|
+
### Konfiguracja Git
|
|
1208
|
+
|
|
1209
|
+
Zaleca się ignorowanie plików generowanych przez Intlayer. Pozwala to uniknąć ich zatwierdzania do repozytorium Git.
|
|
1210
|
+
|
|
1211
|
+
Aby to zrobić, możesz dodać następujące instrukcje do pliku `.gitignore`:
|
|
1212
|
+
|
|
1213
|
+
```plaintext fileName=".gitignore"
|
|
1214
|
+
# Ignoruj pliki generowane przez Intlayer
|
|
1215
|
+
.intlayer
|
|
1216
|
+
```
|
|
1217
|
+
|
|
1218
|
+
### Rozszerzenie VS Code
|
|
1219
|
+
|
|
1220
|
+
Aby poprawić swoje doświadczenie deweloperskie z Intlayer, możesz zainstalować oficjalne **rozszerzenie Intlayer dla VS Code**.
|
|
1221
|
+
|
|
1222
|
+
[Zainstaluj z VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1223
|
+
|
|
1224
|
+
To rozszerzenie oferuje:
|
|
1225
|
+
|
|
1226
|
+
- **Autouzupełnianie** kluczy tłumaczeń.
|
|
1227
|
+
- **Wykrywanie błędów w czasie rzeczywistym** dla brakujących tłumaczeń.
|
|
1228
|
+
- **Podglądy w linii** przetłumaczonej zawartości.
|
|
1229
|
+
- **Szybkie akcje** umożliwiające łatwe tworzenie i aktualizowanie tłumaczeń.
|
|
1230
|
+
|
|
1231
|
+
Aby uzyskać więcej informacji na temat korzystania z rozszerzenia, zapoznaj się z [dokumentacją rozszerzenia Intlayer dla VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
1232
|
+
|
|
1233
|
+
### Idź dalej
|
|
1234
|
+
|
|
1235
|
+
Aby pójść dalej, możesz zaimplementować [edytor wizualny](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_visual_editor.md) lub wyeksportować swoją zawartość, korzystając z [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_CMS.md).
|