@intlayer/docs 7.0.6 → 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,1701 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2025-10-25
|
|
3
|
+
updatedAt: 2025-11-01
|
|
4
|
+
title: Jak przetłumaczyć swoją aplikację Next.js 15 – przewodnik i18n 2025
|
|
5
|
+
description: Dowiedz się, jak uczynić swoją stronę Next.js 15 wielojęzyczną. Postępuj zgodnie z dokumentacją, aby zinternacjonalizować (i18n) i przetłumaczyć ją.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internacjonalizacja
|
|
8
|
+
- Dokumentacja
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Next.js 15
|
|
11
|
+
- JavaScript
|
|
12
|
+
- React
|
|
13
|
+
slugs:
|
|
14
|
+
- doc
|
|
15
|
+
- environment
|
|
16
|
+
- nextjs
|
|
17
|
+
- 15
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-next-15-template
|
|
19
|
+
youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
|
|
20
|
+
history:
|
|
21
|
+
- version: 7.0.6
|
|
22
|
+
date: 2025-11-01
|
|
23
|
+
changes: Dodano wzmiankę o `x-default` w obiekcie `alternates`
|
|
24
|
+
- version: 7.0.0
|
|
25
|
+
date: 2025-10-25
|
|
26
|
+
changes: Dodano wzmiankę o funkcji `withIntlayerSync()`
|
|
27
|
+
- version: 6.2.0
|
|
28
|
+
date: 2025-10-09
|
|
29
|
+
changes: Dodano dokumentację dla hooka `useLocale` z opcją `onLocaleChange`
|
|
30
|
+
- version: 5.6.6
|
|
31
|
+
date: 2025-10-02
|
|
32
|
+
changes: Dodano dokumentację dla funkcji `getLocale` w akcjach serwerowych
|
|
33
|
+
- version: 5.6.2
|
|
34
|
+
date: 2025-09-23
|
|
35
|
+
changes: Dodano dokumentację dla obserwacji zmian słowników w Turbopack
|
|
36
|
+
- version: 5.6.2
|
|
37
|
+
date: 2025-09-22
|
|
38
|
+
changes: Dodano dokumentację dla helpera `multipleMiddlewares`
|
|
39
|
+
- version: 5.6.0
|
|
40
|
+
date: 2025-07-06
|
|
41
|
+
changes: Przekształcono funkcję `withIntlayer()` na funkcję opartą na promise
|
|
42
|
+
- version: 5.5.10
|
|
43
|
+
date: 2025-06-29
|
|
44
|
+
changes: Inicjalizacja historii
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
# Tłumaczenie Twojej strony Next.js 15 za pomocą Intlayer | Internacjonalizacja (i18n)
|
|
48
|
+
|
|
49
|
+
## Spis treści
|
|
50
|
+
|
|
51
|
+
<TOC/>
|
|
52
|
+
|
|
53
|
+
## Czym jest Intlayer?
|
|
54
|
+
|
|
55
|
+
**Intlayer** to innowacyjna, open-source'owa biblioteka do internacjonalizacji (i18n), zaprojektowana, aby uprościć wsparcie wielojęzyczne w nowoczesnych aplikacjach webowych. Intlayer bezproblemowo integruje się z najnowszym frameworkiem **Next.js 15**, w tym z jego potężnym **App Routerem**. Jest zoptymalizowany do pracy z **Server Components** dla efektywnego renderowania i jest w pełni kompatybilny z [**Turbopack**](https://nextjs.org/docs/architecture/turbopack).
|
|
56
|
+
|
|
57
|
+
Dzięki Intlayer możesz:
|
|
58
|
+
|
|
59
|
+
- **Łatwo zarządzać tłumaczeniami** za pomocą deklaratywnych słowników na poziomie komponentów.
|
|
60
|
+
- **Dynamicznie lokalizować metadane**, trasy i treści.
|
|
61
|
+
- **Uzyskać dostęp do tłumaczeń zarówno w komponentach po stronie klienta, jak i serwera**.
|
|
62
|
+
- **Zapewnić wsparcie TypeScript** dzięki automatycznie generowanym typom, co poprawia autouzupełnianie i wykrywanie błędów.
|
|
63
|
+
- **Korzystaj z zaawansowanych funkcji**, takich jak dynamiczne wykrywanie i przełączanie lokalizacji.
|
|
64
|
+
|
|
65
|
+
> Intlayer jest kompatybilny z Next.js 12, 13, 14 i 15. Jeśli używasz Next.js Page Router, możesz odnieść się do tego [przewodnika](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_nextjs_page_router.md). Dla Next.js 12, 13, 14 z App Routerem, odnieś się do tego [przewodnika](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_nextjs_14.md).
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Przewodnik krok po kroku, jak skonfigurować Intlayer w aplikacji Next.js
|
|
70
|
+
|
|
71
|
+
<Tab defaultTab="video">
|
|
72
|
+
<TabItem label="Wideo" value="video">
|
|
73
|
+
|
|
74
|
+
<iframe title="Najlepsze rozwiązanie i18n dla Next.js? Odkryj Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/e_PPG7PTqGU?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
75
|
+
|
|
76
|
+
</TabItem>
|
|
77
|
+
<TabItem label="Kod" value="code">
|
|
78
|
+
|
|
79
|
+
<iframe
|
|
80
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-next-15-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
81
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
82
|
+
title="Demo CodeSandbox - Jak internacjonalizować swoją aplikację za pomocą Intlayer"
|
|
83
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
84
|
+
loading="lazy"
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
</TabItem>
|
|
88
|
+
</Tab>
|
|
89
|
+
|
|
90
|
+
Zobacz [Application Template](https://github.com/aymericzip/intlayer-next-15-template) na GitHub.
|
|
91
|
+
|
|
92
|
+
### Krok 1: Instalacja zależności
|
|
93
|
+
|
|
94
|
+
Zainstaluj niezbędne pakiety za pomocą npm:
|
|
95
|
+
|
|
96
|
+
```bash packageManager="npm"
|
|
97
|
+
npm install intlayer next-intlayer
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```bash packageManager="pnpm"
|
|
101
|
+
pnpm add intlayer next-intlayer
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```bash packageManager="yarn"
|
|
105
|
+
yarn add intlayer next-intlayer
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
- **intlayer**
|
|
109
|
+
|
|
110
|
+
- **intlayer**
|
|
111
|
+
|
|
112
|
+
Podstawowy pakiet, który dostarcza narzędzia do internacjonalizacji dla 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).
|
|
113
|
+
|
|
114
|
+
- **next-intlayer**
|
|
115
|
+
|
|
116
|
+
Pakiet integrujący Intlayer z Next.js. Zapewnia dostawców kontekstu oraz hooki do internacjonalizacji w Next.js. Dodatkowo zawiera wtyczkę Next.js do integracji Intlayer z [Webpack](https://webpack.js.org/) lub [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack), a także middleware do wykrywania preferowanego języka użytkownika, zarządzania ciasteczkami oraz obsługi przekierowań URL.
|
|
117
|
+
|
|
118
|
+
### Krok 2: Skonfiguruj swój projekt
|
|
119
|
+
|
|
120
|
+
Utwórz plik konfiguracyjny, aby skonfigurować języki swojej aplikacji:
|
|
121
|
+
|
|
122
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
123
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
124
|
+
|
|
125
|
+
const config: IntlayerConfig = {
|
|
126
|
+
internationalization: {
|
|
127
|
+
locales: [
|
|
128
|
+
Locales.ENGLISH,
|
|
129
|
+
Locales.FRENCH,
|
|
130
|
+
Locales.SPANISH,
|
|
131
|
+
// Twoje pozostałe lokalizacje
|
|
132
|
+
],
|
|
133
|
+
defaultLocale: Locales.ENGLISH,
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export default config;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
141
|
+
import { Locales } from "intlayer";
|
|
142
|
+
|
|
143
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
144
|
+
const config = {
|
|
145
|
+
internationalization: {
|
|
146
|
+
locales: [
|
|
147
|
+
Locales.ENGLISH,
|
|
148
|
+
Locales.FRENCH,
|
|
149
|
+
Locales.SPANISH,
|
|
150
|
+
// Twoje pozostałe lokalizacje
|
|
151
|
+
],
|
|
152
|
+
defaultLocale: Locales.ENGLISH,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export default config;
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
160
|
+
const { Locales } = require("intlayer");
|
|
161
|
+
|
|
162
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
163
|
+
// Konfiguracja międzynarodowa
|
|
164
|
+
const config = {
|
|
165
|
+
internationalization: {
|
|
166
|
+
locales: [
|
|
167
|
+
Locales.ENGLISH,
|
|
168
|
+
Locales.FRENCH,
|
|
169
|
+
Locales.SPANISH,
|
|
170
|
+
// Twoje pozostałe lokalizacje
|
|
171
|
+
],
|
|
172
|
+
defaultLocale: Locales.ENGLISH,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
module.exports = config;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
> Poprzez ten plik konfiguracyjny możesz ustawić lokalizowane adresy URL, przekierowania w middleware, nazwy ciasteczek, lokalizację i rozszerzenie deklaracji treści, wyłączyć logi Intlayer w konsoli i wiele więcej. Pełną listę dostępnych parametrów znajdziesz w [dokumentacji konfiguracji](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/configuration.md).
|
|
180
|
+
|
|
181
|
+
### Krok 3: Zintegruj Intlayer w konfiguracji Next.js
|
|
182
|
+
|
|
183
|
+
Skonfiguruj swoje środowisko Next.js, aby korzystało z Intlayer:
|
|
184
|
+
|
|
185
|
+
```typescript fileName="next.config.ts" codeFormat="typescript"
|
|
186
|
+
import type { NextConfig } from "next";
|
|
187
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
188
|
+
|
|
189
|
+
const nextConfig: NextConfig = {
|
|
190
|
+
/* opcje konfiguracji tutaj */
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export default withIntlayer(nextConfig);
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
```typescript fileName="next.config.mjs" codeFormat="esm"
|
|
197
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
198
|
+
|
|
199
|
+
/** @type {import('next').NextConfig} */
|
|
200
|
+
// Konfiguracja Next.js
|
|
201
|
+
const nextConfig = {
|
|
202
|
+
/* opcje konfiguracji tutaj */
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default withIntlayer(nextConfig);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
```typescript fileName="next.config.cjs" codeFormat="commonjs"
|
|
209
|
+
const { withIntlayer } = require("next-intlayer/server");
|
|
210
|
+
|
|
211
|
+
/** @type {import('next').NextConfig} */
|
|
212
|
+
// Konfiguracja Next.js
|
|
213
|
+
const nextConfig = {
|
|
214
|
+
/* opcje konfiguracji tutaj */
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
module.exports = withIntlayer(nextConfig);
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
> Wtyczka Next.js `withIntlayer()` służy do integracji Intlayer z Next.js. Zapewnia budowanie plików deklaracji treści oraz monitoruje je w trybie deweloperskim. Definiuje zmienne środowiskowe Intlayer w środowiskach [Webpack](https://webpack.js.org/) lub [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack). Dodatkowo dostarcza aliasy optymalizujące wydajność oraz zapewnia kompatybilność z komponentami serwerowymi.
|
|
221
|
+
|
|
222
|
+
> Funkcja `withIntlayer()` jest funkcją zwracającą promise. Pozwala przygotować słowniki intlayer przed rozpoczęciem budowania. Jeśli chcesz użyć jej z innymi wtyczkami, możesz na nią poczekać (await). Przykład:
|
|
223
|
+
>
|
|
224
|
+
> ```tsx
|
|
225
|
+
> const nextConfig = await withIntlayer(nextConfig);
|
|
226
|
+
> const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
|
|
227
|
+
>
|
|
228
|
+
> export default nextConfigWithOtherPlugins;
|
|
229
|
+
> ```
|
|
230
|
+
>
|
|
231
|
+
> Jeśli chcesz używać tego synchronicznie, możesz użyć funkcji `withIntlayerSync()`. Przykład:
|
|
232
|
+
>
|
|
233
|
+
> ```tsx
|
|
234
|
+
> const nextConfig = withIntlayerSync(nextConfig);
|
|
235
|
+
> const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
|
|
236
|
+
>
|
|
237
|
+
> export default nextConfigWithOtherPlugins;
|
|
238
|
+
> ```
|
|
239
|
+
|
|
240
|
+
### Krok 4: Zdefiniuj dynamiczne trasy lokalizacji
|
|
241
|
+
|
|
242
|
+
Usuń wszystko z `RootLayout` i zastąp to następującym kodem:
|
|
243
|
+
|
|
244
|
+
```tsx {3} fileName="src/app/layout.tsx" codeFormat="typescript"
|
|
245
|
+
import type { PropsWithChildren, FC } from "react";
|
|
246
|
+
import "./globals.css";
|
|
247
|
+
|
|
248
|
+
const RootLayout: FC<PropsWithChildren> = ({ children }) => (
|
|
249
|
+
// Nadal możesz opakować children innymi providerami, takimi jak `next-themes`, `react-query`, `framer-motion` itd.
|
|
250
|
+
<>{children}</>
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
export default RootLayout;
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
```jsx {3} fileName="src/app/layout.mjx" codeFormat="esm"
|
|
257
|
+
import "./globals.css";
|
|
258
|
+
|
|
259
|
+
const RootLayout = ({ children }) => (
|
|
260
|
+
// Nadal możesz opakować children innymi providerami, takimi jak `next-themes`, `react-query`, `framer-motion` itd.
|
|
261
|
+
<>{children}</>
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
export default RootLayout;
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```jsx {1,8} fileName="src/app/layout.csx" codeFormat="commonjs"
|
|
268
|
+
require("./globals.css");
|
|
269
|
+
|
|
270
|
+
const RootLayout = ({ children }) => (
|
|
271
|
+
// Nadal możesz opakować children innymi providerami, takimi jak `next-themes`, `react-query`, `framer-motion` itd.
|
|
272
|
+
<>{children}</>
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
module.exports = {
|
|
276
|
+
default: RootLayout,
|
|
277
|
+
generateStaticParams,
|
|
278
|
+
};
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
> Pozostawienie komponentu `RootLayout` pustym pozwala na ustawienie atrybutów [`lang`](https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/lang) oraz [`dir`](https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/dir) w tagu `<html>`.
|
|
282
|
+
|
|
283
|
+
Aby zaimplementować dynamiczne routowanie, podaj ścieżkę dla lokalizacji, dodając nowy layout w katalogu `[locale]`:
|
|
284
|
+
|
|
285
|
+
```tsx fileName="src/app/[locale]/layout.tsx" codeFormat="typescript"
|
|
286
|
+
import type { NextLayoutIntlayer } from "next-intlayer";
|
|
287
|
+
import { Inter } from "next/font/google";
|
|
288
|
+
import { getHTMLTextDir } from "intlayer";
|
|
289
|
+
|
|
290
|
+
const inter = Inter({ subsets: ["latin"] });
|
|
291
|
+
|
|
292
|
+
const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
|
|
293
|
+
const { locale } = await params;
|
|
294
|
+
return (
|
|
295
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
296
|
+
<body className={inter.className}>{children}</body>
|
|
297
|
+
</html>
|
|
298
|
+
);
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export default LocaleLayout;
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
```jsx fileName="src/app/[locale]/layout.mjx" codeFormat="esm"
|
|
305
|
+
import { getHTMLTextDir } from "intlayer";
|
|
306
|
+
|
|
307
|
+
const inter = Inter({ subsets: ["latin"] });
|
|
308
|
+
|
|
309
|
+
const LocaleLayout = async ({ children, params: { locale } }) => {
|
|
310
|
+
const { locale } = await params;
|
|
311
|
+
return (
|
|
312
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
313
|
+
<body className={inter.className}>{children}</body>
|
|
314
|
+
</html>
|
|
315
|
+
);
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export default LocaleLayout;
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
```jsx fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
|
|
322
|
+
const { Inter } = require("next/font/google");
|
|
323
|
+
const { getHTMLTextDir } = require("intlayer");
|
|
324
|
+
|
|
325
|
+
const inter = Inter({ subsets: ["latin"] });
|
|
326
|
+
|
|
327
|
+
const LocaleLayout = async ({ children, params: { locale } }) => {
|
|
328
|
+
const { locale } = await params;
|
|
329
|
+
return (
|
|
330
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
331
|
+
<body className={inter.className}>{children}</body>
|
|
332
|
+
</html>
|
|
333
|
+
);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
module.exports = LocaleLayout;
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
> Segment ścieżki `[locale]` służy do określenia lokalizacji. Przykład: `/en-US/about` odnosi się do `en-US`, a `/fr/about` do `fr`.
|
|
340
|
+
|
|
341
|
+
> Na tym etapie napotkasz błąd: `Error: Missing <html> and <body> tags in the root layout.`. Jest to oczekiwane, ponieważ plik `/app/page.tsx` nie jest już używany i można go usunąć. Zamiast tego segment ścieżki `[locale]` aktywuje stronę `/app/[locale]/page.tsx`. W konsekwencji strony będą dostępne pod ścieżkami takimi jak `/en`, `/fr`, `/es` w Twojej przeglądarce. Aby ustawić domyślny język jako stronę główną, odnieś się do konfiguracji `middleware` w kroku 7.
|
|
342
|
+
|
|
343
|
+
Następnie zaimplementuj funkcję `generateStaticParams` w układzie aplikacji.
|
|
344
|
+
|
|
345
|
+
```tsx {1} fileName="src/app/[locale]/layout.tsx" codeFormat="typescript"
|
|
346
|
+
export { generateStaticParams } from "next-intlayer"; // Linia do wstawienia
|
|
347
|
+
|
|
348
|
+
const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
|
|
349
|
+
/*... Reszta kodu*/
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export default LocaleLayout;
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
```jsx {1} fileName="src/app/[locale]/layout.mjx" codeFormat="esm"
|
|
356
|
+
export { generateStaticParams } from "next-intlayer"; // Linia do wstawienia
|
|
357
|
+
|
|
358
|
+
const LocaleLayout = async ({ children, params: { locale } }) => {
|
|
359
|
+
/*... Reszta kodu */
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// ... Reszta kodu
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
```jsx {1,7} fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
|
|
366
|
+
const { generateStaticParams } = require("next-intlayer"); // Linia do wstawienia
|
|
367
|
+
|
|
368
|
+
const LocaleLayout = async ({ children, params: { locale } }) => {
|
|
369
|
+
/*... Reszta kodu */
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
module.exports = { default: LocaleLayout, generateStaticParams };
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
> `generateStaticParams` zapewnia, że Twoja aplikacja wstępnie buduje niezbędne strony dla wszystkich lokalizacji, zmniejszając obciążenie podczas działania i poprawiając doświadczenie użytkownika. Aby uzyskać więcej informacji, zapoznaj się z [dokumentacją Next.js dotyczącą generateStaticParams](https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic-rendering#generate-static-params).
|
|
376
|
+
|
|
377
|
+
> Intlayer działa z `export const dynamic = 'force-static';`, aby zapewnić, że strony są wstępnie zbudowane dla wszystkich lokalizacji.
|
|
378
|
+
|
|
379
|
+
### Krok 5: Zadeklaruj swoją zawartość
|
|
380
|
+
|
|
381
|
+
Twórz i zarządzaj deklaracjami zawartości, aby przechowywać tłumaczenia:
|
|
382
|
+
|
|
383
|
+
```tsx fileName="src/app/[locale]/page.content.ts" contentDeclarationFormat="typescript"
|
|
384
|
+
import { t, type Dictionary } from "intlayer";
|
|
385
|
+
|
|
386
|
+
const pageContent = {
|
|
387
|
+
key: "page",
|
|
388
|
+
content: {
|
|
389
|
+
getStarted: {
|
|
390
|
+
main: t({
|
|
391
|
+
en: "Get started by editing",
|
|
392
|
+
fr: "Commencez par éditer",
|
|
393
|
+
es: "Comience por editar",
|
|
394
|
+
}),
|
|
395
|
+
pageLink: "src/app/page.tsx",
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
} satisfies Dictionary;
|
|
399
|
+
|
|
400
|
+
export default pageContent;
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
```javascript fileName="src/app/[locale]/page.content.mjs" contentDeclarationFormat="esm"
|
|
404
|
+
import { t } from "intlayer";
|
|
405
|
+
|
|
406
|
+
/** @type {import('intlayer').Dictionary} */
|
|
407
|
+
// Zawartość strony z tłumaczeniami
|
|
408
|
+
const pageContent = {
|
|
409
|
+
key: "page",
|
|
410
|
+
content: {
|
|
411
|
+
getStarted: {
|
|
412
|
+
main: t({
|
|
413
|
+
en: "Get started by editing",
|
|
414
|
+
fr: "Commencez par éditer",
|
|
415
|
+
es: "Comience por editar",
|
|
416
|
+
}),
|
|
417
|
+
pageLink: "src/app/page.tsx",
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
export default pageContent;
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
```javascript fileName="src/app/[locale]/page.content.cjs" contentDeclarationFormat="commonjs"
|
|
426
|
+
const { t } = require("intlayer");
|
|
427
|
+
|
|
428
|
+
/** @type {import('intlayer').Dictionary} */
|
|
429
|
+
const pageContent = {
|
|
430
|
+
key: "page",
|
|
431
|
+
content: {
|
|
432
|
+
getStarted: {
|
|
433
|
+
main: t({
|
|
434
|
+
en: "Get started by editing",
|
|
435
|
+
fr: "Commencez par éditer",
|
|
436
|
+
es: "Comience por editar",
|
|
437
|
+
pl: "Zacznij od edycji",
|
|
438
|
+
}),
|
|
439
|
+
pageLink: "src/app/page.tsx",
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
module.exports = pageContent;
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
```json fileName="src/app/[locale]/page.content.json" contentDeclarationFormat="json"
|
|
448
|
+
{
|
|
449
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
450
|
+
"key": "page",
|
|
451
|
+
"content": {
|
|
452
|
+
"getStarted": {
|
|
453
|
+
"nodeType": "translation",
|
|
454
|
+
"translation": {
|
|
455
|
+
"en": "Get started by editing",
|
|
456
|
+
"fr": "Commencez par éditer",
|
|
457
|
+
"es": "Comience por editar",
|
|
458
|
+
"pl": "Zacznij od edycji"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
"pageLink": "src/app/page.tsx"
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
> Twoje deklaracje zawartości mogą być zdefiniowane 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}`).
|
|
467
|
+
|
|
468
|
+
> Po więcej szczegółów odsyłamy do [dokumentacji deklaracji zawartości](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/dictionary/content_file.md).
|
|
469
|
+
|
|
470
|
+
### Krok 6: Wykorzystaj zawartość w swoim kodzie
|
|
471
|
+
|
|
472
|
+
Uzyskaj dostęp do swoich słowników zawartości w całej aplikacji:
|
|
473
|
+
|
|
474
|
+
```tsx fileName="src/app/[locale]/page.tsx" codeFormat="typescript"
|
|
475
|
+
import type { FC } from "react";
|
|
476
|
+
import { ClientComponentExample } from "@components/ClientComponentExample";
|
|
477
|
+
import { ServerComponentExample } from "@components/ServerComponentExample";
|
|
478
|
+
import { type NextPageIntlayer, IntlayerClientProvider } from "next-intlayer";
|
|
479
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
480
|
+
|
|
481
|
+
const PageContent: FC = () => {
|
|
482
|
+
const content = useIntlayer("page");
|
|
483
|
+
|
|
484
|
+
return (
|
|
485
|
+
<>
|
|
486
|
+
<p>{content.getStarted.main}</p>
|
|
487
|
+
<code>{content.getStarted.pageLink}</code>
|
|
488
|
+
</>
|
|
489
|
+
);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const Page: NextPageIntlayer = async ({ params }) => {
|
|
493
|
+
const { locale } = await params;
|
|
494
|
+
|
|
495
|
+
return (
|
|
496
|
+
<IntlayerServerProvider locale={locale}>
|
|
497
|
+
<PageContent />
|
|
498
|
+
<ServerComponentExample />
|
|
499
|
+
|
|
500
|
+
<IntlayerClientProvider locale={locale}>
|
|
501
|
+
<ClientComponentExample />
|
|
502
|
+
</IntlayerClientProvider>
|
|
503
|
+
</IntlayerServerProvider>
|
|
504
|
+
);
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
export default Page;
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
```jsx fileName="src/app/[locale]/page.mjx" codeFormat="esm"
|
|
511
|
+
import { ClientComponentExample } from "@components/ClientComponentExample";
|
|
512
|
+
import { ServerComponentExample } from "@components/ServerComponentExample";
|
|
513
|
+
import { IntlayerClientProvider } from "next-intlayer";
|
|
514
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
515
|
+
|
|
516
|
+
const PageContent = () => {
|
|
517
|
+
const content = useIntlayer("page");
|
|
518
|
+
|
|
519
|
+
return (
|
|
520
|
+
<>
|
|
521
|
+
<p>{content.getStarted.main}</p>
|
|
522
|
+
<code>{content.getStarted.pageLink}</code>
|
|
523
|
+
</>
|
|
524
|
+
);
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const Page = async ({ params }) => {
|
|
528
|
+
const { locale } = await params;
|
|
529
|
+
|
|
530
|
+
return (
|
|
531
|
+
<IntlayerServerProvider locale={locale}>
|
|
532
|
+
<PageContent />
|
|
533
|
+
<ServerComponentExample />
|
|
534
|
+
|
|
535
|
+
<IntlayerClientProvider locale={locale}>
|
|
536
|
+
<ClientComponentExample />
|
|
537
|
+
</IntlayerClientProvider>
|
|
538
|
+
</IntlayerServerProvider>
|
|
539
|
+
);
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
export default Page;
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
```jsx fileName="src/app/[locale]/page.csx" codeFormat="commonjs"
|
|
546
|
+
import { ClientComponentExample } from "@components/ClientComponentExample";
|
|
547
|
+
import { ServerComponentExample } from "@components/ServerComponentExample";
|
|
548
|
+
import { IntlayerClientProvider } from "next-intlayer";
|
|
549
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
550
|
+
|
|
551
|
+
const PageContent = () => {
|
|
552
|
+
const content = useIntlayer("page");
|
|
553
|
+
|
|
554
|
+
return (
|
|
555
|
+
<>
|
|
556
|
+
<p>{content.getStarted.main}</p>
|
|
557
|
+
<code>{content.getStarted.pageLink}</code>
|
|
558
|
+
</>
|
|
559
|
+
);
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
const Page = async ({ params }) => {
|
|
563
|
+
const { locale } = await params;
|
|
564
|
+
|
|
565
|
+
return (
|
|
566
|
+
<IntlayerServerProvider locale={locale}>
|
|
567
|
+
<PageContent />
|
|
568
|
+
<ServerComponentExample />
|
|
569
|
+
|
|
570
|
+
<IntlayerClientProvider locale={locale}>
|
|
571
|
+
<ClientComponentExample />
|
|
572
|
+
</IntlayerClientProvider>
|
|
573
|
+
</IntlayerServerProvider>
|
|
574
|
+
);
|
|
575
|
+
};
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
- **`IntlayerClientProvider`** służy do dostarczania lokalizacji komponentom po stronie klienta. Może być umieszczony w dowolnym komponencie nadrzędnym, w tym w layoucie. Jednak zaleca się umieszczenie go w layoucie, ponieważ Next.js współdzieli kod layoutu pomiędzy stronami, co jest bardziej efektywne. Używając `IntlayerClientProvider` w layoucie, unikasz ponownej inicjalizacji dla każdej strony, poprawiając wydajność i utrzymując spójny kontekst lokalizacji w całej aplikacji.
|
|
579
|
+
- **`IntlayerServerProvider`** służy do dostarczania lokalizacji komponentom po stronie serwera. Nie można go ustawić w layoucie.
|
|
580
|
+
|
|
581
|
+
> Layout i strona nie mogą współdzielić wspólnego kontekstu serwera, ponieważ system kontekstu serwera opiera się na magazynie danych na żądanie (za pomocą mechanizmu [React's cache](https://react.dev/reference/react/cache)), co powoduje, że każdy "kontekst" jest tworzony na nowo dla różnych segmentów aplikacji. Umieszczenie providera w wspólnym layoucie złamałoby tę izolację, uniemożliwiając prawidłowe propagowanie wartości kontekstu serwera do komponentów serwerowych.
|
|
582
|
+
|
|
583
|
+
> Layout i strona nie mogą współdzielić wspólnego kontekstu serwera, ponieważ system kontekstu serwera opiera się na magazynie danych na żądanie (za pomocą mechanizmu [React's cache](https://react.dev/reference/react/cache)), co powoduje, że każdy "kontekst" jest tworzony na nowo dla różnych segmentów aplikacji. Umieszczenie providera w współdzielonym layoucie złamałoby tę izolację, uniemożliwiając prawidłowe propagowanie wartości kontekstu serwera do komponentów serwerowych.
|
|
584
|
+
|
|
585
|
+
```tsx {4,7} fileName="src/components/ClientComponentExample.tsx" codeFormat="typescript"
|
|
586
|
+
"use client";
|
|
587
|
+
|
|
588
|
+
import type { FC } from "react";
|
|
589
|
+
import { useIntlayer } from "next-intlayer";
|
|
590
|
+
|
|
591
|
+
export const ClientComponentExample: FC = () => {
|
|
592
|
+
const content = useIntlayer("client-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
593
|
+
|
|
594
|
+
return (
|
|
595
|
+
<div>
|
|
596
|
+
<h2>{content.title}</h2>
|
|
597
|
+
<p>{content.content}</p>
|
|
598
|
+
</div>
|
|
599
|
+
);
|
|
600
|
+
};
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
```jsx {3,6} fileName="src/components/ClientComponentExample.mjx" codeFormat="esm"
|
|
604
|
+
"use client";
|
|
605
|
+
|
|
606
|
+
import { useIntlayer } from "next-intlayer";
|
|
607
|
+
|
|
608
|
+
const ClientComponentExample = () => {
|
|
609
|
+
const content = useIntlayer("client-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
610
|
+
|
|
611
|
+
return (
|
|
612
|
+
<div>
|
|
613
|
+
<h2>{content.title}</h2>
|
|
614
|
+
<p>{content.content}</p>
|
|
615
|
+
</div>
|
|
616
|
+
);
|
|
617
|
+
};
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
```jsx {3,6} fileName="src/components/ClientComponentExample.csx" codeFormat="commonjs"
|
|
621
|
+
"use client";
|
|
622
|
+
|
|
623
|
+
const { useIntlayer } = require("next-intlayer");
|
|
624
|
+
|
|
625
|
+
const ClientComponentExample = () => {
|
|
626
|
+
const content = useIntlayer("client-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
627
|
+
|
|
628
|
+
return (
|
|
629
|
+
<div>
|
|
630
|
+
<h2>{content.title}</h2>
|
|
631
|
+
<p>{content.content}</p>
|
|
632
|
+
</div>
|
|
633
|
+
);
|
|
634
|
+
};
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
```tsx {2} fileName="src/components/ServerComponentExample.tsx" codeFormat="typescript"
|
|
638
|
+
import type { FC } from "react";
|
|
639
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
640
|
+
|
|
641
|
+
export const ServerComponentExample: FC = () => {
|
|
642
|
+
const content = useIntlayer("server-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
643
|
+
|
|
644
|
+
return (
|
|
645
|
+
<div>
|
|
646
|
+
<h2>{content.title}</h2>
|
|
647
|
+
<p>{content.content}</p>
|
|
648
|
+
</div>
|
|
649
|
+
);
|
|
650
|
+
};
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
```jsx {1} fileName="src/components/ServerComponentExample.mjx" codeFormat="esm"
|
|
654
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
655
|
+
|
|
656
|
+
const ServerComponentExample = () => {
|
|
657
|
+
const content = useIntlayer("server-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
658
|
+
|
|
659
|
+
return (
|
|
660
|
+
<div>
|
|
661
|
+
<h2>{content.title}</h2>
|
|
662
|
+
<p>{content.content}</p>
|
|
663
|
+
</div>
|
|
664
|
+
);
|
|
665
|
+
};
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
```jsx {1} fileName="src/components/ServerComponentExample.csx" codeFormat="commonjs"
|
|
669
|
+
const { useIntlayer } = require("next-intlayer/server");
|
|
670
|
+
|
|
671
|
+
const ServerComponentExample = () => {
|
|
672
|
+
const content = useIntlayer("server-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
673
|
+
|
|
674
|
+
return (
|
|
675
|
+
<div>
|
|
676
|
+
<h2>{content.title}</h2>
|
|
677
|
+
<p>{content.content}</p>
|
|
678
|
+
</div>
|
|
679
|
+
);
|
|
680
|
+
};
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
> 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:
|
|
684
|
+
|
|
685
|
+
> ```jsx
|
|
686
|
+
> <img src={content.image.src.value} alt={content.image.value} />
|
|
687
|
+
> ```
|
|
688
|
+
|
|
689
|
+
> Aby dowiedzieć się więcej o hooku `useIntlayer`, zapoznaj się z [dokumentacją](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/next-intlayer/useIntlayer.md).
|
|
690
|
+
|
|
691
|
+
### (Opcjonalny) Krok 7: Konfiguracja Middleware do wykrywania lokalizacji
|
|
692
|
+
|
|
693
|
+
Skonfiguruj middleware do wykrywania preferowanej lokalizacji użytkownika:
|
|
694
|
+
|
|
695
|
+
```typescript fileName="src/middleware.ts" codeFormat="typescript"
|
|
696
|
+
export { intlayerMiddleware as middleware } from "next-intlayer/middleware";
|
|
697
|
+
|
|
698
|
+
export const config = {
|
|
699
|
+
matcher:
|
|
700
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
701
|
+
};
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
```javascript fileName="src/middleware.mjs" codeFormat="esm"
|
|
705
|
+
export { intlayerMiddleware as middleware } from "next-intlayer/middleware";
|
|
706
|
+
|
|
707
|
+
export const config = {
|
|
708
|
+
matcher:
|
|
709
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
710
|
+
};
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
```javascript fileName="src/middleware.cjs" codeFormat="commonjs"
|
|
714
|
+
const { intlayerMiddleware } = require("next-intlayer/middleware");
|
|
715
|
+
|
|
716
|
+
const config = {
|
|
717
|
+
matcher:
|
|
718
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
module.exports = { middleware: intlayerMiddleware, config };
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
> `intlayerMiddleware` służy do wykrywania preferowanego języka użytkownika i przekierowywania go na odpowiedni adres URL, zgodnie z [konfiguracją](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/configuration.md). Dodatkowo umożliwia zapisanie preferowanego języka użytkownika w ciasteczku.
|
|
725
|
+
|
|
726
|
+
> Jeśli potrzebujesz połączyć kilka middleware'ów razem (na przykład `intlayerMiddleware` z uwierzytelnianiem lub niestandardowymi middleware'ami), Intlayer udostępnia teraz pomocnika o nazwie `multipleMiddlewares`.
|
|
727
|
+
|
|
728
|
+
```ts
|
|
729
|
+
import {
|
|
730
|
+
multipleMiddlewares,
|
|
731
|
+
intlayerMiddleware,
|
|
732
|
+
} from "next-intlayer/middleware";
|
|
733
|
+
import { customMiddleware } from "@utils/customMiddleware";
|
|
734
|
+
|
|
735
|
+
export const middleware = multipleMiddlewares([
|
|
736
|
+
intlayerMiddleware,
|
|
737
|
+
customMiddleware,
|
|
738
|
+
]);
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
### (Opcjonalny) Krok 8: Internacjonalizacja twoich metadanych
|
|
742
|
+
|
|
743
|
+
W przypadku, gdy chcesz internacjonalizować swoje metadane, takie jak tytuł strony, możesz użyć funkcji `generateMetadata` dostarczonej przez Next.js. W jej wnętrzu możesz pobrać zawartość z funkcji `getIntlayer`, aby przetłumaczyć swoje metadane.
|
|
744
|
+
|
|
745
|
+
```typescript fileName="src/app/[locale]/metadata.content.ts" contentDeclarationFormat="typescript"
|
|
746
|
+
import { type Dictionary, t } from "intlayer";
|
|
747
|
+
import { Metadata } from "next";
|
|
748
|
+
|
|
749
|
+
const metadataContent = {
|
|
750
|
+
key: "page-metadata",
|
|
751
|
+
content: {
|
|
752
|
+
title: t({
|
|
753
|
+
pl: "Utwórz aplikację Next",
|
|
754
|
+
en: "Create Next App",
|
|
755
|
+
fr: "Créer une application Next.js",
|
|
756
|
+
es: "Crear una aplicación Next.js",
|
|
757
|
+
}),
|
|
758
|
+
description: t({
|
|
759
|
+
pl: "Wygenerowano za pomocą create next app",
|
|
760
|
+
en: "Generated by create next app",
|
|
761
|
+
fr: "Généré par create next app",
|
|
762
|
+
es: "Generado por create next app",
|
|
763
|
+
}),
|
|
764
|
+
},
|
|
765
|
+
} satisfies Dictionary<Metadata>;
|
|
766
|
+
|
|
767
|
+
export default metadataContent;
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
```javascript fileName="src/app/[locale]/metadata.content.mjs" contentDeclarationFormat="esm"
|
|
771
|
+
import { t } from "intlayer";
|
|
772
|
+
|
|
773
|
+
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
774
|
+
const metadataContent = {
|
|
775
|
+
key: "page-metadata",
|
|
776
|
+
content: {
|
|
777
|
+
title: t({
|
|
778
|
+
en: "Create Next App",
|
|
779
|
+
fr: "Créer une application Next.js",
|
|
780
|
+
es: "Crear una aplicación Next.js",
|
|
781
|
+
pl: "Utwórz aplikację Next",
|
|
782
|
+
}),
|
|
783
|
+
description: t({
|
|
784
|
+
en: "Generated by create next app",
|
|
785
|
+
fr: "Généré par create next app",
|
|
786
|
+
es: "Generado por create next app",
|
|
787
|
+
pl: "Wygenerowano przez create next app",
|
|
788
|
+
}),
|
|
789
|
+
},
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
export default metadataContent;
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
```javascript fileName="src/app/[locale]/metadata.content.cjs" contentDeclarationFormat="commonjs"
|
|
796
|
+
const { t } = require("intlayer");
|
|
797
|
+
|
|
798
|
+
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
799
|
+
const metadataContent = {
|
|
800
|
+
key: "page-metadata",
|
|
801
|
+
content: {
|
|
802
|
+
title: t({
|
|
803
|
+
en: "Create Next App",
|
|
804
|
+
fr: "Créer une application Next.js",
|
|
805
|
+
es: "Crear una aplicación Next.js",
|
|
806
|
+
pl: "Utwórz aplikację Next",
|
|
807
|
+
}),
|
|
808
|
+
description: t({
|
|
809
|
+
en: "Generated by create next app",
|
|
810
|
+
fr: "Généré par create next app",
|
|
811
|
+
es: "Generado por create next app",
|
|
812
|
+
pl: "Wygenerowano przez create next app",
|
|
813
|
+
}),
|
|
814
|
+
},
|
|
815
|
+
};
|
|
816
|
+
|
|
817
|
+
module.exports = metadataContent;
|
|
818
|
+
fr: "Créer une application Next.js",
|
|
819
|
+
es: "Crear una aplicación Next.js",
|
|
820
|
+
}),
|
|
821
|
+
description: t({
|
|
822
|
+
en: "Generated by create next app",
|
|
823
|
+
fr: "Généré par create next app",
|
|
824
|
+
es: "Generado por create next app",
|
|
825
|
+
}),
|
|
826
|
+
},
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
module.exports = metadataContent;
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
```json fileName="src/app/[locale]/metadata.content.json" contentDeclarationFormat="json"
|
|
833
|
+
{
|
|
834
|
+
"key": "page-metadata",
|
|
835
|
+
"content": {
|
|
836
|
+
"title": {
|
|
837
|
+
"nodeType": "translation",
|
|
838
|
+
"translation": {
|
|
839
|
+
"en": "Preact logo",
|
|
840
|
+
"fr": "Logo Preact",
|
|
841
|
+
"es": "Logo Preact",
|
|
842
|
+
"pl": "Logo Preact"
|
|
843
|
+
},
|
|
844
|
+
},
|
|
845
|
+
"description": {
|
|
846
|
+
"nodeType": "translation",
|
|
847
|
+
"translation": {
|
|
848
|
+
"en": "Generated by create next app",
|
|
849
|
+
"fr": "Généré par create next app",
|
|
850
|
+
"es": "Generado por create next app",
|
|
851
|
+
"pl": "Wygenerowano przez create next app"
|
|
852
|
+
},
|
|
853
|
+
},
|
|
854
|
+
},
|
|
855
|
+
};
|
|
856
|
+
"es": "Generado por create next app",
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
};
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
````typescript fileName="src/app/[locale]/layout.tsx or src/app/[locale]/page.tsx" codeFormat="typescript"
|
|
864
|
+
import { getIntlayer, getMultilingualUrls } from "intlayer";
|
|
865
|
+
import type { Metadata } from "next";
|
|
866
|
+
import type { LocalPromiseParams } from "next-intlayer";
|
|
867
|
+
|
|
868
|
+
export const generateMetadata = async ({
|
|
869
|
+
params,
|
|
870
|
+
}: LocalPromiseParams): Promise<Metadata> => {
|
|
871
|
+
const { locale } = await params;
|
|
872
|
+
|
|
873
|
+
const metadata = getIntlayer("page-metadata", locale);
|
|
874
|
+
|
|
875
|
+
/**
|
|
876
|
+
* Generuje obiekt zawierający wszystkie adresy URL dla każdego języka.
|
|
877
|
+
*
|
|
878
|
+
* Przykład:
|
|
879
|
+
* ```ts
|
|
880
|
+
* getMultilingualUrls('/about');
|
|
881
|
+
*
|
|
882
|
+
* // Zwraca
|
|
883
|
+
* // {
|
|
884
|
+
* // en: '/about',
|
|
885
|
+
* // fr: '/fr/about',
|
|
886
|
+
* // es: '/es/about',
|
|
887
|
+
* // }
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
const multilingualUrls = getMultilingualUrls("/");
|
|
891
|
+
const localizedUrl =
|
|
892
|
+
multilingualUrls[locale as keyof typeof multilingualUrls];
|
|
893
|
+
|
|
894
|
+
return {
|
|
895
|
+
...metadata,
|
|
896
|
+
alternates: {
|
|
897
|
+
canonical: localizedUrl,
|
|
898
|
+
languages: { ...multilingualUrls, "x-default": "/" },
|
|
899
|
+
},
|
|
900
|
+
openGraph: {
|
|
901
|
+
url: localizedUrl,
|
|
902
|
+
},
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
// ... Reszta kodu
|
|
907
|
+
````
|
|
908
|
+
|
|
909
|
+
````javascript fileName="src/app/[locale]/layout.mjs or src/app/[locale]/page.mjs" codeFormat="esm"
|
|
910
|
+
import { getIntlayer, getMultilingualUrls } from "intlayer";
|
|
911
|
+
|
|
912
|
+
export const generateMetadata = async ({ params }) => {
|
|
913
|
+
const { locale } = await params;
|
|
914
|
+
|
|
915
|
+
const metadata = getIntlayer("page-metadata", locale);
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Generuje obiekt zawierający wszystkie adresy URL dla każdej lokalizacji.
|
|
919
|
+
*
|
|
920
|
+
* Przykład:
|
|
921
|
+
* ```ts
|
|
922
|
+
* getMultilingualUrls('/about');
|
|
923
|
+
*
|
|
924
|
+
* // Zwraca
|
|
925
|
+
* // {
|
|
926
|
+
* // en: '/about',
|
|
927
|
+
* // fr: '/fr/about',
|
|
928
|
+
* * es: '/es/about'
|
|
929
|
+
* // }
|
|
930
|
+
* ```
|
|
931
|
+
*/
|
|
932
|
+
const multilingualUrls = getMultilingualUrls("/");
|
|
933
|
+
const localizedUrl = multilingualUrls[locale];
|
|
934
|
+
|
|
935
|
+
return {
|
|
936
|
+
...metadata,
|
|
937
|
+
alternates: {
|
|
938
|
+
canonical: localizedUrl,
|
|
939
|
+
languages: { ...multilingualUrls, "x-default": "/" },
|
|
940
|
+
},
|
|
941
|
+
openGraph: {
|
|
942
|
+
url: localizedUrl,
|
|
943
|
+
},
|
|
944
|
+
};
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
// ... Reszta kodu
|
|
948
|
+
````
|
|
949
|
+
|
|
950
|
+
````javascript fileName="src/app/[locale]/layout.cjs or src/app/[locale]/page.cjs" codeFormat="commonjs"
|
|
951
|
+
const { getIntlayer, getMultilingualUrls } = require("intlayer");
|
|
952
|
+
|
|
953
|
+
const generateMetadata = async ({ params }) => {
|
|
954
|
+
const { locale } = await params;
|
|
955
|
+
|
|
956
|
+
const metadata = getIntlayer("page-metadata", locale);
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Generuje obiekt zawierający wszystkie adresy URL dla każdej lokalizacji.
|
|
960
|
+
*
|
|
961
|
+
* Przykład:
|
|
962
|
+
* ```ts
|
|
963
|
+
* getMultilingualUrls('/about');
|
|
964
|
+
*
|
|
965
|
+
* // Zwraca
|
|
966
|
+
* // {
|
|
967
|
+
* // en: '/about',
|
|
968
|
+
* // fr: '/fr/about',
|
|
969
|
+
* // es: '/es/about'
|
|
970
|
+
* // }
|
|
971
|
+
* ```
|
|
972
|
+
*/
|
|
973
|
+
const multilingualUrls = getMultilingualUrls("/");
|
|
974
|
+
const localizedUrl = multilingualUrls[locale];
|
|
975
|
+
|
|
976
|
+
return {
|
|
977
|
+
...metadata,
|
|
978
|
+
alternates: {
|
|
979
|
+
canonical: localizedUrl,
|
|
980
|
+
languages: { ...multilingualUrls, "x-default": "/" },
|
|
981
|
+
},
|
|
982
|
+
openGraph: {
|
|
983
|
+
url: localizedUrl,
|
|
984
|
+
},
|
|
985
|
+
};
|
|
986
|
+
};
|
|
987
|
+
|
|
988
|
+
module.exports = { generateMetadata };
|
|
989
|
+
|
|
990
|
+
// ... Reszta kodu```
|
|
991
|
+
|
|
992
|
+
> Zauważ, że funkcja `getIntlayer` importowana z `next-intlayer` zwraca Twoją zawartość opakowaną w `IntlayerNode`, co umożliwia integrację z edytorem wizualnym. Natomiast funkcja `getIntlayer` importowana z `intlayer` zwraca Twoją zawartość bezpośrednio, bez dodatkowych właściwości.
|
|
993
|
+
|
|
994
|
+
Alternatywnie możesz użyć funkcji `getTranslation` do deklarowania swoich metadanych. Jednak zaleca się używanie plików deklaracji zawartości, aby zautomatyzować tłumaczenie metadanych i w pewnym momencie wyodrębnić zawartość.
|
|
995
|
+
|
|
996
|
+
```typescript fileName="src/app/[locale]/layout.tsx or src/app/[locale]/page.tsx" codeFormat="typescript"
|
|
997
|
+
import {
|
|
998
|
+
type IConfigLocales,
|
|
999
|
+
getTranslation,
|
|
1000
|
+
getMultilingualUrls,
|
|
1001
|
+
} from "intlayer";
|
|
1002
|
+
import type { Metadata } from "next";
|
|
1003
|
+
import type { LocalPromiseParams } from "next-intlayer";
|
|
1004
|
+
|
|
1005
|
+
export const generateMetadata = async ({
|
|
1006
|
+
params,
|
|
1007
|
+
}: LocalPromiseParams): Promise<Metadata> => {
|
|
1008
|
+
const { locale } = await params;
|
|
1009
|
+
const t = <T>(content: IConfigLocales<T>) => getTranslation(content, locale);
|
|
1010
|
+
|
|
1011
|
+
return {
|
|
1012
|
+
title: t<string>({
|
|
1013
|
+
en: "My title",
|
|
1014
|
+
fr: "Mon titre",
|
|
1015
|
+
es: "Mi título",
|
|
1016
|
+
}),
|
|
1017
|
+
description: t({
|
|
1018
|
+
en: "My description",
|
|
1019
|
+
fr: "Ma description",
|
|
1020
|
+
es: "Mi descripción",
|
|
1021
|
+
}),
|
|
1022
|
+
};
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1025
|
+
// ... Reszta kodu
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
```javascript fileName="src/app/[locale]/layout.mjs or src/app/[locale]/page.mjs" codeFormat="esm"
|
|
1029
|
+
import { getTranslation, getMultilingualUrls } from "intlayer";
|
|
1030
|
+
|
|
1031
|
+
export const generateMetadata = async ({ params }) => {
|
|
1032
|
+
const { locale } = await params;
|
|
1033
|
+
const t = (content) => getTranslation(content, locale);
|
|
1034
|
+
|
|
1035
|
+
return {
|
|
1036
|
+
title: t({
|
|
1037
|
+
en: "My title",
|
|
1038
|
+
fr: "Mon titre",
|
|
1039
|
+
es: "Mi título",
|
|
1040
|
+
}),
|
|
1041
|
+
description: t({
|
|
1042
|
+
en: "My description",
|
|
1043
|
+
fr: "Ma description",
|
|
1044
|
+
es: "Mi descripción",
|
|
1045
|
+
}),
|
|
1046
|
+
};
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
// ... Reszta kodu
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
```javascript fileName="src/app/[locale]/layout.cjs or src/app/[locale]/page.cjs" codeFormat="commonjs"
|
|
1053
|
+
const { getTranslation, getMultilingualUrls } = require("intlayer");
|
|
1054
|
+
|
|
1055
|
+
const generateMetadata = async ({ params }) => {
|
|
1056
|
+
const { locale } = await params;
|
|
1057
|
+
|
|
1058
|
+
const t = (content) => getTranslation(content, locale);
|
|
1059
|
+
|
|
1060
|
+
return {
|
|
1061
|
+
title: t({
|
|
1062
|
+
en: "My title",
|
|
1063
|
+
fr: "Mon titre",
|
|
1064
|
+
es: "Mi título",
|
|
1065
|
+
}),
|
|
1066
|
+
description: t({
|
|
1067
|
+
en: "My description",
|
|
1068
|
+
fr: "Ma description",
|
|
1069
|
+
es: "Mi descripción",
|
|
1070
|
+
}),
|
|
1071
|
+
};
|
|
1072
|
+
};
|
|
1073
|
+
|
|
1074
|
+
module.exports = { generateMetadata };
|
|
1075
|
+
|
|
1076
|
+
// ... Reszta kodu
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
> Dowiedz się więcej o optymalizacji metadanych [w oficjalnej dokumentacji Next.js](https://nextjs.org/docs/app/building-your-application/optimizing/metadata).
|
|
1080
|
+
|
|
1081
|
+
### (Opcjonalny) Krok 9: Internacjonalizacja plików sitemap.xml i robots.txt
|
|
1082
|
+
|
|
1083
|
+
Aby zinternacjonalizować swoje pliki `sitemap.xml` i `robots.txt`, możesz użyć funkcji `getMultilingualUrls` dostarczonej przez Intlayer. Funkcja ta pozwala na generowanie wielojęzycznych URL-i dla Twojej mapy witryny.
|
|
1084
|
+
|
|
1085
|
+
```tsx fileName="src/app/sitemap.ts" codeFormat="typescript"
|
|
1086
|
+
import { getMultilingualUrls } from "intlayer";
|
|
1087
|
+
import type { MetadataRoute } from "next";
|
|
1088
|
+
|
|
1089
|
+
const sitemap = (): MetadataRoute.Sitemap => [
|
|
1090
|
+
{
|
|
1091
|
+
url: "https://example.com",
|
|
1092
|
+
alternates: {
|
|
1093
|
+
languages: {
|
|
1094
|
+
...getMultilingualUrls("https://example.com"),
|
|
1095
|
+
"x-default": "https://example.com",
|
|
1096
|
+
},
|
|
1097
|
+
},
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
url: "https://example.com/login",
|
|
1101
|
+
alternates: {
|
|
1102
|
+
languages: {
|
|
1103
|
+
...getMultilingualUrls("https://example.com/login"),
|
|
1104
|
+
"x-default": "https://example.com/login",
|
|
1105
|
+
},
|
|
1106
|
+
},
|
|
1107
|
+
},
|
|
1108
|
+
{
|
|
1109
|
+
url: "https://example.com/register",
|
|
1110
|
+
alternates: {
|
|
1111
|
+
languages: {
|
|
1112
|
+
...getMultilingualUrls("https://example.com/register"),
|
|
1113
|
+
"x-default": "https://example.com/register",
|
|
1114
|
+
},
|
|
1115
|
+
},
|
|
1116
|
+
},
|
|
1117
|
+
];
|
|
1118
|
+
|
|
1119
|
+
export default sitemap;
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
```jsx fileName="src/app/sitemap.mjx" codeFormat="esm"
|
|
1123
|
+
import { getMultilingualUrls } from "intlayer";
|
|
1124
|
+
|
|
1125
|
+
const sitemap = () => [
|
|
1126
|
+
{
|
|
1127
|
+
url: "https://example.com",
|
|
1128
|
+
alternates: {
|
|
1129
|
+
languages: {
|
|
1130
|
+
...getMultilingualUrls("https://example.com"),
|
|
1131
|
+
"x-default": "https://example.com",
|
|
1132
|
+
},
|
|
1133
|
+
},
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
url: "https://example.com/login",
|
|
1137
|
+
alternates: {
|
|
1138
|
+
languages: {
|
|
1139
|
+
...getMultilingualUrls("https://example.com/login"),
|
|
1140
|
+
"x-default": "https://example.com/login",
|
|
1141
|
+
},
|
|
1142
|
+
},
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
url: "https://example.com/register",
|
|
1146
|
+
alternates: {
|
|
1147
|
+
languages: {
|
|
1148
|
+
...getMultilingualUrls("https://example.com/register"),
|
|
1149
|
+
"x-default": "https://example.com/register",
|
|
1150
|
+
},
|
|
1151
|
+
},
|
|
1152
|
+
},
|
|
1153
|
+
];
|
|
1154
|
+
|
|
1155
|
+
export default sitemap;
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
```jsx fileName="src/app/sitemap.csx" codeFormat="commonjs"
|
|
1159
|
+
const { getMultilingualUrls } = require("intlayer");
|
|
1160
|
+
|
|
1161
|
+
const sitemap = () => [
|
|
1162
|
+
{
|
|
1163
|
+
url: "https://example.com",
|
|
1164
|
+
alternates: {
|
|
1165
|
+
languages: {
|
|
1166
|
+
...getMultilingualUrls("https://example.com"),
|
|
1167
|
+
"x-default": "https://example.com",
|
|
1168
|
+
},
|
|
1169
|
+
},
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
url: "https://example.com/login",
|
|
1173
|
+
alternates: {
|
|
1174
|
+
languages: {
|
|
1175
|
+
...getMultilingualUrls("https://example.com/login"),
|
|
1176
|
+
"x-default": "https://example.com/login",
|
|
1177
|
+
},
|
|
1178
|
+
},
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
url: "https://example.com/register",
|
|
1182
|
+
alternates: {
|
|
1183
|
+
languages: {
|
|
1184
|
+
...getMultilingualUrls("https://example.com/register"),
|
|
1185
|
+
"x-default": "https://example.com/register",
|
|
1186
|
+
},
|
|
1187
|
+
},
|
|
1188
|
+
},
|
|
1189
|
+
];
|
|
1190
|
+
|
|
1191
|
+
module.exports = sitemap;
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
```tsx fileName="src/app/robots.ts" codeFormat="typescript"
|
|
1195
|
+
import type { MetadataRoute } from "next";
|
|
1196
|
+
import { getMultilingualUrls } from "intlayer";
|
|
1197
|
+
|
|
1198
|
+
const getAllMultilingualUrls = (urls: string[]) =>
|
|
1199
|
+
urls.flatMap((url) => Object.values(getMultilingualUrls(url)) as string[]);
|
|
1200
|
+
|
|
1201
|
+
const robots = (): MetadataRoute.Robots => ({
|
|
1202
|
+
rules: {
|
|
1203
|
+
userAgent: "*",
|
|
1204
|
+
allow: ["/"],
|
|
1205
|
+
disallow: getAllMultilingualUrls(["/login", "/register"]),
|
|
1206
|
+
},
|
|
1207
|
+
host: "https://example.com",
|
|
1208
|
+
sitemap: `https://example.com/sitemap.xml`,
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
export default robots;
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
```jsx fileName="src/app/robots.mjx" codeFormat="esm"
|
|
1215
|
+
import { getMultilingualUrls } from "intlayer";
|
|
1216
|
+
|
|
1217
|
+
const getAllMultilingualUrls = (urls) =>
|
|
1218
|
+
urls.flatMap((url) => Object.values(getMultilingualUrls(url)));
|
|
1219
|
+
|
|
1220
|
+
const robots = () => ({
|
|
1221
|
+
rules: {
|
|
1222
|
+
userAgent: "*",
|
|
1223
|
+
allow: ["/"],
|
|
1224
|
+
disallow: getAllMultilingualUrls(["/login", "/register"]),
|
|
1225
|
+
},
|
|
1226
|
+
host: "https://example.com",
|
|
1227
|
+
sitemap: `https://example.com/sitemap.xml`,
|
|
1228
|
+
});
|
|
1229
|
+
|
|
1230
|
+
export default robots;
|
|
1231
|
+
```
|
|
1232
|
+
|
|
1233
|
+
```jsx fileName="src/app/robots.csx" codeFormat="commonjs"
|
|
1234
|
+
const { getMultilingualUrls } = require("intlayer");
|
|
1235
|
+
|
|
1236
|
+
const getAllMultilingualUrls = (urls) =>
|
|
1237
|
+
urls.flatMap((url) => Object.values(getMultilingualUrls(url)));
|
|
1238
|
+
|
|
1239
|
+
const robots = () => ({
|
|
1240
|
+
rules: {
|
|
1241
|
+
userAgent: "*",
|
|
1242
|
+
allow: ["/"],
|
|
1243
|
+
disallow: getAllMultilingualUrls(["/login", "/register"]),
|
|
1244
|
+
},
|
|
1245
|
+
host: "https://example.com",
|
|
1246
|
+
sitemap: `https://example.com/sitemap.xml`,
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1249
|
+
module.exports = robots;
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1252
|
+
> Dowiedz się więcej o optymalizacji mapy witryny [w oficjalnej dokumentacji Next.js](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap). Dowiedz się więcej o optymalizacji pliku robots.txt [w oficjalnej dokumentacji Next.js](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots).
|
|
1253
|
+
|
|
1254
|
+
### (Opcjonalny) Krok 10: Zmień język swojej zawartości
|
|
1255
|
+
|
|
1256
|
+
Aby zmienić język swojej zawartości w Next.js, zalecanym sposobem jest użycie komponentu `Link`, aby przekierować użytkowników do odpowiedniej, zlokalizowanej strony. Komponent `Link` umożliwia prefetching strony, co pomaga uniknąć pełnego przeładowania strony.
|
|
1257
|
+
|
|
1258
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
1259
|
+
"use client";
|
|
1260
|
+
|
|
1261
|
+
import type { FC } from "react";
|
|
1262
|
+
import {
|
|
1263
|
+
Locales,
|
|
1264
|
+
getHTMLTextDir,
|
|
1265
|
+
getLocaleName,
|
|
1266
|
+
getLocalizedUrl,
|
|
1267
|
+
} from "intlayer";
|
|
1268
|
+
import { useLocale } from "next-intlayer";
|
|
1269
|
+
import Link from "next/link";
|
|
1270
|
+
|
|
1271
|
+
export const LocaleSwitcher: FC = () => {
|
|
1272
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
1273
|
+
useLocale();
|
|
1274
|
+
|
|
1275
|
+
return (
|
|
1276
|
+
<div>
|
|
1277
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
1278
|
+
<div id="localePopover" popover="auto">
|
|
1279
|
+
{availableLocales.map((localeItem) => (
|
|
1280
|
+
<Link
|
|
1281
|
+
href={getLocalizedUrl(pathWithoutLocale, localeItem)}
|
|
1282
|
+
key={localeItem}
|
|
1283
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
1284
|
+
onClick={() => setLocale(localeItem)}
|
|
1285
|
+
replace // Zapewni, że przycisk "wstecz" w przeglądarce przekieruje do poprzedniej strony
|
|
1286
|
+
>
|
|
1287
|
+
<span>
|
|
1288
|
+
{/* Lokalizacja - np. FR */}
|
|
1289
|
+
{localeItem}
|
|
1290
|
+
</span>
|
|
1291
|
+
<span>
|
|
1292
|
+
{/* Język w swojej własnej lokalizacji - np. Français */}
|
|
1293
|
+
{getLocaleName(localeItem, locale)}
|
|
1294
|
+
</span>
|
|
1295
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1296
|
+
{/* Język w bieżącej lokalizacji - np. Francés przy ustawionej lokalizacji Locales.SPANISH */}
|
|
1297
|
+
{getLocaleName(localeItem)}
|
|
1298
|
+
</span>
|
|
1299
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
1300
|
+
{/* Język po angielsku - np. French */}
|
|
1301
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
1302
|
+
</span>
|
|
1303
|
+
</Link>
|
|
1304
|
+
))}
|
|
1305
|
+
</div>
|
|
1306
|
+
</div>
|
|
1307
|
+
);
|
|
1308
|
+
};
|
|
1309
|
+
```
|
|
1310
|
+
|
|
1311
|
+
```jsx fileName="src/components/LocaleSwitcher.msx" codeFormat="esm"
|
|
1312
|
+
"use client";
|
|
1313
|
+
|
|
1314
|
+
import {
|
|
1315
|
+
Locales,
|
|
1316
|
+
getHTMLTextDir,
|
|
1317
|
+
getLocaleName,
|
|
1318
|
+
getLocalizedUrl,
|
|
1319
|
+
} from "intlayer";
|
|
1320
|
+
import { useLocale } from "next-intlayer";
|
|
1321
|
+
import Link from "next/link";
|
|
1322
|
+
|
|
1323
|
+
export const LocaleSwitcher = () => {
|
|
1324
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
1325
|
+
useLocale();
|
|
1326
|
+
|
|
1327
|
+
return (
|
|
1328
|
+
<div>
|
|
1329
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
1330
|
+
<div id="localePopover" popover="auto">
|
|
1331
|
+
{availableLocales.map((localeItem) => (
|
|
1332
|
+
<Link
|
|
1333
|
+
href={getLocalizedUrl(pathWithoutLocale, localeItem)}
|
|
1334
|
+
key={localeItem}
|
|
1335
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
1336
|
+
onClick={() => setLocale(localeItem)}
|
|
1337
|
+
replace // Zapewni, że przycisk "wstecz" w przeglądarce przekieruje do poprzedniej strony
|
|
1338
|
+
>
|
|
1339
|
+
<span>
|
|
1340
|
+
{/* Locale - np. FR */}
|
|
1341
|
+
{localeItem}
|
|
1342
|
+
</span>
|
|
1343
|
+
<span>
|
|
1344
|
+
{/* Język w swojej własnej lokalizacji - np. Français */}
|
|
1345
|
+
{getLocaleName(localeItem, locale)}
|
|
1346
|
+
</span>
|
|
1347
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1348
|
+
{/* Język w bieżącej lokalizacji - np. Francés przy ustawionej lokalizacji Locales.SPANISH */}
|
|
1349
|
+
{getLocaleName(localeItem)}
|
|
1350
|
+
</span>
|
|
1351
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
1352
|
+
{/* Język po angielsku - np. French */}
|
|
1353
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
1354
|
+
</span>
|
|
1355
|
+
</Link>
|
|
1356
|
+
))}
|
|
1357
|
+
</div>
|
|
1358
|
+
</div>
|
|
1359
|
+
);
|
|
1360
|
+
};
|
|
1361
|
+
```
|
|
1362
|
+
|
|
1363
|
+
```jsx fileName="src/components/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
1364
|
+
"use client";
|
|
1365
|
+
|
|
1366
|
+
const {
|
|
1367
|
+
Locales,
|
|
1368
|
+
getHTMLTextDir,
|
|
1369
|
+
getLocaleName,
|
|
1370
|
+
getLocalizedUrl,
|
|
1371
|
+
} = require("intlayer");
|
|
1372
|
+
const { useLocale } = require("next-intlayer");
|
|
1373
|
+
const Link = require("next/link");
|
|
1374
|
+
|
|
1375
|
+
export const LocaleSwitcher = () => {
|
|
1376
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
1377
|
+
useLocale();
|
|
1378
|
+
|
|
1379
|
+
return (
|
|
1380
|
+
<div>
|
|
1381
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
1382
|
+
<div id="localePopover" popover="auto">
|
|
1383
|
+
{availableLocales.map((localeItem) => (
|
|
1384
|
+
<Link
|
|
1385
|
+
href={getLocalizedUrl(pathWithoutLocale, localeItem)}
|
|
1386
|
+
key={localeItem}
|
|
1387
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
1388
|
+
onClick={() => setLocale(localeItem)}
|
|
1389
|
+
replace // Zapewni, że przycisk "wstecz" w przeglądarce przekieruje do poprzedniej strony
|
|
1390
|
+
>
|
|
1391
|
+
<span>
|
|
1392
|
+
{/* Locale - np. FR */}
|
|
1393
|
+
{localeItem}
|
|
1394
|
+
</span>
|
|
1395
|
+
<span>
|
|
1396
|
+
{/* Język w jego własnym Locale - np. Français */}
|
|
1397
|
+
{getLocaleName(localeItem, locale)}
|
|
1398
|
+
</span>
|
|
1399
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1400
|
+
{/* Język w bieżącym Locale - np. Francés przy ustawionym Locales.SPANISH */}
|
|
1401
|
+
{getLocaleName(localeItem)}
|
|
1402
|
+
</span>
|
|
1403
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
1404
|
+
{/* Język w języku angielskim - np. French */}
|
|
1405
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
1406
|
+
</span>
|
|
1407
|
+
</Link>
|
|
1408
|
+
))}
|
|
1409
|
+
</div>
|
|
1410
|
+
</div>
|
|
1411
|
+
);
|
|
1412
|
+
};
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
> Alternatywnym sposobem jest użycie funkcji `setLocale` dostarczonej przez hook `useLocale`. Ta funkcja nie pozwala na prefetching strony. Zobacz dokumentację [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/next-intlayer/useLocale.md) po więcej szczegółów.
|
|
1416
|
+
|
|
1417
|
+
> Możesz również ustawić funkcję w opcji `onLocaleChange`, aby wywołać niestandardową funkcję, gdy zmieni się lokalizacja.
|
|
1418
|
+
|
|
1419
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx"
|
|
1420
|
+
"use client";
|
|
1421
|
+
|
|
1422
|
+
import { useRouter } from "next/navigation";
|
|
1423
|
+
import { useLocale } from "next-intlayer";
|
|
1424
|
+
import { getLocalizedUrl } from "intlayer";
|
|
1425
|
+
|
|
1426
|
+
// ... Reszta kodu
|
|
1427
|
+
|
|
1428
|
+
const router = useRouter();
|
|
1429
|
+
const { setLocale } = useLocale({
|
|
1430
|
+
onLocaleChange: (locale) => {
|
|
1431
|
+
router.push(getLocalizedUrl(pathWithoutLocale, locale));
|
|
1432
|
+
},
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
return (
|
|
1436
|
+
<button onClick={() => setLocale(Locales.FRENCH)}>Zmień na francuski</button>
|
|
1437
|
+
);
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
> Odnośniki do dokumentacji:
|
|
1441
|
+
>
|
|
1442
|
+
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/next-intlayer/useLocale.md)
|
|
1443
|
+
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/intlayer/getLocaleName.md)
|
|
1444
|
+
> - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/intlayer/getLocalizedUrl.md)
|
|
1445
|
+
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/intlayer/getHTMLTextDir.md)
|
|
1446
|
+
> - [`hrefLang` attribute](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
|
|
1447
|
+
> - [`lang` attribute](https://developer.mozilla.org/pl/docs/Web/HTML/Global_attributes/lang)
|
|
1448
|
+
> - [`dir` attribute`](https://developer.mozilla.org/pl/docs/Web/HTML/Global_attributes/dir)
|
|
1449
|
+
> - [`aria-current` attribute`](https://developer.mozilla.org/pl/docs/Web/Accessibility/ARIA/Attributes/aria-current)
|
|
1450
|
+
|
|
1451
|
+
### (Opcjonalny) Krok 11: Tworzenie komponentu Link z lokalizacją
|
|
1452
|
+
|
|
1453
|
+
Aby zapewnić, że nawigacja w Twojej aplikacji respektuje bieżącą lokalizację, możesz stworzyć niestandardowy komponent `Link`. Ten komponent automatycznie dodaje prefiks z aktualnym językiem do wewnętrznych adresów URL. Na przykład, gdy użytkownik mówiący po francusku kliknie na link do strony "About", zostanie przekierowany na `/fr/about` zamiast na `/about`.
|
|
1454
|
+
|
|
1455
|
+
To zachowanie jest przydatne z kilku powodów:
|
|
1456
|
+
|
|
1457
|
+
- **SEO i doświadczenie użytkownika**: Lokalizowane adresy URL pomagają wyszukiwarkom poprawnie indeksować strony specyficzne dla języka oraz dostarczają użytkownikom treści w ich preferowanym języku.
|
|
1458
|
+
- **Spójność**: Korzystając z lokalizowanego linku w całej aplikacji, gwarantujesz, że nawigacja pozostaje w obrębie bieżącej lokalizacji, zapobiegając niespodziewanym zmianom języka.
|
|
1459
|
+
- **Utrzymanie**: Centralizacja logiki lokalizacji w jednym komponencie upraszcza zarządzanie adresami URL, co sprawia, że baza kodu jest łatwiejsza do utrzymania i rozbudowy wraz z rozwojem aplikacji.
|
|
1460
|
+
|
|
1461
|
+
Poniżej znajduje się implementacja lokalizowanego komponentu `Link` w TypeScript:
|
|
1462
|
+
|
|
1463
|
+
```tsx fileName="src/components/Link.tsx" codeFormat="typescript"
|
|
1464
|
+
"use client";
|
|
1465
|
+
|
|
1466
|
+
import { getLocalizedUrl } from "intlayer";
|
|
1467
|
+
import NextLink, { type LinkProps as NextLinkProps } from "next/link";
|
|
1468
|
+
import { useLocale } from "next-intlayer";
|
|
1469
|
+
import type { PropsWithChildren, FC } from "react";
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* Funkcja pomocnicza do sprawdzania, czy dany URL jest zewnętrzny.
|
|
1473
|
+
* Jeśli URL zaczyna się od http:// lub https://, jest uznawany za zewnętrzny.
|
|
1474
|
+
*/
|
|
1475
|
+
export const checkIsExternalLink = (href?: string): boolean =>
|
|
1476
|
+
/^https?:\/\//.test(href ?? "");
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* Niestandardowy komponent Link, który dostosowuje atrybut href w zależności od bieżącej lokalizacji.
|
|
1480
|
+
* Dla linków wewnętrznych używa `getLocalizedUrl`, aby poprzedzić URL lokalizacją (np. /fr/about).
|
|
1481
|
+
* Zapewnia to, że nawigacja pozostaje w tym samym kontekście lokalizacji.
|
|
1482
|
+
*/
|
|
1483
|
+
export const Link: FC<PropsWithChildren<NextLinkProps>> = ({
|
|
1484
|
+
href,
|
|
1485
|
+
children,
|
|
1486
|
+
...props
|
|
1487
|
+
}) => {
|
|
1488
|
+
const { locale } = useLocale();
|
|
1489
|
+
const isExternalLink = checkIsExternalLink(href.toString());
|
|
1490
|
+
|
|
1491
|
+
// Jeśli link jest wewnętrzny i podano prawidłowy href, pobierz zlokalizowany URL.
|
|
1492
|
+
const hrefI18n: NextLinkProps["href"] =
|
|
1493
|
+
href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
|
|
1494
|
+
|
|
1495
|
+
return (
|
|
1496
|
+
<NextLink href={hrefI18n} {...props}>
|
|
1497
|
+
{children}
|
|
1498
|
+
</NextLink>
|
|
1499
|
+
);
|
|
1500
|
+
};
|
|
1501
|
+
```
|
|
1502
|
+
|
|
1503
|
+
```jsx fileName="src/components/Link.mjx" codeFormat="esm"
|
|
1504
|
+
"use client";
|
|
1505
|
+
|
|
1506
|
+
import { getLocalizedUrl } from "intlayer";
|
|
1507
|
+
import NextLink from "next/link";
|
|
1508
|
+
import { useLocale } from "next-intlayer";
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Funkcja pomocnicza do sprawdzania, czy podany URL jest zewnętrzny.
|
|
1512
|
+
* Jeśli URL zaczyna się od http:// lub https://, jest uznawany za zewnętrzny.
|
|
1513
|
+
*/
|
|
1514
|
+
export const checkIsExternalLink = (href) => /^https?:\/\//.test(href ?? "");
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* Niestandardowy komponent Link, który dostosowuje atrybut href w zależności od bieżącej lokalizacji.
|
|
1518
|
+
* Dla linków wewnętrznych używa `getLocalizedUrl`, aby dodać prefiks z lokalizacją (np. /fr/about).
|
|
1519
|
+
* Zapewnia to, że nawigacja pozostaje w kontekście tej samej lokalizacji.
|
|
1520
|
+
*/
|
|
1521
|
+
export const Link = ({ href, children, ...props }) => {
|
|
1522
|
+
const { locale } = useLocale();
|
|
1523
|
+
const isExternalLink = checkIsExternalLink(href.toString());
|
|
1524
|
+
|
|
1525
|
+
// Jeśli link jest wewnętrzny i podano prawidłowy href, pobierz zlokalizowany URL.
|
|
1526
|
+
const hrefI18n =
|
|
1527
|
+
href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
|
|
1528
|
+
|
|
1529
|
+
return (
|
|
1530
|
+
<NextLink href={hrefI18n} {...props}>
|
|
1531
|
+
{children}
|
|
1532
|
+
</NextLink>
|
|
1533
|
+
);
|
|
1534
|
+
};
|
|
1535
|
+
```
|
|
1536
|
+
|
|
1537
|
+
```jsx fileName="src/components/Link.csx" codeFormat="commonjs"
|
|
1538
|
+
"use client";
|
|
1539
|
+
|
|
1540
|
+
const { getLocalizedUrl } = require("intlayer");
|
|
1541
|
+
const NextLink = require("next/link");
|
|
1542
|
+
const { useLocale } = require("next-intlayer");
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Funkcja pomocnicza do sprawdzania, czy dany URL jest zewnętrzny.
|
|
1546
|
+
* Jeśli URL zaczyna się od http:// lub https://, jest uznawany za zewnętrzny.
|
|
1547
|
+
*/
|
|
1548
|
+
const checkIsExternalLink = (href) => /^https?:\/\//.test(href ?? "");
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* Niestandardowy komponent Link, który dostosowuje atrybut href w oparciu o bieżący język.
|
|
1552
|
+
* Dla linków wewnętrznych używa `getLocalizedUrl`, aby poprzedzić URL prefiksem języka (np. /fr/about).
|
|
1553
|
+
* Zapewnia to, że nawigacja pozostaje w tym samym kontekście językowym.
|
|
1554
|
+
*/
|
|
1555
|
+
const Link = ({ href, children, ...props }) => {
|
|
1556
|
+
const { locale } = useLocale();
|
|
1557
|
+
const isExternalLink = checkIsExternalLink(href.toString());
|
|
1558
|
+
|
|
1559
|
+
// Jeśli link jest wewnętrzny i podano prawidłowy href, pobierz zlokalizowany URL.
|
|
1560
|
+
const hrefI18n =
|
|
1561
|
+
href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
|
|
1562
|
+
|
|
1563
|
+
return (
|
|
1564
|
+
<NextLink href={hrefI18n} {...props}>
|
|
1565
|
+
{children}
|
|
1566
|
+
</NextLink>
|
|
1567
|
+
);
|
|
1568
|
+
};
|
|
1569
|
+
```
|
|
1570
|
+
|
|
1571
|
+
#### Jak to działa
|
|
1572
|
+
|
|
1573
|
+
- **Wykrywanie linków zewnętrznych**:
|
|
1574
|
+
Funkcja pomocnicza `checkIsExternalLink` określa, czy URL jest zewnętrzny. Linki zewnętrzne pozostają niezmienione, ponieważ nie wymagają lokalizacji.
|
|
1575
|
+
|
|
1576
|
+
- **Pobieranie bieżącej lokalizacji**:
|
|
1577
|
+
Hook `useLocale` dostarcza aktualną lokalizację (np. `fr` dla języka francuskiego).
|
|
1578
|
+
|
|
1579
|
+
- **Lokalizacja URL**:
|
|
1580
|
+
Dla linków wewnętrznych (czyli nie zewnętrznych) używana jest funkcja `getLocalizedUrl`, która automatycznie dodaje przedrostek z bieżącą lokalizacją do URL. Oznacza to, że jeśli użytkownik korzysta z wersji francuskiej, podanie `/about` jako `href` zostanie przekształcone na `/fr/about`.
|
|
1581
|
+
|
|
1582
|
+
- **Zwracanie linku**:
|
|
1583
|
+
Komponent zwraca element `<a>` z zlokalizowanym URL, zapewniając spójność nawigacji z lokalizacją.
|
|
1584
|
+
|
|
1585
|
+
Integrując ten komponent `Link` w całej aplikacji, utrzymujesz spójne i świadome językowo doświadczenie użytkownika, jednocześnie korzystając z poprawy SEO i użyteczności.
|
|
1586
|
+
|
|
1587
|
+
### (Opcjonalnie) Krok 12: Pobierz aktualny locale w Server Actions
|
|
1588
|
+
|
|
1589
|
+
Jeśli potrzebujesz aktywnego locale wewnątrz Server Action (np. do lokalizacji e-maili lub uruchamiania logiki zależnej od locale), wywołaj `getLocale` z `next-intlayer/server`:
|
|
1590
|
+
|
|
1591
|
+
```tsx fileName="src/app/actions/getLocale.ts" codeFormat="typescript"
|
|
1592
|
+
"use server";
|
|
1593
|
+
|
|
1594
|
+
import { getLocale } from "next-intlayer/server";
|
|
1595
|
+
|
|
1596
|
+
export const myServerAction = async () => {
|
|
1597
|
+
const locale = await getLocale();
|
|
1598
|
+
|
|
1599
|
+
// Wykonaj coś z locale
|
|
1600
|
+
};
|
|
1601
|
+
```
|
|
1602
|
+
|
|
1603
|
+
> Funkcja `getLocale` stosuje kaskadową strategię, aby określić locale użytkownika:
|
|
1604
|
+
>
|
|
1605
|
+
> 1. Najpierw sprawdza nagłówki żądania pod kątem wartości lokalizacji, która mogła zostać ustawiona przez middleware
|
|
1606
|
+
> 2. Jeśli w nagłówkach nie zostanie znaleziona lokalizacja, szuka jej w ciasteczkach
|
|
1607
|
+
> 3. Jeśli nie zostaną znalezione ciasteczka, próbuje wykryć preferowany język użytkownika na podstawie ustawień przeglądarki
|
|
1608
|
+
> 4. W ostateczności używa domyślnej lokalizacji skonfigurowanej w aplikacji
|
|
1609
|
+
>
|
|
1610
|
+
> Zapewnia to wybór najbardziej odpowiedniej lokalizacji na podstawie dostępnego kontekstu.
|
|
1611
|
+
|
|
1612
|
+
### (Opcjonalny) Krok 13: Optymalizacja rozmiaru pakietu
|
|
1613
|
+
|
|
1614
|
+
Podczas korzystania z `next-intlayer`, słowniki są domyślnie dołączane do bundla dla każdej strony. Aby zoptymalizować rozmiar bundla, Intlayer udostępnia opcjonalny plugin SWC, który inteligentnie zastępuje wywołania `useIntlayer` za pomocą makr. Zapewnia to, że słowniki są dołączane tylko do bundli stron, które faktycznie ich używają.
|
|
1615
|
+
|
|
1616
|
+
Aby włączyć tę optymalizację, zainstaluj pakiet `@intlayer/swc`. Po instalacji `next-intlayer` automatycznie wykryje i użyje tego pluginu:
|
|
1617
|
+
|
|
1618
|
+
```bash packageManager="npm"
|
|
1619
|
+
npm install @intlayer/swc --save-dev
|
|
1620
|
+
```
|
|
1621
|
+
|
|
1622
|
+
```bash packageManager="pnpm"
|
|
1623
|
+
pnpm add @intlayer/swc --save-dev
|
|
1624
|
+
```
|
|
1625
|
+
|
|
1626
|
+
```bash packageManager="yarn"
|
|
1627
|
+
yarn add @intlayer/swc --save-dev
|
|
1628
|
+
```
|
|
1629
|
+
|
|
1630
|
+
> Uwaga: Ta optymalizacja jest dostępna tylko dla Next.js w wersji 13 i wyższych.
|
|
1631
|
+
|
|
1632
|
+
> Uwaga: Ten pakiet nie jest instalowany domyślnie, ponieważ wtyczki SWC są nadal eksperymentalne w Next.js. Może się to zmienić w przyszłości.
|
|
1633
|
+
|
|
1634
|
+
> Uwaga: Jeśli ustawisz opcję jako `importMode: 'dynamic'` lub `importMode: 'live'`, będzie to polegać na Suspense, więc będziesz musiał owinąć wywołania `useIntlayer` w granicę `Suspense`. Oznacza to, że nie będziesz mógł używać `useIntlayer` bezpośrednio na najwyższym poziomie komponentu Strony / Układu.
|
|
1635
|
+
|
|
1636
|
+
### Monitorowanie zmian słowników w Turbopack
|
|
1637
|
+
|
|
1638
|
+
Podczas korzystania z Turbopack jako serwera deweloperskiego za pomocą polecenia `next dev --turbopack`, zmiany w słownikach nie będą domyślnie automatycznie wykrywane.
|
|
1639
|
+
|
|
1640
|
+
To ograniczenie występuje, ponieważ Turbopack nie może uruchamiać wtyczek webpack równolegle, aby monitorować zmiany w Twoich plikach z zawartością. Aby to obejść, musisz użyć polecenia `intlayer watch`, aby jednocześnie uruchomić serwer deweloperski oraz obserwatora budowy Intlayer.
|
|
1641
|
+
|
|
1642
|
+
```json5 fileName="package.json"
|
|
1643
|
+
{
|
|
1644
|
+
// ... Twoje istniejące konfiguracje package.json
|
|
1645
|
+
"scripts": {
|
|
1646
|
+
// ... Twoje istniejące konfiguracje skryptów
|
|
1647
|
+
"dev": "intlayer watch --with 'next dev --turbopack'",
|
|
1648
|
+
},
|
|
1649
|
+
}
|
|
1650
|
+
```
|
|
1651
|
+
|
|
1652
|
+
### Konfiguracja TypeScript
|
|
1653
|
+
|
|
1654
|
+
Intlayer używa rozszerzenia modułów (module augmentation), aby wykorzystać zalety TypeScript i wzmocnić Twoją bazę kodu.
|
|
1655
|
+
|
|
1656
|
+

|
|
1657
|
+
|
|
1658
|
+

|
|
1659
|
+
|
|
1660
|
+
Upewnij się, że Twoja konfiguracja TypeScript zawiera automatycznie generowane typy.
|
|
1661
|
+
|
|
1662
|
+
```json5 fileName="tsconfig.json"
|
|
1663
|
+
{
|
|
1664
|
+
// ... Twoje istniejące konfiguracje TypeScript
|
|
1665
|
+
"include": [
|
|
1666
|
+
// ... Twoje istniejące konfiguracje TypeScript
|
|
1667
|
+
".intlayer/**/*.ts", // Uwzględnij automatycznie generowane typy
|
|
1668
|
+
],
|
|
1669
|
+
}
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
### Konfiguracja Git
|
|
1673
|
+
|
|
1674
|
+
Zaleca się ignorowanie plików generowanych przez Intlayer. Pozwala to uniknąć ich zatwierdzania do repozytorium Git.
|
|
1675
|
+
|
|
1676
|
+
Aby to zrobić, możesz dodać następujące instrukcje do pliku `.gitignore`:
|
|
1677
|
+
|
|
1678
|
+
```plaintext fileName=".gitignore"
|
|
1679
|
+
# Ignoruj pliki generowane przez Intlayer
|
|
1680
|
+
.intlayer
|
|
1681
|
+
```
|
|
1682
|
+
|
|
1683
|
+
### Rozszerzenie VS Code
|
|
1684
|
+
|
|
1685
|
+
Aby poprawić swoje doświadczenie w pracy z Intlayer, możesz zainstalować oficjalne **rozszerzenie Intlayer dla VS Code**.
|
|
1686
|
+
|
|
1687
|
+
[Zainstaluj z Marketplace VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1688
|
+
|
|
1689
|
+
To rozszerzenie oferuje:
|
|
1690
|
+
|
|
1691
|
+
- **Autouzupełnianie** kluczy tłumaczeń.
|
|
1692
|
+
- **Wykrywanie błędów w czasie rzeczywistym** dla brakujących tłumaczeń.
|
|
1693
|
+
- **Podgląd w linii** przetłumaczonej zawartości.
|
|
1694
|
+
- **Szybkie akcje** umożliwiające łatwe tworzenie i aktualizowanie tłumaczeń.
|
|
1695
|
+
|
|
1696
|
+
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).
|
|
1697
|
+
|
|
1698
|
+
### Idź dalej
|
|
1699
|
+
|
|
1700
|
+
Aby pójść dalej, możesz zaimplementować [edytor wizualny](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_visual_editor.md) lub wyodrębnić swoją zawartość, korzystając z [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_CMS.md).
|
|
1701
|
+
````
|