@intlayer/docs 7.5.11 → 7.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/intlayer_with_i18next.md +0 -2
- package/blog/ar/intlayer_with_next-i18next.md +0 -2
- package/blog/ar/intlayer_with_react-i18next.md +0 -2
- package/blog/de/intlayer_with_i18next.md +0 -45
- package/blog/de/intlayer_with_next-i18next.md +0 -46
- package/blog/de/intlayer_with_react-i18next.md +0 -2
- package/blog/en/intlayer_with_i18next.md +0 -46
- package/blog/en/intlayer_with_next-i18next.md +0 -48
- package/blog/en/intlayer_with_next-intl.md +0 -44
- package/blog/en/intlayer_with_react-i18next.md +0 -44
- package/blog/en/intlayer_with_react-intl.md +0 -42
- package/blog/en/intlayer_with_vue-i18n.md +0 -44
- package/blog/en-GB/intlayer_with_i18next.md +0 -45
- package/blog/en-GB/intlayer_with_next-i18next.md +0 -47
- package/blog/en-GB/intlayer_with_next-intl.md +0 -42
- package/blog/en-GB/intlayer_with_react-i18next.md +0 -43
- package/blog/en-GB/intlayer_with_react-intl.md +0 -42
- package/blog/en-GB/intlayer_with_vue-i18n.md +0 -46
- package/blog/es/intlayer_with_i18next.md +0 -45
- package/blog/es/intlayer_with_next-i18next.md +0 -47
- package/blog/es/intlayer_with_next-intl.md +0 -42
- package/blog/es/intlayer_with_react-i18next.md +0 -43
- package/blog/es/intlayer_with_react-intl.md +0 -42
- package/blog/es/intlayer_with_vue-i18n.md +0 -46
- package/blog/fr/intlayer_with_i18next.md +0 -45
- package/blog/fr/intlayer_with_next-i18next.md +0 -47
- package/blog/fr/intlayer_with_next-intl.md +0 -42
- package/blog/fr/intlayer_with_react-i18next.md +0 -43
- package/blog/fr/intlayer_with_react-intl.md +0 -42
- package/blog/fr/intlayer_with_vue-i18n.md +0 -46
- package/blog/hi/intlayer_with_i18next.md +0 -2
- package/blog/hi/intlayer_with_next-i18next.md +0 -2
- package/blog/hi/intlayer_with_react-i18next.md +0 -2
- package/blog/id/intlayer_with_i18next.md +0 -2
- package/blog/id/intlayer_with_next-i18next.md +0 -2
- package/blog/id/intlayer_with_react-i18next.md +0 -2
- package/blog/it/intlayer_with_i18next.md +0 -2
- package/blog/it/intlayer_with_next-i18next.md +0 -2
- package/blog/it/intlayer_with_react-i18next.md +0 -2
- package/blog/ja/intlayer_with_i18next.md +0 -45
- package/blog/ja/intlayer_with_next-i18next.md +0 -46
- package/blog/ja/intlayer_with_next-intl.md +0 -42
- package/blog/ja/intlayer_with_react-i18next.md +0 -42
- package/blog/ja/intlayer_with_react-intl.md +0 -42
- package/blog/ja/intlayer_with_vue-i18n.md +0 -46
- package/blog/ko/intlayer_with_i18next.md +0 -2
- package/blog/ko/intlayer_with_next-i18next.md +0 -2
- package/blog/ko/intlayer_with_react-i18next.md +0 -1
- package/blog/pl/intlayer_with_i18next.md +0 -45
- package/blog/pl/intlayer_with_next-i18next.md +0 -46
- package/blog/pl/intlayer_with_next-intl.md +0 -42
- package/blog/pl/intlayer_with_react-i18next.md +0 -43
- package/blog/pl/intlayer_with_react-intl.md +0 -42
- package/blog/pl/intlayer_with_vue-i18n.md +0 -46
- package/blog/pt/intlayer_with_i18next.md +0 -2
- package/blog/pt/intlayer_with_next-i18next.md +0 -2
- package/blog/pt/intlayer_with_react-i18next.md +0 -2
- package/blog/ru/intlayer_with_i18next.md +0 -45
- package/blog/ru/intlayer_with_next-i18next.md +0 -47
- package/blog/ru/intlayer_with_next-intl.md +0 -42
- package/blog/ru/intlayer_with_react-i18next.md +0 -43
- package/blog/ru/intlayer_with_react-intl.md +0 -42
- package/blog/ru/intlayer_with_vue-i18n.md +0 -46
- package/blog/tr/intlayer_with_i18next.md +0 -2
- package/blog/tr/intlayer_with_next-i18next.md +0 -1
- package/blog/tr/intlayer_with_react-i18next.md +0 -2
- package/blog/uk/compiler_vs_declarative_i18n.md +224 -0
- package/blog/uk/i18n_using_next-i18next.md +1086 -0
- package/blog/uk/i18n_using_next-intl.md +760 -0
- package/blog/uk/index.md +69 -0
- package/blog/uk/internationalization_and_SEO.md +273 -0
- package/blog/uk/intlayer_with_i18next.md +211 -0
- package/blog/uk/intlayer_with_next-i18next.md +202 -0
- package/blog/uk/intlayer_with_next-intl.md +203 -0
- package/blog/uk/intlayer_with_react-i18next.md +200 -0
- package/blog/uk/intlayer_with_react-intl.md +202 -0
- package/blog/uk/intlayer_with_vue-i18n.md +206 -0
- package/blog/uk/l10n_platform_alternative/Lokalise.md +80 -0
- package/blog/uk/l10n_platform_alternative/crowdin.md +80 -0
- package/blog/uk/l10n_platform_alternative/phrase.md +78 -0
- package/blog/uk/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/uk/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/uk/list_i18n_technologies/CMS/wordpress.md +189 -0
- package/blog/uk/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/uk/list_i18n_technologies/frameworks/flutter.md +128 -0
- package/blog/uk/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/uk/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/uk/list_i18n_technologies/frameworks/svelte.md +145 -0
- package/blog/uk/list_i18n_technologies/frameworks/vue.md +144 -0
- package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1499 -0
- package/blog/uk/nextjs-multilingual-seo-comparison.md +360 -0
- package/blog/uk/rag_powered_documentation_assistant.md +288 -0
- package/blog/uk/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/uk/vue-i18n_vs_intlayer.md +279 -0
- package/blog/uk/what_is_internationalization.md +167 -0
- package/blog/vi/intlayer_with_i18next.md +0 -2
- package/blog/vi/intlayer_with_next-i18next.md +0 -2
- package/blog/vi/intlayer_with_react-i18next.md +0 -2
- package/blog/zh/intlayer_with_i18next.md +0 -2
- package/blog/zh/intlayer_with_next-i18next.md +0 -2
- package/blog/zh/intlayer_with_react-i18next.md +0 -2
- package/blog/zh/intlayer_with_vue-i18n.md +0 -46
- package/dist/cjs/generated/blog.entry.cjs +58 -29
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +218 -99
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +50 -15
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +4 -2
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +58 -29
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +218 -99
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +50 -15
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +4 -2
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts +1 -0
- package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
- package/dist/types/generated/legal.entry.d.ts.map +1 -1
- package/docs/ar/configuration.md +6 -1
- package/docs/ar/dictionary/content_file.md +6 -1
- package/docs/ar/intlayer_with_next-i18next.md +0 -1
- package/docs/ar/intlayer_with_nextjs_14.md +28 -0
- package/docs/ar/intlayer_with_nextjs_15.md +28 -0
- package/docs/ar/intlayer_with_nextjs_16.md +28 -0
- package/docs/ar/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/ar/plugins/sync-json.md +6 -2
- package/docs/de/configuration.md +6 -1
- package/docs/de/dictionary/content_file.md +6 -1
- package/docs/de/intlayer_with_next-i18next.md +0 -1
- package/docs/de/intlayer_with_nextjs_14.md +28 -0
- package/docs/de/intlayer_with_nextjs_15.md +28 -0
- package/docs/de/intlayer_with_nextjs_16.md +28 -0
- package/docs/de/intlayer_with_nextjs_no_locale_path.md +1152 -0
- package/docs/de/plugins/sync-json.md +6 -2
- package/docs/en/configuration.md +6 -1
- package/docs/en/dictionary/content_file.md +6 -1
- package/docs/en/intlayer_with_next-i18next.md +0 -1
- package/docs/en/intlayer_with_nextjs_14.md +28 -0
- package/docs/en/intlayer_with_nextjs_15.md +28 -0
- package/docs/en/intlayer_with_nextjs_16.md +31 -1
- package/docs/en/intlayer_with_nextjs_no_locale_path.md +1132 -0
- package/docs/en/plugins/sync-json.md +6 -2
- package/docs/en-GB/configuration.md +6 -1
- package/docs/en-GB/dictionary/content_file.md +3 -1
- package/docs/en-GB/intlayer_with_next-i18next.md +0 -1
- package/docs/en-GB/intlayer_with_nextjs_14.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_15.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_16.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_no_locale_path.md +1154 -0
- package/docs/en-GB/plugins/sync-json.md +6 -2
- package/docs/es/configuration.md +6 -1
- package/docs/es/dictionary/content_file.md +6 -1
- package/docs/es/intlayer_with_next-i18next.md +0 -1
- package/docs/es/intlayer_with_nextjs_14.md +28 -0
- package/docs/es/intlayer_with_nextjs_15.md +28 -0
- package/docs/es/intlayer_with_nextjs_16.md +28 -0
- package/docs/es/intlayer_with_nextjs_no_locale_path.md +1143 -0
- package/docs/es/plugins/sync-json.md +6 -2
- package/docs/fr/configuration.md +6 -1
- package/docs/fr/dictionary/content_file.md +3 -1
- package/docs/fr/intlayer_with_next-i18next.md +0 -1
- package/docs/fr/intlayer_with_nextjs_14.md +28 -0
- package/docs/fr/intlayer_with_nextjs_15.md +28 -0
- package/docs/fr/intlayer_with_nextjs_16.md +28 -0
- package/docs/fr/intlayer_with_nextjs_no_locale_path.md +1174 -0
- package/docs/fr/plugins/sync-json.md +9 -5
- package/docs/hi/configuration.md +6 -1
- package/docs/hi/dictionary/content_file.md +3 -1
- package/docs/hi/intlayer_with_next-i18next.md +0 -1
- package/docs/hi/intlayer_with_nextjs_14.md +28 -0
- package/docs/hi/intlayer_with_nextjs_15.md +28 -0
- package/docs/hi/intlayer_with_nextjs_16.md +28 -0
- package/docs/hi/intlayer_with_nextjs_no_locale_path.md +1151 -0
- package/docs/hi/plugins/sync-json.md +6 -2
- package/docs/id/configuration.md +6 -1
- package/docs/id/dictionary/content_file.md +3 -1
- package/docs/id/intlayer_with_next-i18next.md +0 -1
- package/docs/id/intlayer_with_nextjs_14.md +28 -0
- package/docs/id/intlayer_with_nextjs_15.md +28 -0
- package/docs/id/intlayer_with_nextjs_16.md +28 -0
- package/docs/id/intlayer_with_nextjs_no_locale_path.md +1154 -0
- package/docs/id/plugins/sync-json.md +6 -2
- package/docs/it/configuration.md +6 -1
- package/docs/it/dictionary/content_file.md +3 -1
- package/docs/it/intlayer_with_next-i18next.md +0 -1
- package/docs/it/intlayer_with_nextjs_14.md +28 -0
- package/docs/it/intlayer_with_nextjs_15.md +28 -0
- package/docs/it/intlayer_with_nextjs_16.md +28 -0
- package/docs/it/intlayer_with_nextjs_no_locale_path.md +1148 -0
- package/docs/it/plugins/sync-json.md +6 -2
- package/docs/ja/configuration.md +6 -1
- package/docs/ja/dictionary/content_file.md +3 -1
- package/docs/ja/intlayer_with_next-i18next.md +0 -1
- package/docs/ja/intlayer_with_nextjs_14.md +28 -0
- package/docs/ja/intlayer_with_nextjs_15.md +28 -0
- package/docs/ja/intlayer_with_nextjs_16.md +28 -0
- package/docs/ja/intlayer_with_nextjs_no_locale_path.md +1222 -0
- package/docs/ja/plugins/sync-json.md +6 -2
- package/docs/ko/configuration.md +6 -1
- package/docs/ko/dictionary/content_file.md +3 -1
- package/docs/ko/intlayer_with_next-i18next.md +0 -1
- package/docs/ko/intlayer_with_nextjs_14.md +28 -0
- package/docs/ko/intlayer_with_nextjs_15.md +28 -0
- package/docs/ko/intlayer_with_nextjs_16.md +28 -0
- package/docs/ko/intlayer_with_nextjs_no_locale_path.md +1205 -0
- package/docs/ko/plugins/sync-json.md +6 -2
- package/docs/pl/configuration.md +3 -1
- package/docs/pl/dictionary/content_file.md +3 -1
- package/docs/pl/intlayer_with_next-i18next.md +0 -1
- package/docs/pl/intlayer_with_nextjs_14.md +28 -0
- package/docs/pl/intlayer_with_nextjs_15.md +28 -0
- package/docs/pl/intlayer_with_nextjs_16.md +28 -0
- package/docs/pl/intlayer_with_nextjs_no_locale_path.md +1149 -0
- package/docs/pl/plugins/sync-json.md +6 -2
- package/docs/pt/configuration.md +6 -1
- package/docs/pt/dictionary/content_file.md +3 -1
- package/docs/pt/intlayer_with_next-i18next.md +0 -1
- package/docs/pt/intlayer_with_nextjs_14.md +28 -0
- package/docs/pt/intlayer_with_nextjs_15.md +28 -0
- package/docs/pt/intlayer_with_nextjs_16.md +28 -0
- package/docs/pt/intlayer_with_nextjs_no_locale_path.md +1152 -0
- package/docs/pt/plugins/sync-json.md +6 -2
- package/docs/ru/configuration.md +6 -1
- package/docs/ru/dictionary/content_file.md +6 -1
- package/docs/ru/intlayer_with_next-i18next.md +0 -1
- package/docs/ru/intlayer_with_nextjs_14.md +28 -0
- package/docs/ru/intlayer_with_nextjs_15.md +28 -0
- package/docs/ru/intlayer_with_nextjs_16.md +28 -0
- package/docs/ru/intlayer_with_nextjs_no_locale_path.md +1204 -0
- package/docs/ru/plugins/sync-json.md +6 -2
- package/docs/tr/configuration.md +6 -1
- package/docs/tr/dictionary/content_file.md +3 -1
- package/docs/tr/intlayer_with_next-i18next.md +0 -1
- package/docs/tr/intlayer_with_nextjs_14.md +28 -0
- package/docs/tr/intlayer_with_nextjs_15.md +28 -0
- package/docs/tr/intlayer_with_nextjs_16.md +28 -0
- package/docs/tr/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/tr/plugins/sync-json.md +6 -2
- package/docs/uk/CI_CD.md +198 -0
- package/docs/uk/autoFill.md +307 -0
- package/docs/uk/bundle_optimization.md +185 -0
- package/docs/uk/cli/build.md +64 -0
- package/docs/uk/cli/ci.md +137 -0
- package/docs/uk/cli/configuration.md +63 -0
- package/docs/uk/cli/debug.md +46 -0
- package/docs/uk/cli/doc-review.md +43 -0
- package/docs/uk/cli/doc-translate.md +132 -0
- package/docs/uk/cli/editor.md +28 -0
- package/docs/uk/cli/fill.md +130 -0
- package/docs/uk/cli/index.md +190 -0
- package/docs/uk/cli/init.md +84 -0
- package/docs/uk/cli/list.md +90 -0
- package/docs/uk/cli/list_projects.md +128 -0
- package/docs/uk/cli/live.md +41 -0
- package/docs/uk/cli/login.md +157 -0
- package/docs/uk/cli/pull.md +78 -0
- package/docs/uk/cli/push.md +98 -0
- package/docs/uk/cli/sdk.md +71 -0
- package/docs/uk/cli/test.md +76 -0
- package/docs/uk/cli/transform.md +65 -0
- package/docs/uk/cli/version.md +24 -0
- package/docs/uk/cli/watch.md +37 -0
- package/docs/uk/compiler.md +133 -0
- package/docs/uk/component_i18n.md +194 -0
- package/docs/uk/configuration.md +742 -0
- package/docs/uk/dictionary/condition.md +237 -0
- package/docs/uk/dictionary/content_file.md +1134 -0
- package/docs/uk/dictionary/enumeration.md +245 -0
- package/docs/uk/dictionary/file.md +232 -0
- package/docs/uk/dictionary/function_fetching.md +212 -0
- package/docs/uk/dictionary/gender.md +273 -0
- package/docs/uk/dictionary/insertion.md +187 -0
- package/docs/uk/dictionary/markdown.md +383 -0
- package/docs/uk/dictionary/nesting.md +273 -0
- package/docs/uk/dictionary/translation.md +332 -0
- package/docs/uk/formatters.md +595 -0
- package/docs/uk/how_works_intlayer.md +256 -0
- package/docs/uk/index.md +175 -0
- package/docs/uk/interest_of_intlayer.md +297 -0
- package/docs/uk/intlayer_CMS.md +569 -0
- package/docs/uk/intlayer_visual_editor.md +292 -0
- package/docs/uk/intlayer_with_angular.md +710 -0
- package/docs/uk/intlayer_with_astro.md +256 -0
- package/docs/uk/intlayer_with_create_react_app.md +1258 -0
- package/docs/uk/intlayer_with_express.md +429 -0
- package/docs/uk/intlayer_with_fastify.md +446 -0
- package/docs/uk/intlayer_with_lynx+react.md +548 -0
- package/docs/uk/intlayer_with_nestjs.md +283 -0
- package/docs/uk/intlayer_with_next-i18next.md +640 -0
- package/docs/uk/intlayer_with_next-intl.md +456 -0
- package/docs/uk/intlayer_with_nextjs_14.md +1646 -0
- package/docs/uk/intlayer_with_nextjs_15.md +1910 -0
- package/docs/uk/intlayer_with_nextjs_16.md +1763 -0
- package/docs/uk/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/uk/intlayer_with_nextjs_page_router.md +1541 -0
- package/docs/uk/intlayer_with_nuxt.md +711 -0
- package/docs/uk/intlayer_with_react_native+expo.md +715 -0
- package/docs/uk/intlayer_with_react_router_v7.md +600 -0
- package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +669 -0
- package/docs/uk/intlayer_with_svelte_kit.md +579 -0
- package/docs/uk/intlayer_with_tanstack.md +818 -0
- package/docs/uk/intlayer_with_vite+preact.md +1748 -0
- package/docs/uk/intlayer_with_vite+react.md +1449 -0
- package/docs/uk/intlayer_with_vite+solid.md +302 -0
- package/docs/uk/intlayer_with_vite+svelte.md +520 -0
- package/docs/uk/intlayer_with_vite+vue.md +1113 -0
- package/docs/uk/introduction.md +222 -0
- package/docs/uk/locale_mapper.md +242 -0
- package/docs/uk/mcp_server.md +211 -0
- package/docs/uk/packages/express-intlayer/t.md +465 -0
- package/docs/uk/packages/intlayer/getConfiguration.md +145 -0
- package/docs/uk/packages/intlayer/getEnumeration.md +159 -0
- package/docs/uk/packages/intlayer/getHTMLTextDir.md +121 -0
- package/docs/uk/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/uk/packages/intlayer/getLocaleName.md +135 -0
- package/docs/uk/packages/intlayer/getLocalizedUrl.md +338 -0
- package/docs/uk/packages/intlayer/getMultilingualUrls.md +359 -0
- package/docs/uk/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/uk/packages/intlayer/getPrefix.md +213 -0
- package/docs/uk/packages/intlayer/getTranslation.md +190 -0
- package/docs/uk/packages/intlayer/getTranslationContent.md +189 -0
- package/docs/uk/packages/next-intlayer/t.md +365 -0
- package/docs/uk/packages/next-intlayer/useDictionary.md +276 -0
- package/docs/uk/packages/next-intlayer/useIntlayer.md +263 -0
- package/docs/uk/packages/next-intlayer/useLocale.md +166 -0
- package/docs/uk/packages/react-intlayer/t.md +311 -0
- package/docs/uk/packages/react-intlayer/useDictionary.md +295 -0
- package/docs/uk/packages/react-intlayer/useI18n.md +250 -0
- package/docs/uk/packages/react-intlayer/useIntlayer.md +251 -0
- package/docs/uk/packages/react-intlayer/useLocale.md +210 -0
- package/docs/uk/per_locale_file.md +345 -0
- package/docs/uk/plugins/sync-json.md +398 -0
- package/docs/uk/readme.md +265 -0
- package/docs/uk/releases/v6.md +305 -0
- package/docs/uk/releases/v7.md +624 -0
- package/docs/uk/roadmap.md +346 -0
- package/docs/uk/testing.md +204 -0
- package/docs/uk/vs_code_extension.md +133 -0
- package/docs/vi/configuration.md +6 -1
- package/docs/vi/dictionary/content_file.md +6 -1
- package/docs/vi/intlayer_with_next-i18next.md +0 -1
- package/docs/vi/intlayer_with_nextjs_14.md +28 -0
- package/docs/vi/intlayer_with_nextjs_15.md +28 -0
- package/docs/vi/intlayer_with_nextjs_16.md +28 -0
- package/docs/vi/intlayer_with_nextjs_no_locale_path.md +1151 -0
- package/docs/vi/plugins/sync-json.md +6 -2
- package/docs/zh/configuration.md +6 -1
- package/docs/zh/dictionary/content_file.md +6 -1
- package/docs/zh/intlayer_with_next-i18next.md +0 -1
- package/docs/zh/intlayer_with_nextjs_14.md +28 -0
- package/docs/zh/intlayer_with_nextjs_15.md +28 -0
- package/docs/zh/intlayer_with_nextjs_16.md +28 -0
- package/docs/zh/intlayer_with_nextjs_no_locale_path.md +1206 -0
- package/docs/zh/plugins/sync-json.md +9 -5
- package/frequent_questions/ar/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ar/error-vite-env-only.md +77 -0
- package/frequent_questions/de/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/de/error-vite-env-only.md +77 -0
- package/frequent_questions/en/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/en/error-vite-env-only.md +77 -0
- package/frequent_questions/en-GB/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/en-GB/error-vite-env-only.md +77 -0
- package/frequent_questions/es/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/es/error-vite-env-only.md +76 -0
- package/frequent_questions/fr/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/fr/error-vite-env-only.md +77 -0
- package/frequent_questions/hi/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/hi/error-vite-env-only.md +77 -0
- package/frequent_questions/id/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/id/error-vite-env-only.md +77 -0
- package/frequent_questions/it/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/it/error-vite-env-only.md +77 -0
- package/frequent_questions/ja/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ja/error-vite-env-only.md +77 -0
- package/frequent_questions/ko/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ko/error-vite-env-only.md +77 -0
- package/frequent_questions/pl/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/pl/error-vite-env-only.md +77 -0
- package/frequent_questions/pt/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/pt/error-vite-env-only.md +77 -0
- package/frequent_questions/ru/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ru/error-vite-env-only.md +77 -0
- package/frequent_questions/tr/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/tr/error-vite-env-only.md +77 -0
- package/frequent_questions/uk/SSR_Next_no_[locale].md +104 -0
- package/frequent_questions/uk/array_as_content_declaration.md +72 -0
- package/frequent_questions/uk/build_dictionaries.md +58 -0
- package/frequent_questions/uk/build_error_CI_CD.md +74 -0
- package/frequent_questions/uk/bun_set_up.md +53 -0
- package/frequent_questions/uk/customized_locale_list.md +64 -0
- package/frequent_questions/uk/domain_routing.md +113 -0
- package/frequent_questions/uk/error-vite-env-only.md +77 -0
- package/frequent_questions/uk/esbuild_error.md +29 -0
- package/frequent_questions/uk/get_locale_cookie.md +142 -0
- package/frequent_questions/uk/intlayer_command_undefined.md +155 -0
- package/frequent_questions/uk/locale_incorect_in_url.md +73 -0
- package/frequent_questions/uk/package_version_error.md +181 -0
- package/frequent_questions/uk/static_rendering.md +44 -0
- package/frequent_questions/uk/translated_path_url.md +55 -0
- package/frequent_questions/uk/unknown_command.md +97 -0
- package/frequent_questions/vi/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/vi/error-vite-env-only.md +77 -0
- package/frequent_questions/zh/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/zh/error-vite-env-only.md +77 -0
- package/legal/uk/privacy_notice.md +83 -0
- package/legal/uk/terms_of_service.md +55 -0
- package/package.json +6 -6
- package/src/generated/blog.entry.ts +29 -0
- package/src/generated/docs.entry.ts +119 -0
- package/src/generated/frequentQuestions.entry.ts +35 -0
- package/src/generated/legal.entry.ts +2 -0
|
@@ -0,0 +1,1149 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2026-01-10
|
|
3
|
+
updatedAt: 2026-01-10
|
|
4
|
+
title: Jak przetłumaczyć aplikację Next.js 16 (bez [locale] w ścieżce strony) – przewodnik i18n 2026
|
|
5
|
+
description: Dowiedz się, jak uczynić swoją stronę Next.js 16 wielojęzyczną bez [locale] w ścieżce strony. Postępuj zgodnie z dokumentacją, aby przeprowadzić internacjonalizację (i18n) i przetłumaczyć ją.
|
|
6
|
+
keywords:
|
|
7
|
+
- Internacjonalizacja
|
|
8
|
+
- Dokumentacja
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Next.js 16
|
|
11
|
+
- JavaScript
|
|
12
|
+
- React
|
|
13
|
+
slugs:
|
|
14
|
+
- doc
|
|
15
|
+
- environment
|
|
16
|
+
- nextjs
|
|
17
|
+
- no-locale-path
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-next-no-lolale-path-template
|
|
19
|
+
youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
|
|
20
|
+
history:
|
|
21
|
+
- version: 1.0.0
|
|
22
|
+
date: 2026-01-10
|
|
23
|
+
changes: Pierwsze wydanie
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Przetłumacz swoją stronę Next.js 16 (bez [locale] w ścieżce) za pomocą Intlayer | Internationalization (i18n)
|
|
27
|
+
|
|
28
|
+
<Tab defaultTab="video">
|
|
29
|
+
<TabItem label="Wideo" value="video">
|
|
30
|
+
|
|
31
|
+
<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"/>
|
|
32
|
+
|
|
33
|
+
</TabItem>
|
|
34
|
+
<TabItem label="Kod" value="code">
|
|
35
|
+
|
|
36
|
+
<iframe
|
|
37
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-next-16-no-locale-path-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
38
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
39
|
+
title="Demo CodeSandbox - Jak internacjonalizować aplikację za pomocą Intlayer"
|
|
40
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
41
|
+
loading="lazy"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
</TabItem>
|
|
45
|
+
</Tab>
|
|
46
|
+
|
|
47
|
+
Zobacz [Szablon aplikacji](https://github.com/aymericzip/intlayer-next-no-lolale-path-template) na GitHubie.
|
|
48
|
+
|
|
49
|
+
## Spis treści
|
|
50
|
+
|
|
51
|
+
<TOC/>
|
|
52
|
+
|
|
53
|
+
## Czym jest Intlayer?
|
|
54
|
+
|
|
55
|
+
**Intlayer** to innowacyjna, open-source biblioteka do internacjonalizacji (i18n) zaprojektowana, aby upraszczać wielojęzyczne wsparcie we współczesnych aplikacjach webowych. Intlayer bezproblemowo integruje się z najnowszym frameworkiem **Next.js 16**, w tym z jego potężnym **App Router**. Jest zoptymalizowany do współpracy z **Server Components** w celu wydajnego 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** przy użyciu deklaratywnych słowników na poziomie komponentu.
|
|
60
|
+
- **Dynamicznie lokalizować metadane**, trasy i treści.
|
|
61
|
+
- **Uzyskiwać dostęp do tłumaczeń zarówno w komponentach po stronie klienta, jak i po stronie serwera**.
|
|
62
|
+
- **Zapewnić wsparcie TypeScript** poprzez automatycznie generowane typy, poprawiające autouzupełnianie i wykrywanie błędów.
|
|
63
|
+
- **Skorzystaj z zaawansowanych funkcji**, takich jak dynamiczne wykrywanie i przełączanie locale.
|
|
64
|
+
|
|
65
|
+
> Intlayer jest kompatybilny z Next.js 12, 13, 14 i 16. Jeśli używasz Page Router w Next.js, możesz odnieść się do tego [poradnika](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_nextjs_page_router.md). Dla Next.js 12, 13, 14 z App Router odnieś się do tego [poradnika](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_nextjs_14.md).
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Krok po kroku: konfiguracja Intlayer w aplikacji Next.js
|
|
70
|
+
|
|
71
|
+
### Krok 1: Zainstaluj zależności
|
|
72
|
+
|
|
73
|
+
Zainstaluj niezbędne pakiety używając npm:
|
|
74
|
+
|
|
75
|
+
```bash packageManager="npm"
|
|
76
|
+
npm install intlayer next-intlayer
|
|
77
|
+
npx intlayer init
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash packageManager="pnpm"
|
|
81
|
+
pnpm add intlayer next-intlayer
|
|
82
|
+
pnpm intlayer init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```bash packageManager="yarn"
|
|
86
|
+
yarn add intlayer next-intlayer
|
|
87
|
+
yarn intlayer init
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```bash packageManager="bun"
|
|
91
|
+
bun add intlayer next-intlayer
|
|
92
|
+
bunx intlayer init
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **intlayer**
|
|
96
|
+
|
|
97
|
+
Pakiet rdzeniowy, który dostarcza narzędzia do internacjonalizacji do zarządzania konfiguracją, tłumaczeń, [deklaracji treści](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/dictionary/content_file.md), transpilacji oraz [poleceń CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/cli/index.md).
|
|
98
|
+
|
|
99
|
+
- **next-intlayer**
|
|
100
|
+
|
|
101
|
+
Pakiet integrujący Intlayer z Next.js. Zapewnia context providers i hooki do internacjonalizacji w Next.js. Dodatkowo zawiera plugin Next.js do integracji Intlayer z [Webpack](https://webpack.js.org/) lub [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack), a także proxy do wykrywania preferowanej lokalizacji użytkownika, zarządzania cookie i obsługi przekierowań URL.
|
|
102
|
+
|
|
103
|
+
### Krok 2: Skonfiguruj swój projekt
|
|
104
|
+
|
|
105
|
+
Oto końcowa struktura, którą utworzymy:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
.
|
|
109
|
+
├── src
|
|
110
|
+
│ ├── app
|
|
111
|
+
│ │ ├── layout.tsx
|
|
112
|
+
│ │ ├── page.content.ts
|
|
113
|
+
│ │ └── page.tsx
|
|
114
|
+
│ ├── components
|
|
115
|
+
│ │ ├── clientComponentExample
|
|
116
|
+
│ │ │ ├── client-component-example.content.ts
|
|
117
|
+
│ │ │ └── ClientComponentExample.tsx
|
|
118
|
+
│ │ ├── localeSwitcher
|
|
119
|
+
│ │ │ ├── localeSwitcher.content.ts
|
|
120
|
+
│ │ │ └── LocaleSwitcher.tsx
|
|
121
|
+
│ │ └── serverComponentExample
|
|
122
|
+
│ │ ├── server-component-example.content.ts
|
|
123
|
+
│ │ └── ServerComponentExample.tsx
|
|
124
|
+
│ └── proxy.ts
|
|
125
|
+
├── intlayer.config.ts
|
|
126
|
+
├── next.config.ts
|
|
127
|
+
├── package.json
|
|
128
|
+
└── tsconfig.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
> Jeśli nie chcesz routingu lokalizacji, intlayer może być użyty jako prosty provider / hook. Zobacz [ten przewodnik](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_nextjs_no_locale_path.md), aby uzyskać więcej informacji.
|
|
132
|
+
|
|
133
|
+
Create a config file to configure the languages of your application:
|
|
134
|
+
|
|
135
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
136
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
137
|
+
|
|
138
|
+
const config: IntlayerConfig = {
|
|
139
|
+
internationalization: {
|
|
140
|
+
locales: [
|
|
141
|
+
Locales.ENGLISH,
|
|
142
|
+
Locales.FRENCH,
|
|
143
|
+
Locales.SPANISH,
|
|
144
|
+
// Twoje pozostałe locales
|
|
145
|
+
],
|
|
146
|
+
defaultLocale: Locales.ENGLISH,
|
|
147
|
+
},
|
|
148
|
+
routing: {
|
|
149
|
+
mode: "search-params", // lub `no-prefix` - Przydatne do wykrywania w middleware
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export default config;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
157
|
+
import { Locales } from "intlayer";
|
|
158
|
+
|
|
159
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
160
|
+
const config = {
|
|
161
|
+
internationalization: {
|
|
162
|
+
locales: [
|
|
163
|
+
Locales.ENGLISH,
|
|
164
|
+
Locales.FRENCH,
|
|
165
|
+
Locales.SPANISH,
|
|
166
|
+
// Twoje pozostałe locales
|
|
167
|
+
],
|
|
168
|
+
defaultLocale: Locales.ENGLISH,
|
|
169
|
+
},
|
|
170
|
+
routing: {
|
|
171
|
+
mode: "search-params", // lub `no-prefix` - Przydatne do wykrywania w middleware
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export default config;
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
179
|
+
const { Locales } = require("intlayer");
|
|
180
|
+
|
|
181
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
182
|
+
const config = {
|
|
183
|
+
internationalization: {
|
|
184
|
+
locales: [
|
|
185
|
+
Locales.ENGLISH,
|
|
186
|
+
Locales.FRENCH,
|
|
187
|
+
Locales.SPANISH,
|
|
188
|
+
// Twoje inne locales
|
|
189
|
+
],
|
|
190
|
+
defaultLocale: Locales.ENGLISH,
|
|
191
|
+
},
|
|
192
|
+
routing: {
|
|
193
|
+
mode: "search-params", // lub `no-prefix` - Przydatne do wykrywania w middleware
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
module.exports = config;
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
> Poprzez ten plik konfiguracyjny możesz ustawić lokalizowane adresy URL, przekierowania proxy, nazwy ciasteczek, lokalizację i rozszerzenie deklaracji treści, wyłączyć logi Intlayer w konsoli i inne. Aby uzyskać pełną listę dostępnych parametrów, zapoznaj się z [dokumentacją konfiguracji](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/configuration.md).
|
|
201
|
+
|
|
202
|
+
### Krok 3: Integracja Intlayer z konfiguracją Next.js
|
|
203
|
+
|
|
204
|
+
Skonfiguruj swoje środowisko Next.js, aby używało Intlayer:
|
|
205
|
+
|
|
206
|
+
```typescript fileName="next.config.ts" codeFormat="typescript"
|
|
207
|
+
import type { NextConfig } from "next";
|
|
208
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
209
|
+
|
|
210
|
+
const nextConfig: NextConfig = {
|
|
211
|
+
/* opcje konfiguracji tutaj */
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export default withIntlayer(nextConfig);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
```typescript fileName="next.config.mjs" codeFormat="esm"
|
|
218
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
219
|
+
|
|
220
|
+
/** @type {import('next').NextConfig} */
|
|
221
|
+
const nextConfig = {
|
|
222
|
+
/* opcje konfiguracyjne tutaj */
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export default withIntlayer(nextConfig);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```typescript fileName="next.config.cjs" codeFormat="commonjs"
|
|
229
|
+
const { withIntlayer } = require("next-intlayer/server");
|
|
230
|
+
|
|
231
|
+
/** @type {import('next').NextConfig} */
|
|
232
|
+
const nextConfig = {
|
|
233
|
+
/* opcje konfiguracyjne tutaj */
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
module.exports = withIntlayer(nextConfig);
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
> Wtyczka Next.js `withIntlayer()` służy do integracji Intlayer z Next.js. Zapewnia budowanie plików deklaracji treści i 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 udostępnia aliasy w celu optymalizacji wydajności i zapewnia kompatybilność z komponentami po stronie serwera.
|
|
240
|
+
|
|
241
|
+
> Funkcja `withIntlayer()` jest funkcją zwracającą Promise. Pozwala przygotować słowniki Intlayer przed rozpoczęciem procesu build. Jeśli chcesz użyć jej razem z innymi wtyczkami, możesz użyć `await`. Przykład:
|
|
242
|
+
>
|
|
243
|
+
> ```ts
|
|
244
|
+
> const nextConfig = await withIntlayer(nextConfig);
|
|
245
|
+
> const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
|
|
246
|
+
>
|
|
247
|
+
> export default nextConfigWithOtherPlugins;
|
|
248
|
+
> ```
|
|
249
|
+
>
|
|
250
|
+
> Jeśli chcesz użyć go synchronicznie, możesz skorzystać z funkcji `withIntlayerSync()`. Przykład:
|
|
251
|
+
>
|
|
252
|
+
> ```ts
|
|
253
|
+
> const nextConfig = withIntlayerSync(nextConfig);
|
|
254
|
+
> const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
|
|
255
|
+
>
|
|
256
|
+
> export default nextConfigWithOtherPlugins;
|
|
257
|
+
> ```
|
|
258
|
+
>
|
|
259
|
+
> Intlayer automatycznie wykrywa, czy Twój projekt używa **webpack** czy **Turbopack**, na podstawie flag wiersza poleceń `--webpack`, `--turbo` lub `--turbopack`, oraz Twojej obecnej wersji **Next.js**.
|
|
260
|
+
>
|
|
261
|
+
> Ponieważ `next>=16`, jeśli używasz **Rspack**, musisz wyraźnie wymusić użycie konfiguracji webpack przez Intlayer, wyłączając Turbopack:
|
|
262
|
+
>
|
|
263
|
+
> ```ts
|
|
264
|
+
> withRspack(withIntlayer(nextConfig, { enableTurbopack: false }));
|
|
265
|
+
> ```
|
|
266
|
+
|
|
267
|
+
### Krok 4: Zdefiniuj dynamiczne trasy lokalizacji
|
|
268
|
+
|
|
269
|
+
Usuń całą zawartość `RootLayout` i zastąp ją następującym kodem:
|
|
270
|
+
|
|
271
|
+
```tsx {3} fileName="src/app/layout.tsx" codeFormat="typescript"
|
|
272
|
+
import type { Metadata } from "next";
|
|
273
|
+
import type { ReactNode } from "react";
|
|
274
|
+
import "./globals.css";
|
|
275
|
+
import { IntlayerClientProvider, LocalPromiseParams } from "next-intlayer";
|
|
276
|
+
import { getHTMLTextDir, getIntlayer } from "intlayer";
|
|
277
|
+
import { getLocale } from "next-intlayer/server";
|
|
278
|
+
export { generateStaticParams } from "next-intlayer";
|
|
279
|
+
|
|
280
|
+
export const generateMetadata = async ({
|
|
281
|
+
params,
|
|
282
|
+
}: LocalPromiseParams): Promise<Metadata> => {
|
|
283
|
+
const { locale } = await params;
|
|
284
|
+
const { title, description, keywords } = getIntlayer("metadata", locale);
|
|
285
|
+
|
|
286
|
+
return {
|
|
287
|
+
title,
|
|
288
|
+
description,
|
|
289
|
+
keywords,
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const RootLayout = async ({
|
|
294
|
+
children,
|
|
295
|
+
}: Readonly<{
|
|
296
|
+
children: ReactNode;
|
|
297
|
+
}>) => {
|
|
298
|
+
const locale = await getLocale();
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
302
|
+
<IntlayerClientProvider defaultLocale={locale}>
|
|
303
|
+
<body>{children}</body>
|
|
304
|
+
</IntlayerClientProvider>
|
|
305
|
+
</html>
|
|
306
|
+
);
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export default RootLayout;
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
```jsx {3} fileName="src/app/layout.mjx" codeFormat="esm"
|
|
313
|
+
import "./globals.css";
|
|
314
|
+
import { IntlayerClientProvider } from "next-intlayer";
|
|
315
|
+
import { getHTMLTextDir, getIntlayer } from "intlayer";
|
|
316
|
+
import { getLocale } from "next-intlayer/server";
|
|
317
|
+
export { generateStaticParams } from "next-intlayer";
|
|
318
|
+
|
|
319
|
+
export const generateMetadata = async ({ params }) => {
|
|
320
|
+
const { locale } = await params;
|
|
321
|
+
const { title, description, keywords } = getIntlayer("metadata", locale);
|
|
322
|
+
|
|
323
|
+
return {
|
|
324
|
+
title,
|
|
325
|
+
description,
|
|
326
|
+
keywords,
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const RootLayout = async ({ children }) => {
|
|
331
|
+
const locale = await getLocale();
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
335
|
+
<IntlayerClientProvider defaultLocale={locale}>
|
|
336
|
+
<body>{children}</body>
|
|
337
|
+
</IntlayerClientProvider>
|
|
338
|
+
</html>
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export default RootLayout;
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```jsx {1,8} fileName="src/app/layout.csx" codeFormat="commonjs"
|
|
346
|
+
require("./globals.css");
|
|
347
|
+
const { IntlayerClientProvider } = require("next-intlayer");
|
|
348
|
+
const { getHTMLTextDir, getIntlayer } = require("intlayer");
|
|
349
|
+
const { getLocale } = require("next-intlayer/server");
|
|
350
|
+
const { generateStaticParams } = require("next-intlayer");
|
|
351
|
+
|
|
352
|
+
const generateMetadata = async ({ params }) => {
|
|
353
|
+
const { locale } = await params;
|
|
354
|
+
const { title, description, keywords } = getIntlayer("metadata", locale);
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
title,
|
|
358
|
+
description,
|
|
359
|
+
keywords,
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const RootLayout = async ({ children }) => {
|
|
364
|
+
const locale = await getLocale();
|
|
365
|
+
|
|
366
|
+
return (
|
|
367
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
368
|
+
<IntlayerClientProvider defaultLocale={locale}>
|
|
369
|
+
<body>{children}</body>
|
|
370
|
+
</IntlayerClientProvider>
|
|
371
|
+
</html>
|
|
372
|
+
);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
module.exports = {
|
|
376
|
+
default: RootLayout,
|
|
377
|
+
generateStaticParams,
|
|
378
|
+
generateMetadata,
|
|
379
|
+
};
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Krok 5: Zadeklaruj swoje treści
|
|
383
|
+
|
|
384
|
+
Utwórz i zarządzaj deklaracjami treści, aby przechowywać tłumaczenia:
|
|
385
|
+
|
|
386
|
+
```tsx fileName="src/app/metadata.content.ts" contentDeclarationFormat="typescript"
|
|
387
|
+
import { t, type Dictionary } from "intlayer";
|
|
388
|
+
import { Metadata } from "next";
|
|
389
|
+
|
|
390
|
+
const metadataContent = {
|
|
391
|
+
key: "metadata",
|
|
392
|
+
content: {
|
|
393
|
+
title: t({
|
|
394
|
+
pl: "Tytuł mojego projektu",
|
|
395
|
+
en: "My Project Title",
|
|
396
|
+
fr: "Le Titre de mon Projet",
|
|
397
|
+
es: "El Título de mi Proyecto",
|
|
398
|
+
}),
|
|
399
|
+
|
|
400
|
+
description: t({
|
|
401
|
+
pl: "Poznaj naszą innowacyjną platformę zaprojektowaną, aby usprawnić przepływ pracy i zwiększyć produktywność.",
|
|
402
|
+
en: "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
403
|
+
fr: "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
404
|
+
es: "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad.",
|
|
405
|
+
}),
|
|
406
|
+
|
|
407
|
+
keywords: t({
|
|
408
|
+
pl: ["innowacja", "produktywność", "przepływ pracy", "SaaS"],
|
|
409
|
+
en: ["innovation", "productivity", "workflow", "SaaS"],
|
|
410
|
+
pl: ["innowacja", "produktywność", "przepływ pracy", "SaaS"],
|
|
411
|
+
fr: ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
412
|
+
es: ["innovación", "productividad", "flujo de trabajo", "SaaS"],
|
|
413
|
+
}),
|
|
414
|
+
},
|
|
415
|
+
} as Dictionary<Metadata>;
|
|
416
|
+
|
|
417
|
+
export default metadataContent;
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
```tsx fileName="src/app/metadata.content.mjs" contentDeclarationFormat="typescript"
|
|
421
|
+
import { t, type Dictionary } from "intlayer";
|
|
422
|
+
|
|
423
|
+
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
424
|
+
const metadataContent = {
|
|
425
|
+
key: "metadata",
|
|
426
|
+
content: {
|
|
427
|
+
title: t({
|
|
428
|
+
pl: "Tytuł mojego projektu",
|
|
429
|
+
en: "My Project Title",
|
|
430
|
+
fr: "Le Titre de mon Projet",
|
|
431
|
+
es: "El Título de mi Proyecto",
|
|
432
|
+
}),
|
|
433
|
+
|
|
434
|
+
description: t({
|
|
435
|
+
pl: "Odkryj naszą innowacyjną platformę zaprojektowaną, aby usprawnić przepływ pracy i zwiększyć produktywność.",
|
|
436
|
+
en: "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
437
|
+
pl: "Odkryj naszą innowacyjną platformę stworzoną, aby uprościć przepływ pracy i zwiększyć produktywność.",
|
|
438
|
+
fr: "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
439
|
+
es: "Descubra su plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad.",
|
|
440
|
+
}),
|
|
441
|
+
|
|
442
|
+
keywords: t({
|
|
443
|
+
pl: ["innowacja", "produktywność", "przepływ pracy", "SaaS"],
|
|
444
|
+
en: ["innovation", "productivity", "workflow", "SaaS"],
|
|
445
|
+
fr: ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
446
|
+
es: ["innovación", "productividad", "flujo de trabajo", "SaaS"],
|
|
447
|
+
}),
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
export default metadataContent;
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
```javascript fileName="src/app/metadata.content.cjs" contentDeclarationFormat="commonjs"
|
|
455
|
+
const { t } = require("intlayer");
|
|
456
|
+
|
|
457
|
+
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
458
|
+
const metadataContent = {
|
|
459
|
+
key: "metadata",
|
|
460
|
+
content: {
|
|
461
|
+
title: t({
|
|
462
|
+
pl: "Tytuł mojego projektu",
|
|
463
|
+
en: "My Project Title",
|
|
464
|
+
fr: "Le Titre de mon Projet",
|
|
465
|
+
es: "El Título de mi Proyecto",
|
|
466
|
+
}),
|
|
467
|
+
|
|
468
|
+
description: t({
|
|
469
|
+
pl: "Odkryj naszą innowacyjną platformę stworzoną, aby usprawnić Twój workflow i zwiększyć produktywność.",
|
|
470
|
+
en: "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
471
|
+
fr: "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
472
|
+
es: "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad.",
|
|
473
|
+
}),
|
|
474
|
+
|
|
475
|
+
keywords: t({
|
|
476
|
+
pl: ["innowacja", "produktywność", "przepływ pracy", "SaaS"],
|
|
477
|
+
en: ["innovation", "productivity", "workflow", "SaaS"],
|
|
478
|
+
fr: ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
479
|
+
es: ["innovación", "productividad", "flujo de trabajo", "SaaS"],
|
|
480
|
+
}),
|
|
481
|
+
},
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
module.exports = metadataContent;
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
```json fileName="src/app/metadata.content.json" contentDeclarationFormat="json"
|
|
488
|
+
{
|
|
489
|
+
"key": "metadata",
|
|
490
|
+
"content": {
|
|
491
|
+
"title": {
|
|
492
|
+
"nodeType": "translation",
|
|
493
|
+
"translation": {
|
|
494
|
+
"pl": "Tytuł mojego projektu",
|
|
495
|
+
"en": "My Project Title",
|
|
496
|
+
"fr": "Le Titre de mon Projet",
|
|
497
|
+
"es": "El Título de mi Proyecto"
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
"description": {
|
|
501
|
+
"nodeType": "translation",
|
|
502
|
+
"translation": {
|
|
503
|
+
"pl": "Odkryj naszą innowacyjną platformę zaprojektowaną, aby usprawnić twój workflow i zwiększyć produktywność.",
|
|
504
|
+
"en": "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
505
|
+
"fr": "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
506
|
+
"es": "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad."
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
"keywords": {
|
|
510
|
+
"nodeType": "translation",
|
|
511
|
+
"translation": {
|
|
512
|
+
"pl": ["innowacja", "produktywność", "przepływ pracy", "SaaS"],
|
|
513
|
+
"en": ["innovation", "productivity", "workflow", "SaaS"],
|
|
514
|
+
"fr": ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
515
|
+
"es": ["innovación", "productividad", "flujo de trabajo", "SaaS"]
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
```tsx fileName="src/app/page.content.ts" contentDeclarationFormat="typescript"
|
|
523
|
+
import { t, type Dictionary } from "intlayer";
|
|
524
|
+
|
|
525
|
+
const pageContent = {
|
|
526
|
+
key: "page",
|
|
527
|
+
content: {
|
|
528
|
+
getStarted: {
|
|
529
|
+
main: t({
|
|
530
|
+
pl: "Zacznij od edycji",
|
|
531
|
+
en: "Get started by editing",
|
|
532
|
+
fr: "Commencez par éditer",
|
|
533
|
+
es: "Comience por editar",
|
|
534
|
+
}),
|
|
535
|
+
pageLink: "src/app/page.tsx",
|
|
536
|
+
},
|
|
537
|
+
},
|
|
538
|
+
} satisfies Dictionary;
|
|
539
|
+
|
|
540
|
+
export default pageContent;
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
```javascript fileName="src/app/page.content.mjs" contentDeclarationFormat="esm"
|
|
544
|
+
import { t } from "intlayer";
|
|
545
|
+
|
|
546
|
+
/** @type {import('intlayer').Dictionary} */
|
|
547
|
+
const pageContent = {
|
|
548
|
+
key: "page",
|
|
549
|
+
content: {
|
|
550
|
+
getStarted: {
|
|
551
|
+
main: t({
|
|
552
|
+
pl: "Zacznij od edycji",
|
|
553
|
+
en: "Get started by editing",
|
|
554
|
+
fr: "Commencez par éditer",
|
|
555
|
+
es: "Comience por editar",
|
|
556
|
+
}),
|
|
557
|
+
pageLink: "src/app/page.tsx",
|
|
558
|
+
},
|
|
559
|
+
},
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
export default pageContent;
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
```javascript fileName="src/app/page.content.cjs" contentDeclarationFormat="commonjs"
|
|
566
|
+
const { t } = require("intlayer");
|
|
567
|
+
|
|
568
|
+
/** @type {import('intlayer').Dictionary} */
|
|
569
|
+
const pageContent = {
|
|
570
|
+
key: "page",
|
|
571
|
+
content: {
|
|
572
|
+
getStarted: {
|
|
573
|
+
main: t({
|
|
574
|
+
pl: "Zacznij od edycji",
|
|
575
|
+
en: "Get started by editing",
|
|
576
|
+
fr: "Commencez par éditer",
|
|
577
|
+
pl: "Zacznij od edycji",
|
|
578
|
+
es: "Comience por editar",
|
|
579
|
+
}),
|
|
580
|
+
pageLink: "src/app/page.tsx",
|
|
581
|
+
},
|
|
582
|
+
},
|
|
583
|
+
};
|
|
584
|
+
|
|
585
|
+
module.exports = pageContent;
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
```json fileName="src/app/page.content.json" contentDeclarationFormat="json"
|
|
589
|
+
{
|
|
590
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
591
|
+
"key": "page",
|
|
592
|
+
"content": {
|
|
593
|
+
"getStarted": {
|
|
594
|
+
"nodeType": "translation",
|
|
595
|
+
"translation": {
|
|
596
|
+
"pl": "Zacznij od edycji",
|
|
597
|
+
"en": "Get started by editing",
|
|
598
|
+
"fr": "Commencez par éditer",
|
|
599
|
+
"es": "Comience por editar"
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
"pageLink": "src/app/page.tsx"
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
> Twoje deklaracje zawartości mogą być zdefiniowane w dowolnym miejscu aplikacji, pod warunkiem że zostaną umieszczone w katalogu `contentDir` (domyślnie `./src`) i mają odpowiednie rozszerzenie pliku deklaracji zawartości (domyślnie `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
608
|
+
|
|
609
|
+
> Po więcej informacji odwołaj się do [dokumentacji pliku deklaracji zawartości](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/dictionary/content_file.md).
|
|
610
|
+
|
|
611
|
+
### Krok 6: Wykorzystanie zawartości w kodzie
|
|
612
|
+
|
|
613
|
+
Uzyskaj dostęp do swoich słowników zawartości w całej aplikacji:
|
|
614
|
+
|
|
615
|
+
```tsx fileName="src/app/page.tsx" codeFormat="typescript"
|
|
616
|
+
import type { FC } from "react";
|
|
617
|
+
import { ClientComponentExample } from "@components/clientComponentExample/ClientComponentExample";
|
|
618
|
+
import { ServerComponentExample } from "@components/serverComponentExample/ServerComponentExample";
|
|
619
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
620
|
+
import { NextPage } from "next";
|
|
621
|
+
import { getLocale } from "next-intlayer/server";
|
|
622
|
+
import { headers, cookies } from "next/headers";
|
|
623
|
+
|
|
624
|
+
const PageContent: FC = () => {
|
|
625
|
+
const content = useIntlayer("page");
|
|
626
|
+
|
|
627
|
+
return (
|
|
628
|
+
<>
|
|
629
|
+
<p>{content.getStarted.main}</p>
|
|
630
|
+
<code>{content.getStarted.pageLink}</code>
|
|
631
|
+
</>
|
|
632
|
+
);
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
const Page: NextPage = async () => {
|
|
636
|
+
const locale = await getLocale();
|
|
637
|
+
|
|
638
|
+
return (
|
|
639
|
+
<IntlayerServerProvider locale={locale}>
|
|
640
|
+
<PageContent />
|
|
641
|
+
<ServerComponentExample />
|
|
642
|
+
<ClientComponentExample />
|
|
643
|
+
</IntlayerServerProvider>
|
|
644
|
+
);
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
export default Page;
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
```jsx fileName="src/app/page.mjx" codeFormat="esm"
|
|
651
|
+
import { ClientComponentExample } from "@components/clientComponentExample/ClientComponentExample";
|
|
652
|
+
import { ServerComponentExample } from "@components/serverComponentExample/ServerComponentExample";
|
|
653
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
654
|
+
import { getLocale } from "intlayer";
|
|
655
|
+
import { headers, cookies } from "next/headers";
|
|
656
|
+
import { NextPage } from "next";
|
|
657
|
+
|
|
658
|
+
const Page: NextPage = async () => {
|
|
659
|
+
const content = useIntlayer("page");
|
|
660
|
+
|
|
661
|
+
return (
|
|
662
|
+
<>
|
|
663
|
+
<p>{content.getStarted.main}</p>
|
|
664
|
+
<code>{content.getStarted.pageLink}</code>
|
|
665
|
+
</>
|
|
666
|
+
);
|
|
667
|
+
};
|
|
668
|
+
|
|
669
|
+
const Page = async () => {
|
|
670
|
+
|
|
671
|
+
const locale = await getLocale();
|
|
672
|
+
|
|
673
|
+
return (
|
|
674
|
+
<IntlayerServerProvider locale={locale}>
|
|
675
|
+
<PageContent />
|
|
676
|
+
<ServerComponentExample />
|
|
677
|
+
<ClientComponentExample />
|
|
678
|
+
</IntlayerServerProvider>
|
|
679
|
+
);
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
export default Page;
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
```jsx fileName="src/app/page.csx" codeFormat="commonjs"
|
|
686
|
+
import { ClientComponentExample } from "@components/clientComponentExample/ClientComponentExample";
|
|
687
|
+
import { ServerComponentExample } from "@components/serverComponentExample/ServerComponentExample";
|
|
688
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
689
|
+
import { NextPage } from "next";
|
|
690
|
+
import { getLocale } from "next-intlayer/server";
|
|
691
|
+
import { headers, cookies } from "next/headers";
|
|
692
|
+
|
|
693
|
+
const Page: NextPage = async () => {
|
|
694
|
+
const content = useIntlayer("page");
|
|
695
|
+
|
|
696
|
+
return (
|
|
697
|
+
<>
|
|
698
|
+
<p>{content.getStarted.main}</p>
|
|
699
|
+
<code>{content.getStarted.pageLink}</code>
|
|
700
|
+
</>
|
|
701
|
+
);
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
const Page: NextPage = async () => {
|
|
705
|
+
const locale = await getLocale();
|
|
706
|
+
|
|
707
|
+
return (
|
|
708
|
+
<IntlayerServerProvider locale={locale}>
|
|
709
|
+
<PageContent />
|
|
710
|
+
<ServerComponentExample />
|
|
711
|
+
<ClientComponentExample />
|
|
712
|
+
</IntlayerServerProvider>
|
|
713
|
+
);
|
|
714
|
+
};
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
- **`IntlayerClientProvider`** służy do dostarczania locale komponentom po stronie klienta. Można go umieścić w dowolnym komponencie nadrzędnym, w tym w layout. Jednak zaleca się umieszczenie go w layout, ponieważ Next.js współdzieli kod layoutu między stronami, co jest bardziej wydajne. Używając `IntlayerClientProvider` w layout, unikasz ponownej inicjalizacji dla każdej strony, poprawiając wydajność i utrzymując spójny kontekst lokalizacji w całej aplikacji.
|
|
718
|
+
- **`IntlayerServerProvider`** jest używany do dostarczania locale dzieciom po stronie serwera. Nie można go umieścić w layoucie.
|
|
719
|
+
|
|
720
|
+
> Layout i page nie mogą współdzielić wspólnego kontekstu serwera, ponieważ system kontekstu serwera opiera się na magazynie danych dla każdego żądania (poprzez mechanizm [React's cache](https://react.dev/reference/react/cache)), powodując, że każdy "kontekst" jest tworzony na nowo dla różnych segmentów aplikacji. Umieszczenie providera we wspólnym layoucie złamałoby tę izolację, uniemożliwiając poprawne propagowanie wartości kontekstu serwera do twoich komponentów serwerowych.
|
|
721
|
+
|
|
722
|
+
```tsx {4,7} fileName="src/components/clientComponentExample/ClientComponentExample.tsx" codeFormat="typescript"
|
|
723
|
+
"use client";
|
|
724
|
+
|
|
725
|
+
import type { FC } from "react";
|
|
726
|
+
import { useIntlayer } from "next-intlayer";
|
|
727
|
+
|
|
728
|
+
export const ClientComponentExample: FC = () => {
|
|
729
|
+
const content = useIntlayer("client-component-example"); // Utwórz deklarację powiązanej treści
|
|
730
|
+
|
|
731
|
+
return (
|
|
732
|
+
<div>
|
|
733
|
+
<h2>{content.title}</h2>
|
|
734
|
+
<p>{content.content}</p>
|
|
735
|
+
</div>
|
|
736
|
+
);
|
|
737
|
+
};
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
```jsx {3,6} fileName="src/components/clientComponentExample/ClientComponentExample.mjx" codeFormat="esm"
|
|
741
|
+
"use client";
|
|
742
|
+
|
|
743
|
+
import { useIntlayer } from "next-intlayer";
|
|
744
|
+
|
|
745
|
+
const ClientComponentExample = () => {
|
|
746
|
+
const content = useIntlayer("client-component-example"); // Utwórz deklarację powiązanej treści
|
|
747
|
+
|
|
748
|
+
return (
|
|
749
|
+
<div>
|
|
750
|
+
<h2>{content.title}</h2>
|
|
751
|
+
<p>{content.content}</p>
|
|
752
|
+
</div>
|
|
753
|
+
);
|
|
754
|
+
};
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
```jsx {3,6} fileName="src/components/clientComponentExample/ClientComponentExample.csx" codeFormat="commonjs"
|
|
758
|
+
"use client";
|
|
759
|
+
|
|
760
|
+
const { useIntlayer } = require("next-intlayer");
|
|
761
|
+
|
|
762
|
+
const ClientComponentExample = () => {
|
|
763
|
+
const content = useIntlayer("client-component-example"); // Utwórz deklarację powiązanej zawartości
|
|
764
|
+
|
|
765
|
+
return (
|
|
766
|
+
<div>
|
|
767
|
+
<h2>{content.title}</h2>
|
|
768
|
+
<p>{content.content}</p>
|
|
769
|
+
</div>
|
|
770
|
+
);
|
|
771
|
+
};
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
```tsx {2} fileName="src/components/serverComponentExample/ServerComponentExample.tsx" codeFormat="typescript"
|
|
775
|
+
import type { FC } from "react";
|
|
776
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
777
|
+
|
|
778
|
+
export const ServerComponentExample: FC = () => {
|
|
779
|
+
const content = useIntlayer("server-component-example"); // Utwórz deklarację powiązanej zawartości
|
|
780
|
+
|
|
781
|
+
return (
|
|
782
|
+
<div>
|
|
783
|
+
<h2>{content.title}</h2>
|
|
784
|
+
<p>{content.content}</p>
|
|
785
|
+
</div>
|
|
786
|
+
);
|
|
787
|
+
};
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
```jsx {1} fileName="src/components/serverComponentExample/ServerComponentExample.mjx" codeFormat="esm"
|
|
791
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
792
|
+
|
|
793
|
+
const ServerComponentExample = () => {
|
|
794
|
+
const content = useIntlayer("server-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
795
|
+
|
|
796
|
+
return (
|
|
797
|
+
<div>
|
|
798
|
+
<h2>{content.title}</h2>
|
|
799
|
+
<p>{content.content}</p>
|
|
800
|
+
</div>
|
|
801
|
+
);
|
|
802
|
+
};
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
```jsx {1} fileName="src/components/serverComponentExample/ServerComponentExample.csx" codeFormat="commonjs"
|
|
806
|
+
const { useIntlayer } = require("next-intlayer/server");
|
|
807
|
+
|
|
808
|
+
const ServerComponentExample = () => {
|
|
809
|
+
const content = useIntlayer("server-component-example"); // Utwórz powiązaną deklarację zawartości
|
|
810
|
+
|
|
811
|
+
return (
|
|
812
|
+
<div>
|
|
813
|
+
<h2>{content.title}</h2>
|
|
814
|
+
<p>{content.content}</p>
|
|
815
|
+
</div>
|
|
816
|
+
);
|
|
817
|
+
};
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
> 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:
|
|
821
|
+
|
|
822
|
+
> ```jsx
|
|
823
|
+
> <img src={content.image.src.value} alt={content.image.value} />
|
|
824
|
+
> ```
|
|
825
|
+
|
|
826
|
+
> 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).
|
|
827
|
+
|
|
828
|
+
### (Opcjonalnie) Krok 7: Skonfiguruj proxy do wykrywania preferowanej lokalizacji użytkownika
|
|
829
|
+
|
|
830
|
+
Skonfiguruj proxy, aby wykrywało preferowaną lokalizację użytkownika:
|
|
831
|
+
|
|
832
|
+
```typescript fileName="src/proxy.ts" codeFormat="typescript"
|
|
833
|
+
export { intlayerProxy as proxy } from "next-intlayer/proxy";
|
|
834
|
+
|
|
835
|
+
export const config = {
|
|
836
|
+
matcher:
|
|
837
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
838
|
+
};
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
```javascript fileName="src/proxy.mjs" codeFormat="esm"
|
|
842
|
+
export { intlayerProxy as proxy } from "next-intlayer/proxy";
|
|
843
|
+
|
|
844
|
+
export const config = {
|
|
845
|
+
matcher:
|
|
846
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
847
|
+
};
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
```javascript fileName="src/proxy.cjs" codeFormat="commonjs"
|
|
851
|
+
const { intlayerProxy } = require("next-intlayer/proxy");
|
|
852
|
+
|
|
853
|
+
const config = {
|
|
854
|
+
matcher:
|
|
855
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
module.exports = { proxy: intlayerProxy, config };
|
|
859
|
+
```
|
|
860
|
+
|
|
861
|
+
> `intlayerProxy` jest używany do wykrywania preferowanego języka użytkownika i przekierowywania go na odpowiedni 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.
|
|
862
|
+
|
|
863
|
+
> Jeśli potrzebujesz łączyć kilka proxy razem (na przykład `intlayerProxy` z uwierzytelnianiem lub niestandardowymi proxy), Intlayer udostępnia teraz helper o nazwie `multipleProxies`.
|
|
864
|
+
|
|
865
|
+
```ts
|
|
866
|
+
import { multipleProxies, intlayerProxy } from "next-intlayer/proxy";
|
|
867
|
+
import { customProxy } from "@utils/customProxy";
|
|
868
|
+
|
|
869
|
+
export const proxy = multipleProxies([intlayerProxy, customProxy]);
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
### (Opcjonalnie) Krok 8: Zmień język swojej zawartości
|
|
873
|
+
|
|
874
|
+
Aby zmienić język treści w Next.js, zalecanym sposobem jest użycie komponentu `Link` do przekierowania użytkowników na odpowiednio zlokalizowaną stronę. Komponent `Link` umożliwia prefetching, co pomaga uniknąć pełnego przeładowania strony.
|
|
875
|
+
|
|
876
|
+
```tsx fileName="src/components/localeSwitcher/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
877
|
+
"use client";
|
|
878
|
+
|
|
879
|
+
import type { FC } from "react";
|
|
880
|
+
import { Locales, getHTMLTextDir, getLocaleName } from "intlayer";
|
|
881
|
+
import { useLocale } from "next-intlayer";
|
|
882
|
+
|
|
883
|
+
export const LocaleSwitcher: FC = () => {
|
|
884
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
885
|
+
onChange: () => window.location.reload(),
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
return (
|
|
889
|
+
<div>
|
|
890
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
891
|
+
<div id="localePopover" popover="auto">
|
|
892
|
+
{availableLocales.map((localeItem) => (
|
|
893
|
+
<button
|
|
894
|
+
key={localeItem}
|
|
895
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
896
|
+
onClick={() => setLocale(localeItem)}
|
|
897
|
+
>
|
|
898
|
+
<span>
|
|
899
|
+
{/* Skrót lokalizacji — np. FR */}
|
|
900
|
+
{localeItem}
|
|
901
|
+
</span>
|
|
902
|
+
<span>
|
|
903
|
+
{/* Nazwa języka w jego własnym locale — np. Français */}
|
|
904
|
+
{getLocaleName(localeItem, locale)}
|
|
905
|
+
</span>
|
|
906
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
907
|
+
{/* Nazwa języka w bieżącym locale — np. "Francés" jeśli bieżące locale to Locales.SPANISH */}
|
|
908
|
+
{getLocaleName(localeItem)}
|
|
909
|
+
</span>
|
|
910
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
911
|
+
{/* Język w wersji angielskiej — np. French */}
|
|
912
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
913
|
+
</span>
|
|
914
|
+
</button>
|
|
915
|
+
))}
|
|
916
|
+
</div>
|
|
917
|
+
</div>
|
|
918
|
+
);
|
|
919
|
+
};
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
```jsx fileName="src/components/localeSwitcher/LocaleSwitcher.msx" codeFormat="esm"
|
|
923
|
+
"use client";
|
|
924
|
+
|
|
925
|
+
import { Locales, getHTMLTextDir, getLocaleName } from "intlayer";
|
|
926
|
+
import { useLocale } from "next-intlayer";
|
|
927
|
+
|
|
928
|
+
export const LocaleSwitcher = () => {
|
|
929
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
930
|
+
onChange: () => window.location.reload(),
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
return (
|
|
934
|
+
<div>
|
|
935
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
936
|
+
<div id="localePopover" popover="auto">
|
|
937
|
+
{availableLocales.map((localeItem) => (
|
|
938
|
+
<button
|
|
939
|
+
key={localeItem}
|
|
940
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
941
|
+
onClick={() => setLocale(localeItem)}
|
|
942
|
+
>
|
|
943
|
+
<span>
|
|
944
|
+
{/* Locale - np. FR */}
|
|
945
|
+
{localeItem}
|
|
946
|
+
</span>
|
|
947
|
+
<span>
|
|
948
|
+
{/* Nazwa języka w jego własnym locale - np. Français */}
|
|
949
|
+
{getLocaleName(localeItem, locale)}
|
|
950
|
+
</span>
|
|
951
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
952
|
+
{/* Nazwa języka w bieżącym locale - np. Francés gdy bieżące locale ustawione na Locales.SPANISH */}
|
|
953
|
+
{getLocaleName(localeItem)}
|
|
954
|
+
</span>
|
|
955
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
956
|
+
{/* Nazwa języka po angielsku - np. French */}
|
|
957
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
958
|
+
</span>
|
|
959
|
+
</button>
|
|
960
|
+
))}
|
|
961
|
+
</div>
|
|
962
|
+
</div>
|
|
963
|
+
);
|
|
964
|
+
};
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
```jsx fileName="src/components/localeSwitcher/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
968
|
+
"use client";
|
|
969
|
+
|
|
970
|
+
const { Locales, getHTMLTextDir, getLocaleName } = require("intlayer");
|
|
971
|
+
const { useLocale } = require("next-intlayer");
|
|
972
|
+
|
|
973
|
+
export const LocaleSwitcher = () => {
|
|
974
|
+
const path
|
|
975
|
+
const { locale availableLocales, setLocale } = useLocale({
|
|
976
|
+
onChange: ()=> window.location.reload(),
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
return (
|
|
980
|
+
<div>
|
|
981
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
982
|
+
<div id="localePopover" popover="auto">
|
|
983
|
+
{availableLocales.map((localeItem) => (
|
|
984
|
+
<button
|
|
985
|
+
key={localeItem}
|
|
986
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
987
|
+
onClick={() => setLocale(localeItem)}
|
|
988
|
+
>
|
|
989
|
+
<span>
|
|
990
|
+
{/* Locale - np. FR */}
|
|
991
|
+
{localeItem}
|
|
992
|
+
</span>
|
|
993
|
+
<span>
|
|
994
|
+
{/* Nazwa języka w jego własnym locale - np. Français */}
|
|
995
|
+
{getLocaleName(localeItem, locale)}
|
|
996
|
+
</span>
|
|
997
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
998
|
+
{/* Nazwa języka w bieżącym locale - np. Francés, gdy bieżące locale ustawione na Locales.SPANISH */}
|
|
999
|
+
{getLocaleName(localeItem)}
|
|
1000
|
+
</span>
|
|
1001
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
1002
|
+
{/* Nazwa języka po angielsku - np. French */}
|
|
1003
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
1004
|
+
</span>
|
|
1005
|
+
</button>
|
|
1006
|
+
))}
|
|
1007
|
+
</div>
|
|
1008
|
+
</div>
|
|
1009
|
+
);
|
|
1010
|
+
};
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
> Alternatywnym sposobem jest użycie funkcji `setLocale` dostarczonej przez hook `useLocale`. Ta funkcja nie pozwala na prefetching strony. Zobacz dokumentację hooka [`useLocale`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/next-intlayer/useLocale.md) po więcej szczegółów.
|
|
1014
|
+
|
|
1015
|
+
> Odnośniki w dokumentacji:
|
|
1016
|
+
>
|
|
1017
|
+
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/next-intlayer/useLocale.md)
|
|
1018
|
+
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/next-intlayer/getLocaleName.md)
|
|
1019
|
+
> - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/next-intlayer/getLocalizedUrl.md)
|
|
1020
|
+
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/packages/intlayer/getHTMLTextDir.md)
|
|
1021
|
+
> - [`hrefLang` atrybut](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
|
|
1022
|
+
> - [`lang` atrybut](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
|
|
1023
|
+
> - [`dir` atrybut](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
|
|
1024
|
+
> - [`aria-current` atrybut](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
|
|
1025
|
+
|
|
1026
|
+
### (Opcjonalnie) Krok 9: Pobierz bieżący locale w Server Actions
|
|
1027
|
+
|
|
1028
|
+
Jeśli potrzebujesz aktywnego locale wewnątrz Server Action (np. do lokalizowania e-maili lub uruchamiania logiki zależnej od locale), wywołaj `getLocale` z `next-intlayer/server`:
|
|
1029
|
+
|
|
1030
|
+
```tsx fileName="src/app/actions/getLocale.ts" codeFormat="typescript"
|
|
1031
|
+
"use server";
|
|
1032
|
+
|
|
1033
|
+
import { getLocale } from "next-intlayer/server";
|
|
1034
|
+
|
|
1035
|
+
export const myServerAction = async () => {
|
|
1036
|
+
const locale = await getLocale();
|
|
1037
|
+
|
|
1038
|
+
// Zrób coś z locale
|
|
1039
|
+
};
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
> Funkcja `getLocale` stosuje strategię kaskadową, aby określić locale użytkownika:
|
|
1043
|
+
>
|
|
1044
|
+
> 1. Najpierw sprawdza nagłówki żądania w poszukiwaniu wartości locale, która mogła zostać ustawiona przez proxy
|
|
1045
|
+
> 2. Jeśli w nagłówkach nie znaleziono locale, szuka wartości locale przechowywanej w cookies
|
|
1046
|
+
> 3. Jeśli nie znaleziono cookie, próbuje wykryć preferowany język użytkownika na podstawie ustawień przeglądarki
|
|
1047
|
+
> 4. W ostateczności używa domyślnego locale skonfigurowanego w aplikacji
|
|
1048
|
+
>
|
|
1049
|
+
> Zapewnia to wybór najbardziej odpowiedniej lokalizacji w oparciu na dostępnym kontekście.
|
|
1050
|
+
|
|
1051
|
+
### (Opcjonalnie) Krok 10: Optymalizacja rozmiaru bundla
|
|
1052
|
+
|
|
1053
|
+
Podczas używania `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. Dzięki temu słowniki są dołączane tylko do bundli stron, które faktycznie ich używają.
|
|
1054
|
+
|
|
1055
|
+
Aby włączyć tę optymalizację, zainstaluj pakiet `@intlayer/swc`. Po zainstalowaniu `next-intlayer` automatycznie wykryje i użyje pluginu:
|
|
1056
|
+
|
|
1057
|
+
```bash packageManager="npm"
|
|
1058
|
+
npm install @intlayer/swc --save-dev
|
|
1059
|
+
npx intlayer init
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
```bash packageManager="pnpm"
|
|
1063
|
+
pnpm add @intlayer/swc --save-dev
|
|
1064
|
+
pnpm intlayer init
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
```bash packageManager="yarn"
|
|
1068
|
+
yarn add @intlayer/swc --save-dev
|
|
1069
|
+
yarn intlayer init
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
```bash packageManager="bun"
|
|
1073
|
+
bun add @intlayer/swc --dev
|
|
1074
|
+
bunx intlayer init
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
> Uwaga: Ta optymalizacja jest dostępna tylko dla Next.js 13 i nowszych.
|
|
1078
|
+
|
|
1079
|
+
> Uwaga: Ten pakiet nie jest instalowany domyślnie, ponieważ wtyczki SWC są w Next.js wciąż eksperymentalne. Może to ulec zmianie w przyszłości.
|
|
1080
|
+
|
|
1081
|
+
> Uwaga: Jeśli ustawisz opcję na `importMode: 'dynamic'` lub `importMode: 'live'`, będzie to polegać na Suspense, więc będziesz musiał otoczyć wywołania `useIntlayer` granicą `Suspense`. To oznacza, że nie będziesz mógł używać `useIntlayer` bezpośrednio na najwyższym poziomie komponentu Page lub Layout.
|
|
1082
|
+
|
|
1083
|
+
### Monitorowanie zmian słowników w Turbopack
|
|
1084
|
+
|
|
1085
|
+
Jeśli używasz Turbopack jako serwera deweloperskiego z poleceniem `next dev`, zmiany w słownikach nie będą domyślnie wykrywane automatycznie.
|
|
1086
|
+
|
|
1087
|
+
To ograniczenie wynika z faktu, że Turbopack nie może uruchamiać wtyczek webpack równolegle w celu monitorowania zmian w plikach z treścią. Aby to obejść, musisz użyć polecenia `intlayer watch`, aby uruchomić jednocześnie serwer deweloperski i obserwator budowania Intlayer.
|
|
1088
|
+
|
|
1089
|
+
```json5 fileName="package.json"
|
|
1090
|
+
{
|
|
1091
|
+
// ... Twoje istniejące konfiguracje package.json
|
|
1092
|
+
"scripts": {
|
|
1093
|
+
// ... Twoje istniejące konfiguracje skryptów
|
|
1094
|
+
"dev": "intlayer watch --with 'next dev'",
|
|
1095
|
+
},
|
|
1096
|
+
}
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
> Jeśli używasz next-intlayer@<=6.x.x, musisz zachować flagę `--turbopack`, aby aplikacja Next.js 16 działała poprawnie z Turbopack. Zalecamy użycie next-intlayer@>=7.x.x, aby uniknąć tego ograniczenia.
|
|
1100
|
+
|
|
1101
|
+
### Konfiguracja TypeScript
|
|
1102
|
+
|
|
1103
|
+
Intlayer używa module augmentation, aby skorzystać z zalet TypeScript i wzmocnić swoją codebase.
|
|
1104
|
+
|
|
1105
|
+

|
|
1106
|
+
|
|
1107
|
+

|
|
1108
|
+
|
|
1109
|
+
Upewnij się, że Twoja konfiguracja TypeScript zawiera autogenerowane typy.
|
|
1110
|
+
|
|
1111
|
+
```json5 fileName="tsconfig.json"
|
|
1112
|
+
{
|
|
1113
|
+
// ... Twoje istniejące konfiguracje TypeScript
|
|
1114
|
+
"include": [
|
|
1115
|
+
// ... Twoje istniejące konfiguracje TypeScript
|
|
1116
|
+
".intlayer/**/*.ts", // Dołącz auto-generowane typy
|
|
1117
|
+
],
|
|
1118
|
+
}
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
### Konfiguracja Git
|
|
1122
|
+
|
|
1123
|
+
Zaleca się ignorowanie plików generowanych przez Intlayer. Pozwoli to uniknąć ich zatwierdzania do Twojego repozytorium Git.
|
|
1124
|
+
|
|
1125
|
+
Aby to zrobić, możesz dodać następujące wpisy do pliku `.gitignore`:
|
|
1126
|
+
|
|
1127
|
+
```plaintext fileName=".gitignore"
|
|
1128
|
+
# Ignoruj pliki generowane przez Intlayer
|
|
1129
|
+
.intlayer
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
### Rozszerzenie VS Code
|
|
1133
|
+
|
|
1134
|
+
Aby ulepszyć doświadczenie programistyczne z Intlayer, możesz zainstalować oficjalne rozszerzenie **Intlayer VS Code Extension**.
|
|
1135
|
+
|
|
1136
|
+
[Zainstaluj z VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1137
|
+
|
|
1138
|
+
To rozszerzenie udostępnia:
|
|
1139
|
+
|
|
1140
|
+
- **Autouzupełnianie** kluczy tłumaczeń.
|
|
1141
|
+
- **Wykrywanie błędów w czasie rzeczywistym** dla brakujących tłumaczeń.
|
|
1142
|
+
- **Podglądy inline** przetłumaczonej zawartości.
|
|
1143
|
+
- **Szybkie akcje** umożliwiające łatwe tworzenie i aktualizowanie tłumaczeń.
|
|
1144
|
+
|
|
1145
|
+
Aby uzyskać więcej informacji o korzystaniu z rozszerzenia, zapoznaj się z dokumentacją [Intlayer VS Code Extension](https://intlayer.org/doc/vs-code-extension).
|
|
1146
|
+
|
|
1147
|
+
### Dalsze kroki
|
|
1148
|
+
|
|
1149
|
+
Aby pójść dalej, możesz wdrożyć [edytor wizualny](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_visual_editor.md) lub zewnętrznie przechowywać swoją zawartość za pomocą [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_CMS.md).
|