@intlayer/docs 7.0.7 → 7.0.8-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/i18n_using_next-i18next.md +1068 -0
- package/blog/ar/i18n_using_next-intl.md +768 -0
- package/blog/ar/intlayer_with_react-intl.md +0 -4
- package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +5 -4
- package/blog/de/i18n_using_next-i18next.md +1107 -0
- package/blog/de/i18n_using_next-intl.md +760 -0
- package/blog/de/intlayer_with_react-intl.md +0 -4
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/en/i18n_using_next-i18next.md +1073 -0
- package/blog/en/i18n_using_next-intl.md +757 -0
- package/blog/en/intlayer_with_i18next.md +71 -8
- package/blog/en/intlayer_with_next-i18next.md +71 -8
- package/blog/en/intlayer_with_next-intl.md +71 -8
- package/blog/en/intlayer_with_react-i18next.md +69 -8
- package/blog/en/intlayer_with_react-intl.md +68 -9
- package/blog/en/intlayer_with_vue-i18n.md +68 -7
- package/blog/en/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/blog/en/vue-i18n_vs_intlayer.md +2 -0
- package/blog/en-GB/i18n_using_next-i18next.md +1074 -0
- package/blog/en-GB/i18n_using_next-intl.md +757 -0
- package/blog/en-GB/intlayer_with_i18next.md +15 -6
- package/blog/en-GB/intlayer_with_next-i18next.md +16 -6
- package/blog/en-GB/intlayer_with_next-intl.md +16 -6
- package/blog/en-GB/intlayer_with_react-i18next.md +16 -7
- package/blog/en-GB/intlayer_with_react-intl.md +14 -9
- package/blog/en-GB/intlayer_with_vue-i18n.md +16 -7
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/en-GB/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/blog/en-GB/vue-i18n_vs_intlayer.md +2 -0
- package/blog/es/i18n_using_next-i18next.md +1066 -0
- package/blog/es/i18n_using_next-intl.md +757 -0
- package/blog/es/intlayer_with_react-intl.md +0 -4
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/fr/i18n_using_next-i18next.md +1078 -0
- package/blog/fr/i18n_using_next-intl.md +759 -0
- package/blog/fr/intlayer_with_react-intl.md +0 -4
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/hi/i18n_using_next-i18next.md +1068 -0
- package/blog/hi/i18n_using_next-intl.md +758 -0
- package/blog/hi/intlayer_with_react-intl.md +0 -4
- package/blog/hi/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/id/i18n_using_next-i18next.md +1078 -0
- package/blog/id/i18n_using_next-intl.md +757 -0
- package/blog/id/index.md +69 -0
- package/blog/id/internationalization_and_SEO.md +364 -0
- package/blog/id/intlayer_with_react-intl.md +0 -4
- package/blog/id/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/id/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/id/list_i18n_technologies/CMS/wordpress.md +188 -0
- package/blog/id/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/id/list_i18n_technologies/frameworks/flutter.md +150 -0
- package/blog/id/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/id/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/id/list_i18n_technologies/frameworks/svelte.md +131 -0
- package/blog/id/list_i18n_technologies/frameworks/vue.md +130 -0
- package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +1500 -0
- package/blog/id/nextjs-multilingual-seo-comparison.md +361 -0
- package/blog/id/rag_powered_documentation_assistant.md +288 -0
- package/blog/id/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/id/vue-i18n_vs_intlayer.md +278 -0
- package/blog/id/what_is_internationalization.md +166 -0
- package/blog/it/i18n_using_next-i18next.md +1078 -0
- package/blog/it/i18n_using_next-intl.md +758 -0
- package/blog/it/intlayer_with_react-intl.md +0 -4
- package/blog/it/react-i18next_vs_react-intl_vs_intlayer.md +4 -0
- package/blog/it/vue-i18n_vs_intlayer.md +2 -0
- package/blog/ja/i18n_using_next-i18next.md +1078 -0
- package/blog/ja/i18n_using_next-intl.md +758 -0
- package/blog/ja/intlayer_with_react-intl.md +0 -4
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/ko/i18n_using_next-i18next.md +1075 -0
- package/blog/ko/i18n_using_next-intl.md +759 -0
- package/blog/ko/intlayer_with_react-intl.md +0 -4
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/pl/i18n_using_next-i18next.md +1078 -0
- package/blog/pl/i18n_using_next-intl.md +758 -0
- package/blog/pl/index.md +69 -0
- package/blog/pl/internationalization_and_SEO.md +363 -0
- package/blog/pl/intlayer_with_react-intl.md +0 -4
- package/blog/pl/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/pl/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/pl/list_i18n_technologies/CMS/wordpress.md +196 -0
- package/blog/pl/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/pl/list_i18n_technologies/frameworks/flutter.md +151 -0
- package/blog/pl/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/pl/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/pl/list_i18n_technologies/frameworks/svelte.md +131 -0
- package/blog/pl/list_i18n_technologies/frameworks/vue.md +130 -0
- package/blog/pl/next-i18next_vs_next-intl_vs_intlayer.md +1501 -0
- package/blog/pl/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/pl/rag_powered_documentation_assistant.md +288 -0
- package/blog/pl/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/pl/vue-i18n_vs_intlayer.md +278 -0
- package/blog/pl/what_is_internationalization.md +167 -0
- package/blog/pt/i18n_using_next-i18next.md +1067 -0
- package/blog/pt/i18n_using_next-intl.md +760 -0
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/ru/i18n_using_next-i18next.md +1106 -0
- package/blog/ru/i18n_using_next-intl.md +759 -0
- package/blog/ru/intlayer_with_react-intl.md +0 -4
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/tr/i18n_using_next-i18next.md +1078 -0
- package/blog/tr/i18n_using_next-intl.md +760 -0
- package/blog/tr/intlayer_with_react-intl.md +0 -4
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/tr/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/blog/tr/vue-i18n_vs_intlayer.md +2 -0
- package/blog/vi/i18n_using_next-i18next.md +1080 -0
- package/blog/vi/i18n_using_next-intl.md +758 -0
- package/blog/vi/index.md +69 -0
- package/blog/vi/internationalization_and_SEO.md +363 -0
- package/blog/vi/intlayer_with_react-intl.md +0 -4
- package/blog/vi/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/vi/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/vi/list_i18n_technologies/CMS/wordpress.md +188 -0
- package/blog/vi/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/vi/list_i18n_technologies/frameworks/flutter.md +150 -0
- package/blog/vi/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/vi/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/vi/list_i18n_technologies/frameworks/svelte.md +131 -0
- package/blog/vi/list_i18n_technologies/frameworks/vue.md +130 -0
- package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +1520 -0
- package/blog/vi/nextjs-multilingual-seo-comparison.md +362 -0
- package/blog/vi/rag_powered_documentation_assistant.md +288 -0
- package/blog/vi/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
- package/blog/vi/vue-i18n_vs_intlayer.md +278 -0
- package/blog/vi/what_is_internationalization.md +168 -0
- package/blog/zh/i18n_using_next-i18next.md +1105 -0
- package/blog/zh/i18n_using_next-intl.md +758 -0
- package/blog/zh/intlayer_with_react-intl.md +0 -4
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/zh/react-i18next_vs_react-intl_vs_intlayer.md +2 -0
- package/dist/cjs/common.cjs +0 -4
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +38 -6
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +0 -6
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +0 -6
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +0 -6
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +38 -0
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/types/generated/blog.entry.d.ts +2 -0
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +1 -1
- package/docs/ar/configuration.md +6 -0
- package/docs/ar/intlayer_cli.md +8 -3
- package/docs/ar/intlayer_with_next-i18next.md +619 -0
- package/docs/ar/intlayer_with_next-intl.md +446 -0
- package/docs/ar/intlayer_with_nextjs_16.md +21 -0
- package/docs/ar/intlayer_with_tanstack.md +4 -0
- package/docs/ar/intlayer_with_vite+react.md +4 -0
- package/docs/de/component_i18n.md +1 -1
- package/docs/de/configuration.md +6 -0
- package/docs/de/intlayer_cli.md +8 -3
- package/docs/de/intlayer_with_next-i18next.md +627 -0
- package/docs/de/intlayer_with_next-intl.md +451 -0
- package/docs/de/intlayer_with_nextjs_16.md +21 -0
- package/docs/de/intlayer_with_tanstack.md +4 -0
- package/docs/de/intlayer_with_vite+react.md +4 -0
- package/docs/en/component_i18n.md +1 -1
- package/docs/en/intlayer_cli.md +8 -1
- package/docs/en/intlayer_with_astro.md +10 -2
- package/docs/en/intlayer_with_create_react_app.md +8 -0
- package/docs/en/intlayer_with_lynx+react.md +8 -0
- package/docs/en/intlayer_with_nestjs.md +10 -0
- package/docs/en/intlayer_with_nextjs_14.md +10 -2
- package/docs/en/intlayer_with_nextjs_15.md +21 -4
- package/docs/en/intlayer_with_nextjs_16.md +17 -0
- package/docs/en/intlayer_with_nuxt.md +8 -0
- package/docs/en/intlayer_with_react_native+expo.md +10 -2
- package/docs/en/intlayer_with_react_router_v7.md +8 -0
- package/docs/en/intlayer_with_tanstack.md +10 -0
- package/docs/en/intlayer_with_vite+preact.md +10 -2
- package/docs/en/intlayer_with_vite+react.md +21 -4
- package/docs/en/intlayer_with_vite+vue.md +10 -2
- package/docs/en-GB/component_i18n.md +1 -1
- package/docs/en-GB/configuration.md +6 -0
- package/docs/en-GB/intlayer_cli.md +8 -3
- package/docs/en-GB/intlayer_with_angular.md +4 -4
- package/docs/en-GB/intlayer_with_express.md +4 -4
- package/docs/en-GB/intlayer_with_lynx+react.md +12 -12
- package/{blog/en/_intlayer_with_next-i18next.md → docs/en-GB/intlayer_with_next-i18next.md} +241 -42
- package/{blog/en/_intlayer_with_next-intl.md → docs/en-GB/intlayer_with_next-intl.md} +144 -29
- package/docs/en-GB/intlayer_with_nextjs_16.md +21 -0
- package/docs/en-GB/intlayer_with_tanstack.md +5 -1
- package/docs/en-GB/intlayer_with_vite+react.md +4 -0
- package/docs/en-GB/packages/next-intlayer/t.md +2 -2
- package/docs/es/component_i18n.md +1 -1
- package/docs/es/configuration.md +6 -0
- package/docs/es/intlayer_cli.md +8 -3
- package/docs/es/intlayer_with_next-i18next.md +628 -0
- package/docs/es/intlayer_with_next-intl.md +446 -0
- package/docs/es/intlayer_with_nextjs_16.md +21 -0
- package/docs/es/intlayer_with_tanstack.md +4 -0
- package/docs/es/intlayer_with_vite+react.md +4 -0
- package/docs/fr/configuration.md +6 -0
- package/docs/fr/intlayer_cli.md +8 -3
- package/docs/fr/intlayer_with_next-i18next.md +628 -0
- package/docs/fr/intlayer_with_next-intl.md +446 -0
- package/docs/fr/intlayer_with_nextjs_16.md +23 -2
- package/docs/fr/intlayer_with_tanstack.md +4 -0
- package/docs/fr/intlayer_with_vite+react.md +4 -0
- package/docs/hi/component_i18n.md +1 -1
- package/docs/hi/configuration.md +6 -0
- package/docs/hi/intlayer_cli.md +8 -0
- package/docs/hi/intlayer_with_next-i18next.md +628 -0
- package/docs/hi/intlayer_with_next-intl.md +446 -0
- package/docs/hi/intlayer_with_nextjs_16.md +21 -0
- package/docs/hi/intlayer_with_tanstack.md +4 -0
- package/docs/hi/intlayer_with_vite+react.md +4 -0
- package/docs/id/CI_CD.md +198 -0
- package/docs/id/autoFill.md +284 -0
- package/docs/id/component_i18n.md +186 -0
- package/docs/id/configuration.md +710 -0
- package/docs/id/dictionary/condition.md +231 -0
- package/docs/id/dictionary/content_file.md +1092 -0
- package/docs/id/dictionary/enumeration.md +245 -0
- package/docs/id/dictionary/file.md +237 -0
- package/docs/id/dictionary/function_fetching.md +214 -0
- package/docs/id/dictionary/gender.md +273 -0
- package/docs/id/dictionary/insertion.md +192 -0
- package/docs/id/dictionary/markdown.md +381 -0
- package/docs/id/dictionary/nesting.md +273 -0
- package/docs/id/dictionary/translation.md +310 -0
- package/docs/id/formatters.md +596 -0
- package/docs/id/how_works_intlayer.md +256 -0
- package/docs/id/index.md +176 -0
- package/docs/id/interest_of_intlayer.md +293 -0
- package/docs/id/intlayer_CMS.md +549 -0
- package/docs/id/intlayer_cli.md +850 -0
- package/docs/id/intlayer_visual_editor.md +288 -0
- package/docs/id/intlayer_with_angular.md +694 -0
- package/docs/id/intlayer_with_astro.md +252 -0
- package/docs/id/intlayer_with_create_react_app.md +1233 -0
- package/docs/id/intlayer_with_express.md +411 -0
- package/docs/id/intlayer_with_lynx+react.md +518 -0
- package/docs/id/intlayer_with_nestjs.md +272 -0
- package/docs/id/intlayer_with_next-i18next.md +628 -0
- package/docs/id/intlayer_with_next-intl.md +446 -0
- package/docs/id/intlayer_with_nextjs_14.md +1617 -0
- package/docs/id/intlayer_with_nextjs_15.md +1698 -0
- package/docs/id/intlayer_with_nextjs_16.md +21 -0
- package/docs/id/intlayer_with_nextjs_page_router.md +1478 -0
- package/docs/id/intlayer_with_nuxt.md +808 -0
- package/docs/id/intlayer_with_react_native+expo.md +699 -0
- package/docs/id/intlayer_with_react_router_v7.md +496 -0
- package/docs/id/intlayer_with_tanstack.md +564 -0
- package/docs/id/intlayer_with_vite+preact.md +1737 -0
- package/docs/id/intlayer_with_vite+react.md +1413 -0
- package/docs/id/intlayer_with_vite+solid.md +289 -0
- package/docs/id/intlayer_with_vite+svelte.md +289 -0
- package/docs/id/intlayer_with_vite+vue.md +1088 -0
- package/docs/id/introduction.md +218 -0
- package/docs/id/locale_mapper.md +242 -0
- package/docs/id/mcp_server.md +211 -0
- package/docs/id/packages/express-intlayer/t.md +458 -0
- package/docs/id/packages/intlayer/getConfiguration.md +145 -0
- package/docs/id/packages/intlayer/getEnumeration.md +159 -0
- package/docs/id/packages/intlayer/getHTMLTextDir.md +122 -0
- package/docs/id/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/id/packages/intlayer/getLocaleName.md +119 -0
- package/docs/id/packages/intlayer/getLocalizedUrl.md +309 -0
- package/docs/id/packages/intlayer/getMultilingualUrls.md +223 -0
- package/docs/id/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/id/packages/intlayer/getTranslation.md +190 -0
- package/docs/id/packages/intlayer/getTranslationContent.md +188 -0
- package/docs/id/packages/next-intlayer/t.md +352 -0
- package/docs/id/packages/next-intlayer/useDictionary.md +271 -0
- package/docs/id/packages/next-intlayer/useIntlayer.md +264 -0
- package/docs/id/packages/next-intlayer/useLocale.md +166 -0
- package/docs/id/packages/react-intlayer/t.md +303 -0
- package/docs/id/packages/react-intlayer/useDictionary.md +287 -0
- package/docs/id/packages/react-intlayer/useI18n.md +267 -0
- package/docs/id/packages/react-intlayer/useIntlayer.md +254 -0
- package/docs/id/packages/react-intlayer/useLocale.md +210 -0
- package/docs/id/per_locale_file.md +323 -0
- package/docs/id/readme.md +261 -0
- package/docs/id/releases/v6.md +305 -0
- package/docs/id/roadmap.md +362 -0
- package/docs/id/testing.md +202 -0
- package/docs/id/vs_code_extension.md +126 -0
- package/docs/it/component_i18n.md +1 -1
- package/docs/it/configuration.md +6 -0
- package/docs/it/intlayer_cli.md +8 -3
- package/docs/it/intlayer_with_next-i18next.md +628 -0
- package/docs/it/intlayer_with_next-intl.md +446 -0
- package/docs/it/intlayer_with_nextjs_16.md +21 -0
- package/docs/it/intlayer_with_tanstack.md +4 -0
- package/docs/it/intlayer_with_vite+react.md +4 -0
- package/docs/ja/component_i18n.md +1 -1
- package/docs/ja/configuration.md +6 -0
- package/docs/ja/intlayer_cli.md +8 -3
- package/docs/ja/intlayer_with_next-i18next.md +627 -0
- package/docs/ja/intlayer_with_next-intl.md +446 -0
- package/docs/ja/intlayer_with_nextjs_16.md +21 -0
- package/docs/ja/intlayer_with_tanstack.md +4 -0
- package/docs/ja/intlayer_with_vite+react.md +4 -0
- package/docs/ko/configuration.md +6 -0
- package/docs/ko/intlayer_cli.md +8 -3
- package/docs/ko/intlayer_with_next-i18next.md +627 -0
- package/docs/ko/intlayer_with_next-intl.md +446 -0
- package/docs/ko/intlayer_with_nextjs_16.md +21 -0
- package/docs/ko/intlayer_with_tanstack.md +4 -0
- package/docs/ko/intlayer_with_vite+react.md +4 -0
- package/docs/pl/CI_CD.md +198 -0
- package/docs/pl/autoFill.md +284 -0
- package/docs/pl/component_i18n.md +186 -0
- package/docs/pl/configuration.md +710 -0
- package/docs/pl/dictionary/condition.md +232 -0
- package/docs/pl/dictionary/content_file.md +1130 -0
- package/docs/pl/dictionary/enumeration.md +245 -0
- package/docs/pl/dictionary/file.md +234 -0
- package/docs/pl/dictionary/function_fetching.md +214 -0
- package/docs/pl/dictionary/gender.md +276 -0
- package/docs/pl/dictionary/insertion.md +188 -0
- package/docs/pl/dictionary/markdown.md +408 -0
- package/docs/pl/dictionary/nesting.md +273 -0
- package/docs/pl/dictionary/translation.md +310 -0
- package/docs/pl/formatters.md +596 -0
- package/docs/pl/how_works_intlayer.md +256 -0
- package/docs/pl/index.md +176 -0
- package/docs/pl/interest_of_intlayer.md +291 -0
- package/docs/pl/intlayer_CMS.md +549 -0
- package/docs/pl/intlayer_cli.md +857 -0
- package/docs/pl/intlayer_visual_editor.md +288 -0
- package/docs/pl/intlayer_with_angular.md +690 -0
- package/docs/pl/intlayer_with_astro.md +280 -0
- package/docs/pl/intlayer_with_create_react_app.md +1235 -0
- package/docs/pl/intlayer_with_express.md +411 -0
- package/docs/pl/intlayer_with_lynx+react.md +518 -0
- package/docs/pl/intlayer_with_nestjs.md +272 -0
- package/docs/pl/intlayer_with_next-i18next.md +628 -0
- package/docs/pl/intlayer_with_next-intl.md +446 -0
- package/docs/pl/intlayer_with_nextjs_14.md +1594 -0
- package/docs/pl/intlayer_with_nextjs_15.md +1701 -0
- package/docs/pl/intlayer_with_nextjs_16.md +21 -0
- package/docs/pl/intlayer_with_nextjs_page_router.md +1513 -0
- package/docs/pl/intlayer_with_nuxt.md +885 -0
- package/docs/pl/intlayer_with_react_native+expo.md +698 -0
- package/docs/pl/intlayer_with_react_router_v7.md +503 -0
- package/docs/pl/intlayer_with_tanstack.md +562 -0
- package/docs/pl/intlayer_with_vite+preact.md +1736 -0
- package/docs/pl/intlayer_with_vite+react.md +1438 -0
- package/docs/pl/intlayer_with_vite+solid.md +290 -0
- package/docs/pl/intlayer_with_vite+svelte.md +289 -0
- package/docs/pl/intlayer_with_vite+vue.md +1116 -0
- package/docs/pl/introduction.md +209 -0
- package/docs/pl/locale_mapper.md +242 -0
- package/docs/pl/mcp_server.md +211 -0
- package/docs/pl/packages/express-intlayer/t.md +458 -0
- package/docs/pl/packages/intlayer/getConfiguration.md +146 -0
- package/docs/pl/packages/intlayer/getEnumeration.md +160 -0
- package/docs/pl/packages/intlayer/getHTMLTextDir.md +121 -0
- package/docs/pl/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/pl/packages/intlayer/getLocaleName.md +118 -0
- package/docs/pl/packages/intlayer/getLocalizedUrl.md +300 -0
- package/docs/pl/packages/intlayer/getMultilingualUrls.md +221 -0
- package/docs/pl/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/pl/packages/intlayer/getTranslation.md +190 -0
- package/docs/pl/packages/intlayer/getTranslationContent.md +189 -0
- package/docs/pl/packages/next-intlayer/t.md +353 -0
- package/docs/pl/packages/next-intlayer/useDictionary.md +270 -0
- package/docs/pl/packages/next-intlayer/useIntlayer.md +263 -0
- package/docs/pl/packages/next-intlayer/useLocale.md +166 -0
- package/docs/pl/packages/react-intlayer/t.md +303 -0
- package/docs/pl/packages/react-intlayer/useDictionary.md +289 -0
- package/docs/pl/packages/react-intlayer/useI18n.md +249 -0
- package/docs/pl/packages/react-intlayer/useIntlayer.md +256 -0
- package/docs/pl/packages/react-intlayer/useLocale.md +210 -0
- package/docs/pl/per_locale_file.md +321 -0
- package/docs/pl/readme.md +261 -0
- package/docs/pl/releases/v6.md +305 -0
- package/docs/pl/roadmap.md +362 -0
- package/docs/pl/testing.md +202 -0
- package/docs/pl/vs_code_extension.md +126 -0
- package/docs/pt/component_i18n.md +1 -1
- package/docs/pt/configuration.md +6 -0
- package/docs/pt/intlayer_cli.md +8 -3
- package/docs/pt/intlayer_with_next-i18next.md +627 -0
- package/docs/pt/intlayer_with_next-intl.md +446 -0
- package/docs/pt/intlayer_with_nextjs_16.md +21 -0
- package/docs/pt/intlayer_with_tanstack.md +4 -0
- package/docs/pt/intlayer_with_vite+react.md +4 -0
- package/docs/ru/component_i18n.md +1 -1
- package/docs/ru/configuration.md +6 -0
- package/docs/ru/intlayer_cli.md +301 -22
- package/docs/ru/intlayer_with_next-i18next.md +629 -0
- package/docs/ru/intlayer_with_next-intl.md +448 -0
- package/docs/ru/intlayer_with_nextjs_16.md +21 -0
- package/docs/ru/intlayer_with_tanstack.md +4 -0
- package/docs/ru/intlayer_with_vite+react.md +4 -0
- package/docs/tr/component_i18n.md +1 -1
- package/docs/tr/configuration.md +6 -0
- package/docs/tr/intlayer_cli.md +8 -0
- package/docs/tr/intlayer_with_next-i18next.md +627 -0
- package/docs/tr/intlayer_with_next-intl.md +446 -0
- package/docs/tr/intlayer_with_nextjs_16.md +21 -0
- package/docs/tr/intlayer_with_tanstack.md +4 -0
- package/docs/tr/intlayer_with_vite+react.md +4 -0
- package/docs/vi/CI_CD.md +198 -0
- package/docs/vi/autoFill.md +284 -0
- package/docs/vi/component_i18n.md +186 -0
- package/docs/vi/configuration.md +710 -0
- package/docs/vi/dictionary/condition.md +237 -0
- package/docs/vi/dictionary/content_file.md +1115 -0
- package/docs/vi/dictionary/enumeration.md +255 -0
- package/docs/vi/dictionary/file.md +234 -0
- package/docs/vi/dictionary/function_fetching.md +212 -0
- package/docs/vi/dictionary/gender.md +275 -0
- package/docs/vi/dictionary/insertion.md +191 -0
- package/docs/vi/dictionary/markdown.md +381 -0
- package/docs/vi/dictionary/nesting.md +273 -0
- package/docs/vi/dictionary/translation.md +309 -0
- package/docs/vi/formatters.md +595 -0
- package/docs/vi/how_works_intlayer.md +256 -0
- package/docs/vi/index.md +174 -0
- package/docs/vi/interest_of_intlayer.md +292 -0
- package/docs/vi/intlayer_CMS.md +549 -0
- package/docs/vi/intlayer_cli.md +850 -0
- package/docs/vi/intlayer_visual_editor.md +288 -0
- package/docs/vi/intlayer_with_angular.md +692 -0
- package/docs/vi/intlayer_with_astro.md +252 -0
- package/docs/vi/intlayer_with_create_react_app.md +1230 -0
- package/docs/vi/intlayer_with_express.md +409 -0
- package/docs/vi/intlayer_with_lynx+react.md +520 -0
- package/docs/vi/intlayer_with_nestjs.md +272 -0
- package/docs/vi/intlayer_with_next-i18next.md +628 -0
- package/docs/vi/intlayer_with_next-intl.md +446 -0
- package/docs/vi/intlayer_with_nextjs_14.md +1584 -0
- package/docs/vi/intlayer_with_nextjs_15.md +1738 -0
- package/docs/vi/intlayer_with_nextjs_16.md +21 -0
- package/docs/vi/intlayer_with_nextjs_page_router.md +1504 -0
- package/docs/vi/intlayer_with_nuxt.md +821 -0
- package/docs/vi/intlayer_with_react_native+expo.md +700 -0
- package/docs/vi/intlayer_with_react_router_v7.md +498 -0
- package/docs/vi/intlayer_with_tanstack.md +562 -0
- package/docs/vi/intlayer_with_vite+preact.md +1722 -0
- package/docs/vi/intlayer_with_vite+react.md +1407 -0
- package/docs/vi/intlayer_with_vite+solid.md +287 -0
- package/docs/vi/intlayer_with_vite+svelte.md +289 -0
- package/docs/vi/intlayer_with_vite+vue.md +1071 -0
- package/docs/vi/introduction.md +215 -0
- package/docs/vi/locale_mapper.md +242 -0
- package/docs/vi/mcp_server.md +211 -0
- package/docs/vi/packages/express-intlayer/t.md +457 -0
- package/docs/vi/packages/intlayer/getConfiguration.md +145 -0
- package/docs/vi/packages/intlayer/getEnumeration.md +162 -0
- package/docs/vi/packages/intlayer/getHTMLTextDir.md +121 -0
- package/docs/vi/packages/intlayer/getLocaleLang.md +81 -0
- package/docs/vi/packages/intlayer/getLocaleName.md +129 -0
- package/docs/vi/packages/intlayer/getLocalizedUrl.md +309 -0
- package/docs/vi/packages/intlayer/getMultilingualUrls.md +221 -0
- package/docs/vi/packages/intlayer/getPathWithoutLocale.md +75 -0
- package/docs/vi/packages/intlayer/getTranslation.md +201 -0
- package/docs/vi/packages/intlayer/getTranslationContent.md +188 -0
- package/docs/vi/packages/next-intlayer/t.md +352 -0
- package/docs/vi/packages/next-intlayer/useDictionary.md +273 -0
- package/docs/vi/packages/next-intlayer/useIntlayer.md +264 -0
- package/docs/vi/packages/next-intlayer/useLocale.md +166 -0
- package/docs/vi/packages/react-intlayer/t.md +304 -0
- package/docs/vi/packages/react-intlayer/useDictionary.md +288 -0
- package/docs/vi/packages/react-intlayer/useI18n.md +295 -0
- package/docs/vi/packages/react-intlayer/useIntlayer.md +256 -0
- package/docs/vi/packages/react-intlayer/useLocale.md +210 -0
- package/docs/vi/per_locale_file.md +326 -0
- package/docs/vi/readme.md +261 -0
- package/docs/vi/releases/v6.md +305 -0
- package/docs/vi/roadmap.md +346 -0
- package/docs/vi/testing.md +202 -0
- package/docs/vi/vs_code_extension.md +126 -0
- package/docs/zh/configuration.md +6 -0
- package/docs/zh/intlayer_cli.md +8 -3
- package/docs/zh/intlayer_with_next-i18next.md +628 -0
- package/docs/zh/intlayer_with_next-intl.md +448 -0
- package/docs/zh/intlayer_with_nextjs_16.md +21 -0
- package/docs/zh/intlayer_with_tanstack.md +4 -0
- package/docs/zh/intlayer_with_vite+react.md +4 -0
- package/frequent_questions/ar/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ar/array_as_content_declaration.md +1 -2
- package/frequent_questions/ar/build_dictionaries.md +1 -2
- package/frequent_questions/ar/build_error_CI_CD.md +1 -2
- package/frequent_questions/ar/bun_set_up.md +1 -2
- package/frequent_questions/ar/customized_locale_list.md +1 -2
- package/frequent_questions/ar/domain_routing.md +1 -2
- package/frequent_questions/ar/esbuild_error.md +1 -2
- package/frequent_questions/ar/get_locale_cookie.md +1 -2
- package/frequent_questions/ar/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ar/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ar/static_rendering.md +1 -3
- package/frequent_questions/ar/translated_path_url.md +1 -2
- package/frequent_questions/ar/unknown_command.md +1 -2
- package/frequent_questions/de/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/de/array_as_content_declaration.md +1 -2
- package/frequent_questions/de/build_dictionaries.md +1 -2
- package/frequent_questions/de/build_error_CI_CD.md +1 -2
- package/frequent_questions/de/bun_set_up.md +1 -2
- package/frequent_questions/de/customized_locale_list.md +1 -2
- package/frequent_questions/de/domain_routing.md +1 -2
- package/frequent_questions/de/esbuild_error.md +1 -2
- package/frequent_questions/de/get_locale_cookie.md +1 -2
- package/frequent_questions/de/intlayer_command_undefined.md +1 -2
- package/frequent_questions/de/locale_incorect_in_url.md +1 -2
- package/frequent_questions/de/static_rendering.md +1 -3
- package/frequent_questions/de/translated_path_url.md +1 -2
- package/frequent_questions/de/unknown_command.md +1 -2
- package/frequent_questions/en/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/en/array_as_content_declaration.md +1 -2
- package/frequent_questions/en/build_dictionaries.md +1 -2
- package/frequent_questions/en/build_error_CI_CD.md +1 -2
- package/frequent_questions/en/bun_set_up.md +1 -2
- package/frequent_questions/en/customized_locale_list.md +1 -2
- package/frequent_questions/en/domain_routing.md +1 -2
- package/frequent_questions/en/esbuild_error.md +1 -2
- package/frequent_questions/en/get_locale_cookie.md +1 -2
- package/frequent_questions/en/intlayer_command_undefined.md +1 -2
- package/frequent_questions/en/locale_incorect_in_url.md +1 -2
- package/frequent_questions/en/static_rendering.md +1 -3
- package/frequent_questions/en/translated_path_url.md +1 -2
- package/frequent_questions/en/unknown_command.md +1 -2
- package/frequent_questions/en-GB/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/en-GB/array_as_content_declaration.md +1 -2
- package/frequent_questions/en-GB/build_dictionaries.md +1 -2
- package/frequent_questions/en-GB/build_error_CI_CD.md +1 -2
- package/frequent_questions/en-GB/bun_set_up.md +1 -2
- package/frequent_questions/en-GB/customized_locale_list.md +1 -2
- package/frequent_questions/en-GB/domain_routing.md +1 -2
- package/frequent_questions/en-GB/esbuild_error.md +1 -2
- package/frequent_questions/en-GB/get_locale_cookie.md +1 -2
- package/frequent_questions/en-GB/intlayer_command_undefined.md +1 -2
- package/frequent_questions/en-GB/locale_incorect_in_url.md +1 -2
- package/frequent_questions/en-GB/static_rendering.md +1 -3
- package/frequent_questions/en-GB/translated_path_url.md +1 -2
- package/frequent_questions/en-GB/unknown_command.md +1 -2
- package/frequent_questions/es/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/es/array_as_content_declaration.md +1 -2
- package/frequent_questions/es/build_dictionaries.md +1 -2
- package/frequent_questions/es/build_error_CI_CD.md +1 -2
- package/frequent_questions/es/bun_set_up.md +1 -2
- package/frequent_questions/es/customized_locale_list.md +1 -2
- package/frequent_questions/es/domain_routing.md +1 -2
- package/frequent_questions/es/esbuild_error.md +1 -2
- package/frequent_questions/es/get_locale_cookie.md +1 -2
- package/frequent_questions/es/intlayer_command_undefined.md +1 -2
- package/frequent_questions/es/locale_incorect_in_url.md +1 -2
- package/frequent_questions/es/static_rendering.md +1 -3
- package/frequent_questions/es/translated_path_url.md +1 -2
- package/frequent_questions/es/unknown_command.md +1 -2
- package/frequent_questions/fr/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/fr/array_as_content_declaration.md +1 -2
- package/frequent_questions/fr/build_dictionaries.md +1 -2
- package/frequent_questions/fr/build_error_CI_CD.md +1 -2
- package/frequent_questions/fr/bun_set_up.md +1 -2
- package/frequent_questions/fr/customized_locale_list.md +1 -2
- package/frequent_questions/fr/domain_routing.md +1 -2
- package/frequent_questions/fr/esbuild_error.md +1 -2
- package/frequent_questions/fr/get_locale_cookie.md +1 -2
- package/frequent_questions/fr/intlayer_command_undefined.md +1 -2
- package/frequent_questions/fr/locale_incorect_in_url.md +1 -2
- package/frequent_questions/fr/static_rendering.md +1 -3
- package/frequent_questions/fr/translated_path_url.md +1 -2
- package/frequent_questions/fr/unknown_command.md +1 -2
- package/frequent_questions/hi/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/hi/array_as_content_declaration.md +1 -2
- package/frequent_questions/hi/build_dictionaries.md +1 -2
- package/frequent_questions/hi/build_error_CI_CD.md +1 -2
- package/frequent_questions/hi/bun_set_up.md +1 -2
- package/frequent_questions/hi/customized_locale_list.md +1 -2
- package/frequent_questions/hi/domain_routing.md +1 -2
- package/frequent_questions/hi/esbuild_error.md +1 -2
- package/frequent_questions/hi/get_locale_cookie.md +1 -2
- package/frequent_questions/hi/intlayer_command_undefined.md +1 -2
- package/frequent_questions/hi/locale_incorect_in_url.md +1 -2
- package/frequent_questions/hi/static_rendering.md +1 -3
- package/frequent_questions/hi/translated_path_url.md +1 -2
- package/frequent_questions/hi/unknown_command.md +1 -2
- package/frequent_questions/id/SSR_Next_no_[locale].md +104 -0
- package/frequent_questions/id/array_as_content_declaration.md +71 -0
- package/frequent_questions/id/build_dictionaries.md +58 -0
- package/frequent_questions/id/build_error_CI_CD.md +74 -0
- package/frequent_questions/id/bun_set_up.md +53 -0
- package/frequent_questions/id/customized_locale_list.md +64 -0
- package/frequent_questions/id/domain_routing.md +113 -0
- package/frequent_questions/id/esbuild_error.md +29 -0
- package/frequent_questions/id/get_locale_cookie.md +142 -0
- package/frequent_questions/id/intlayer_command_undefined.md +155 -0
- package/frequent_questions/id/locale_incorect_in_url.md +73 -0
- package/frequent_questions/id/static_rendering.md +44 -0
- package/frequent_questions/id/translated_path_url.md +55 -0
- package/frequent_questions/id/unknown_command.md +97 -0
- package/frequent_questions/it/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/it/array_as_content_declaration.md +1 -2
- package/frequent_questions/it/build_dictionaries.md +1 -2
- package/frequent_questions/it/build_error_CI_CD.md +1 -2
- package/frequent_questions/it/bun_set_up.md +1 -2
- package/frequent_questions/it/customized_locale_list.md +1 -2
- package/frequent_questions/it/domain_routing.md +1 -2
- package/frequent_questions/it/esbuild_error.md +1 -2
- package/frequent_questions/it/get_locale_cookie.md +1 -2
- package/frequent_questions/it/intlayer_command_undefined.md +1 -2
- package/frequent_questions/it/locale_incorect_in_url.md +1 -2
- package/frequent_questions/it/static_rendering.md +1 -3
- package/frequent_questions/it/translated_path_url.md +1 -2
- package/frequent_questions/it/unknown_command.md +1 -2
- package/frequent_questions/ja/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ja/array_as_content_declaration.md +1 -2
- package/frequent_questions/ja/build_dictionaries.md +1 -2
- package/frequent_questions/ja/build_error_CI_CD.md +1 -2
- package/frequent_questions/ja/bun_set_up.md +1 -2
- package/frequent_questions/ja/customized_locale_list.md +1 -2
- package/frequent_questions/ja/domain_routing.md +1 -2
- package/frequent_questions/ja/esbuild_error.md +1 -2
- package/frequent_questions/ja/get_locale_cookie.md +1 -2
- package/frequent_questions/ja/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ja/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ja/static_rendering.md +1 -3
- package/frequent_questions/ja/translated_path_url.md +1 -2
- package/frequent_questions/ja/unknown_command.md +1 -2
- package/frequent_questions/ko/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ko/array_as_content_declaration.md +1 -2
- package/frequent_questions/ko/build_dictionaries.md +1 -2
- package/frequent_questions/ko/build_error_CI_CD.md +1 -2
- package/frequent_questions/ko/bun_set_up.md +1 -2
- package/frequent_questions/ko/customized_locale_list.md +1 -2
- package/frequent_questions/ko/domain_routing.md +1 -2
- package/frequent_questions/ko/esbuild_error.md +1 -2
- package/frequent_questions/ko/get_locale_cookie.md +1 -2
- package/frequent_questions/ko/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ko/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ko/static_rendering.md +1 -3
- package/frequent_questions/ko/translated_path_url.md +1 -2
- package/frequent_questions/ko/unknown_command.md +1 -2
- package/frequent_questions/pl/SSR_Next_no_[locale].md +104 -0
- package/frequent_questions/pl/array_as_content_declaration.md +71 -0
- package/frequent_questions/pl/build_dictionaries.md +58 -0
- package/frequent_questions/pl/build_error_CI_CD.md +74 -0
- package/frequent_questions/pl/bun_set_up.md +54 -0
- package/frequent_questions/pl/customized_locale_list.md +64 -0
- package/frequent_questions/pl/domain_routing.md +113 -0
- package/frequent_questions/pl/esbuild_error.md +29 -0
- package/frequent_questions/pl/get_locale_cookie.md +142 -0
- package/frequent_questions/pl/intlayer_command_undefined.md +155 -0
- package/frequent_questions/pl/locale_incorect_in_url.md +73 -0
- package/frequent_questions/pl/static_rendering.md +44 -0
- package/frequent_questions/pl/translated_path_url.md +55 -0
- package/frequent_questions/pl/unknown_command.md +97 -0
- package/frequent_questions/pt/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/pt/array_as_content_declaration.md +1 -2
- package/frequent_questions/pt/build_dictionaries.md +1 -2
- package/frequent_questions/pt/build_error_CI_CD.md +1 -2
- package/frequent_questions/pt/bun_set_up.md +1 -2
- package/frequent_questions/pt/customized_locale_list.md +1 -2
- package/frequent_questions/pt/domain_routing.md +1 -2
- package/frequent_questions/pt/esbuild_error.md +1 -2
- package/frequent_questions/pt/get_locale_cookie.md +1 -2
- package/frequent_questions/pt/intlayer_command_undefined.md +1 -2
- package/frequent_questions/pt/locale_incorect_in_url.md +1 -2
- package/frequent_questions/pt/static_rendering.md +1 -3
- package/frequent_questions/pt/translated_path_url.md +1 -2
- package/frequent_questions/pt/unknown_command.md +1 -2
- package/frequent_questions/ru/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/ru/array_as_content_declaration.md +1 -2
- package/frequent_questions/ru/build_dictionaries.md +1 -2
- package/frequent_questions/ru/build_error_CI_CD.md +1 -2
- package/frequent_questions/ru/bun_set_up.md +1 -2
- package/frequent_questions/ru/customized_locale_list.md +1 -2
- package/frequent_questions/ru/domain_routing.md +1 -2
- package/frequent_questions/ru/esbuild_error.md +1 -2
- package/frequent_questions/ru/get_locale_cookie.md +1 -2
- package/frequent_questions/ru/intlayer_command_undefined.md +1 -2
- package/frequent_questions/ru/locale_incorect_in_url.md +1 -2
- package/frequent_questions/ru/static_rendering.md +1 -2
- package/frequent_questions/ru/translated_path_url.md +1 -2
- package/frequent_questions/ru/unknown_command.md +1 -2
- package/frequent_questions/tr/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/tr/array_as_content_declaration.md +1 -2
- package/frequent_questions/tr/build_dictionaries.md +1 -2
- package/frequent_questions/tr/build_error_CI_CD.md +1 -2
- package/frequent_questions/tr/bun_set_up.md +1 -2
- package/frequent_questions/tr/customized_locale_list.md +1 -2
- package/frequent_questions/tr/domain_routing.md +1 -2
- package/frequent_questions/tr/esbuild_error.md +1 -2
- package/frequent_questions/tr/get_locale_cookie.md +1 -2
- package/frequent_questions/tr/intlayer_command_undefined.md +1 -2
- package/frequent_questions/tr/locale_incorect_in_url.md +1 -2
- package/frequent_questions/tr/static_rendering.md +1 -2
- package/frequent_questions/tr/translated_path_url.md +1 -2
- package/frequent_questions/tr/unknown_command.md +1 -2
- package/frequent_questions/vi/SSR_Next_no_[locale].md +106 -0
- package/frequent_questions/vi/array_as_content_declaration.md +71 -0
- package/frequent_questions/vi/build_dictionaries.md +58 -0
- package/frequent_questions/vi/build_error_CI_CD.md +74 -0
- package/frequent_questions/vi/bun_set_up.md +53 -0
- package/frequent_questions/vi/customized_locale_list.md +64 -0
- package/frequent_questions/vi/domain_routing.md +113 -0
- package/frequent_questions/vi/esbuild_error.md +29 -0
- package/frequent_questions/vi/get_locale_cookie.md +142 -0
- package/frequent_questions/vi/intlayer_command_undefined.md +155 -0
- package/frequent_questions/vi/locale_incorect_in_url.md +73 -0
- package/frequent_questions/vi/static_rendering.md +44 -0
- package/frequent_questions/vi/translated_path_url.md +55 -0
- package/frequent_questions/vi/unknown_command.md +97 -0
- package/frequent_questions/zh/SSR_Next_no_[locale].md +1 -2
- package/frequent_questions/zh/array_as_content_declaration.md +1 -2
- package/frequent_questions/zh/build_dictionaries.md +1 -2
- package/frequent_questions/zh/build_error_CI_CD.md +1 -2
- package/frequent_questions/zh/bun_set_up.md +1 -2
- package/frequent_questions/zh/customized_locale_list.md +1 -2
- package/frequent_questions/zh/domain_routing.md +1 -2
- package/frequent_questions/zh/esbuild_error.md +1 -2
- package/frequent_questions/zh/get_locale_cookie.md +1 -2
- package/frequent_questions/zh/intlayer_command_undefined.md +1 -2
- package/frequent_questions/zh/locale_incorect_in_url.md +1 -2
- package/frequent_questions/zh/static_rendering.md +1 -3
- package/frequent_questions/zh/translated_path_url.md +1 -2
- package/frequent_questions/zh/unknown_command.md +1 -2
- package/legal/id/privacy_notice.md +83 -0
- package/legal/id/terms_of_service.md +55 -0
- package/legal/pl/privacy_notice.md +83 -0
- package/legal/pl/terms_of_service.md +55 -0
- package/legal/vi/privacy_notice.md +83 -0
- package/legal/vi/terms_of_service.md +55 -0
- package/package.json +19 -18
- package/src/generated/blog.entry.ts +38 -0
|
@@ -0,0 +1,1068 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2025-11-01
|
|
3
|
+
updatedAt: 2025-11-01
|
|
4
|
+
title: next-i18next का उपयोग करके अपने Next.js एप्लिकेशन का अंतरराष्ट्रीयकरण कैसे करें
|
|
5
|
+
description: next-i18next के साथ i18n सेट करें: बहुभाषी Next.js ऐप्स के लिए सर्वोत्तम प्रथाएं और SEO सुझाव, जिसमें अंतरराष्ट्रीयकरण, सामग्री संगठन, और तकनीकी सेटअप शामिल हैं।
|
|
6
|
+
slugs:
|
|
7
|
+
- blog
|
|
8
|
+
- nextjs-internationalization-using-next-i18next
|
|
9
|
+
applicationTemplate: https://github.com/aymericzip/next-i18next-template
|
|
10
|
+
history:
|
|
11
|
+
- version: 7.0.6
|
|
12
|
+
date: 2025-11-01
|
|
13
|
+
changes: प्रारंभिक संस्करण
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# 2025 में next-i18next का उपयोग करके अपने Next.js एप्लिकेशन का अंतरराष्ट्रीयकरण कैसे करें
|
|
17
|
+
|
|
18
|
+
## सामग्री सूची
|
|
19
|
+
|
|
20
|
+
<TOC/>
|
|
21
|
+
|
|
22
|
+
## next-i18next क्या है?
|
|
23
|
+
|
|
24
|
+
**next-i18next** Next.js एप्लिकेशन के लिए एक लोकप्रिय अंतरराष्ट्रीयकरण (i18n) समाधान है। जबकि मूल `next-i18next` पैकेज पेजेस राउटर के लिए डिज़ाइन किया गया था, यह गाइड आपको दिखाता है कि आधुनिक **App Router** के साथ `i18next` और `react-i18next` का सीधे उपयोग करके i18next को कैसे लागू किया जाए।
|
|
25
|
+
|
|
26
|
+
इस दृष्टिकोण के साथ, आप कर सकते हैं:
|
|
27
|
+
|
|
28
|
+
- **अनुवादों को व्यवस्थित करें** नेमस्पेस (जैसे, `common.json`, `about.json`) का उपयोग करके बेहतर सामग्री प्रबंधन के लिए।
|
|
29
|
+
- **अनुवादों को कुशलतापूर्वक लोड करें** केवल प्रत्येक पेज के लिए आवश्यक नेमस्पेस लोड करके, जिससे बंडल आकार कम होता है।
|
|
30
|
+
- **सर्वर और क्लाइंट दोनों कंपोनेंट्स का समर्थन करें** उचित SSR और हाइड्रेशन हैंडलिंग के साथ।
|
|
31
|
+
- **TypeScript समर्थन सुनिश्चित करें** टाइप-सेफ लोकल कॉन्फ़िगरेशन और अनुवाद कुंजियों के साथ।
|
|
32
|
+
- **SEO के लिए अनुकूलित करें** उचित मेटाडेटा, साइटमैप, और robots.txt अंतरराष्ट्रीयकरण के साथ।
|
|
33
|
+
|
|
34
|
+
> एक विकल्प के रूप में, आप [next-intl गाइड](https://github.com/aymericzip/intlayer/blob/main/docs/blog/hi/i18n_using_next-intl.md) को भी देख सकते हैं, या सीधे [Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_with_nextjs_16.md) का उपयोग कर सकते हैं।
|
|
35
|
+
|
|
36
|
+
> तुलना देखें [next-i18next vs next-intl vs Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/blog/hi/next-i18next_vs_next-intl_vs_intlayer.md) में।
|
|
37
|
+
|
|
38
|
+
## आपको जिन प्रथाओं का पालन करना चाहिए
|
|
39
|
+
|
|
40
|
+
इम्प्लीमेंटेशन में जाने से पहले, यहां कुछ प्रथाएं हैं जिनका आपको पालन करना चाहिए:
|
|
41
|
+
|
|
42
|
+
- **HTML के `lang` और `dir` एट्रिब्यूट सेट करें**
|
|
43
|
+
- अपने लेआउट में, `dir` की गणना `getLocaleDirection(locale)` का उपयोग करके करें और उचित पहुंच और SEO के लिए `<html lang={locale} dir={dir}>` सेट करें।
|
|
44
|
+
- **संदेशों को namespace के अनुसार विभाजित करें**
|
|
45
|
+
JSON फ़ाइलों को locale और namespace (जैसे, `common.json`, `about.json`) के अनुसार व्यवस्थित करें ताकि केवल आवश्यक चीज़ें ही लोड हों।
|
|
46
|
+
- **क्लाइंट पेलोड को न्यूनतम करें**
|
|
47
|
+
पृष्ठों पर, केवल आवश्यक namespaces को `NextIntlClientProvider` को भेजें (जैसे, `pick(messages, ['common', 'about'])`)।
|
|
48
|
+
- **स्थैतिक पृष्ठों को प्राथमिकता दें**
|
|
49
|
+
बेहतर प्रदर्शन और SEO के लिए जितना संभव हो स्थैतिक पृष्ठों का उपयोग करें।
|
|
50
|
+
- **सर्वर कंपोनेंट्स में I18n**
|
|
51
|
+
सर्वर कंपोनेंट्स, जैसे पृष्ठ या सभी कंपोनेंट्स जो `client` के रूप में चिह्नित नहीं हैं, स्थैतिक होते हैं और बिल्ड समय पर प्री-रेंडर किए जा सकते हैं। इसलिए हमें अनुवाद फ़ंक्शंस को उन्हें props के रूप में पास करना होगा।
|
|
52
|
+
- **TypeScript प्रकार सेट करें**
|
|
53
|
+
- आपके locales के लिए पूरे एप्लिकेशन में type safety सुनिश्चित करने के लिए TypeScript types सेट करें।
|
|
54
|
+
- **पुनर्निर्देशन के लिए प्रॉक्सी**
|
|
55
|
+
locale पहचान और रूटिंग को संभालने के लिए प्रॉक्सी का उपयोग करें और उपयोगकर्ता को उचित locale-प्रिफिक्स्ड URL पर पुनर्निर्देशित करें।
|
|
56
|
+
- **अपने मेटाडेटा, साइटमैप, robots.txt का अंतरराष्ट्रीयकरण**
|
|
57
|
+
Next.js द्वारा प्रदान किए गए `generateMetadata` फ़ंक्शन का उपयोग करके अपने मेटाडेटा, साइटमैप, robots.txt का अंतरराष्ट्रीयकरण करें ताकि सभी locales में सर्च इंजन द्वारा बेहतर खोज सुनिश्चित हो सके।
|
|
58
|
+
- **लिंक को स्थानीयकृत करें**
|
|
59
|
+
उपयोगकर्ता को उचित locale-प्रिफिक्स्ड URL पर पुनर्निर्देशित करने के लिए `Link` कंपोनेंट का उपयोग करके लिंक को स्थानीयकृत करें। यह सुनिश्चित करना महत्वपूर्ण है कि आपके पृष्ठ सभी locales में खोजे जा सकें।
|
|
60
|
+
- **टेस्ट और अनुवादों को स्वचालित करें**
|
|
61
|
+
टेस्ट और अनुवादों को स्वचालित करना आपके बहुभाषी एप्लिकेशन के रखरखाव में समय की बचत करता है।
|
|
62
|
+
|
|
63
|
+
> हमारे दस्तावेज़ को देखें जिसमें अंतरराष्ट्रीयकरण और SEO के बारे में आपको जानने के लिए सब कुछ सूचीबद्ध है: [next-intl के साथ अंतरराष्ट्रीयकरण (i18n)](https://github.com/aymericzip/intlayer/blob/main/docs/blog/hi/internationalization_and_SEO.md)।
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Next.js एप्लिकेशन में i18next सेटअप करने के लिए चरण-दर-चरण मार्गदर्शिका
|
|
68
|
+
|
|
69
|
+
<iframe
|
|
70
|
+
src="https://stackblitz.com/github/aymericzip/next-i18next-template?embed=1&ctl=1&file=src/app/i18n.ts"
|
|
71
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
72
|
+
title="Demo CodeSandbox - Intlayer का उपयोग करके अपने एप्लिकेशन का अंतरराष्ट्रीयकरण कैसे करें"
|
|
73
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
74
|
+
loading="lazy"
|
|
75
|
+
|
|
76
|
+
> GitHub पर [एप्लिकेशन टेम्पलेट](https://github.com/aymericzip/next-i18next-template) देखें।
|
|
77
|
+
|
|
78
|
+
यहाँ प्रोजेक्ट संरचना है जिसे हम बनाएंगे:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
.
|
|
82
|
+
├── i18n.config.ts
|
|
83
|
+
└── src # Src वैकल्पिक है
|
|
84
|
+
├── locales
|
|
85
|
+
│ ├── en
|
|
86
|
+
│ │ ├── common.json
|
|
87
|
+
│ │ └── about.json
|
|
88
|
+
│ └── fr
|
|
89
|
+
│ ├── common.json
|
|
90
|
+
│ └── about.json
|
|
91
|
+
├── types
|
|
92
|
+
│ └── i18next.d.ts
|
|
93
|
+
├── app
|
|
94
|
+
│ ├── proxy.ts
|
|
95
|
+
│ ├── i18n
|
|
96
|
+
│ │ └── server.ts
|
|
97
|
+
│ └── [locale]
|
|
98
|
+
│ ├── layout.tsx
|
|
99
|
+
│ ├── (home) # / (रूट ग्रुप ताकि होम संदेशों से सभी पृष्ठ प्रदूषित न हों)
|
|
100
|
+
│ │ ├── layout.tsx
|
|
101
|
+
│ │ └── page.tsx
|
|
102
|
+
│ └── about # /about
|
|
103
|
+
│ ├── layout.tsx
|
|
104
|
+
│ └── page.tsx
|
|
105
|
+
└── components
|
|
106
|
+
├── I18nProvider.tsx
|
|
107
|
+
├── ClientComponent.tsx
|
|
108
|
+
└── ServerComponent.tsx
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### चरण 1: Dependencies इंस्टॉल करें
|
|
112
|
+
|
|
113
|
+
npm का उपयोग करके आवश्यक पैकेज इंस्टॉल करें:
|
|
114
|
+
|
|
115
|
+
```bash packageManager="npm"
|
|
116
|
+
npm install i18next react-i18next i18next-resources-to-backend
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```bash packageManager="pnpm"
|
|
120
|
+
pnpm add i18next react-i18next i18next-resources-to-backend
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```bash packageManager="yarn"
|
|
124
|
+
yarn add i18next react-i18next i18next-resources-to-backend
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
- **i18next**: मुख्य अंतरराष्ट्रीयकरण फ्रेमवर्क जो अनुवाद लोडिंग और प्रबंधन को संभालता है।
|
|
128
|
+
- **react-i18next**: i18next के लिए React बाइंडिंग्स जो क्लाइंट कंपोनेंट्स के लिए `useTranslation` जैसे हुक प्रदान करता है।
|
|
129
|
+
- **i18next-resources-to-backend**: एक प्लगइन जो अनुवाद फ़ाइलों को डायनामिक रूप से लोड करने में सक्षम बनाता है, जिससे आप केवल आवश्यक namespaces को लोड कर सकते हैं।
|
|
130
|
+
|
|
131
|
+
### चरण 2: अपने प्रोजेक्ट को कॉन्फ़िगर करें
|
|
132
|
+
|
|
133
|
+
एक कॉन्फ़िगरेशन फ़ाइल बनाएं जिसमें आपके समर्थित लोकल, डिफ़ॉल्ट लोकल, और URL लोकलाइज़ेशन के लिए सहायक फ़ंक्शन परिभाषित हों। यह फ़ाइल आपके i18n सेटअप के लिए एकमात्र सत्य स्रोत के रूप में कार्य करती है और आपके एप्लिकेशन में टाइप सुरक्षा सुनिश्चित करती है।
|
|
134
|
+
|
|
135
|
+
अपने लोकल कॉन्फ़िगरेशन को केंद्रीकृत करने से असंगतताओं से बचा जाता है और भविष्य में लोकल जोड़ना या हटाना आसान हो जाता है। सहायक फ़ंक्शन SEO और रूटिंग के लिए सुसंगत URL जनरेशन सुनिश्चित करते हैं।
|
|
136
|
+
|
|
137
|
+
```ts fileName="i18n.config.ts"
|
|
138
|
+
// टाइप सुरक्षा के लिए समर्थित लोकल को const array के रूप में परिभाषित करें
|
|
139
|
+
// 'as const' असर्शन TypeScript को string[] के बजाय literal types अनुमानित करने देता है
|
|
140
|
+
export const locales = ["en", "fr"] as const;
|
|
141
|
+
|
|
142
|
+
// locales array से Locale टाइप निकालें
|
|
143
|
+
// यह एक यूनियन टाइप बनाता है: "en" | "fr"
|
|
144
|
+
export type Locale = (typeof locales)[number];
|
|
145
|
+
|
|
146
|
+
// जब कोई लोकल निर्दिष्ट नहीं किया गया हो तो उपयोग किया जाने वाला डिफ़ॉल्ट लोकल सेट करें
|
|
147
|
+
export const defaultLocale: Locale = "en";
|
|
148
|
+
|
|
149
|
+
// दाएं से बाएं भाषाएँ जिन्हें विशेष टेक्स्ट दिशा हैंडलिंग की आवश्यकता होती है
|
|
150
|
+
export const rtlLocales = ["ar", "he", "fa", "ur"] as const;
|
|
151
|
+
|
|
152
|
+
// जांचें कि क्या किसी लोकल को RTL (दाएं से बाएं) टेक्स्ट दिशा की आवश्यकता है
|
|
153
|
+
// अरबी, हिब्रू, फारसी, और उर्दू जैसी भाषाओं के लिए उपयोग किया जाता है
|
|
154
|
+
export const isRtl = (locale: string) =>
|
|
155
|
+
(rtlLocales as readonly string[]).includes(locale);
|
|
156
|
+
|
|
157
|
+
// दिए गए लोकल और पथ के लिए एक स्थानीयकृत पथ उत्पन्न करें
|
|
158
|
+
// डिफ़ॉल्ट लोकल पथों में कोई उपसर्ग नहीं होता (जैसे "/about" बजाय "/en/about")
|
|
159
|
+
// अन्य लोकल के लिए उपसर्ग होता है (जैसे "/fr/about")
|
|
160
|
+
export function localizedPath(locale: string, path: string) {
|
|
161
|
+
return locale === defaultLocale ? path : `/${locale}${path}`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// पूर्ण URL के लिए बेस URL (साइटमैप, मेटाडेटा आदि में उपयोग किया जाता है)
|
|
165
|
+
const ORIGIN = "https://example.com";
|
|
166
|
+
|
|
167
|
+
// लोकल प्रीफिक्स के साथ पूर्ण URL जनरेट करें
|
|
168
|
+
// SEO मेटाडेटा, साइटमैप्स, और कैनोनिकल URLs के लिए उपयोग किया जाता है
|
|
169
|
+
export function absoluteUrl(locale: string, path: string) {
|
|
170
|
+
return `${ORIGIN}${localizedPath(locale, path)}`;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ब्राउज़र में लोकल कुकी सेट करने के लिए उपयोग किया जाता है
|
|
174
|
+
export function getCookie(locale: Locale) {
|
|
175
|
+
return [
|
|
176
|
+
`NEXT_LOCALE=${locale}`,
|
|
177
|
+
"Path=/",
|
|
178
|
+
`Max-Age=${60 * 60 * 24 * 365}`, // 1 वर्ष
|
|
179
|
+
"SameSite=Lax",
|
|
180
|
+
].join("; ");
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### चरण 3: अनुवाद नेमस्पेसेस को केंद्रीकृत करें
|
|
185
|
+
|
|
186
|
+
अपने एप्लिकेशन द्वारा एक्सपोज़ किए गए प्रत्येक namespace के लिए एक सिंगल सोर्स ऑफ ट्रूथ बनाएं। इस सूची का पुन: उपयोग सर्वर, क्लाइंट, और टूलिंग कोड को सिंक में रखता है और ट्रांसलेशन हेल्पर्स के लिए मजबूत टाइपिंग को अनलॉक करता है।
|
|
187
|
+
|
|
188
|
+
```ts fileName="src/i18n.namespaces.ts"
|
|
189
|
+
export const namespaces = ["common", "about"] as const;
|
|
190
|
+
|
|
191
|
+
export type Namespace = (typeof namespaces)[number];
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### चरण 4: TypeScript के साथ ट्रांसलेशन कीज़ को मजबूत टाइप करें
|
|
195
|
+
|
|
196
|
+
`i18next` को अपने कैनोनिकल भाषा फ़ाइलों (आमतौर पर अंग्रेज़ी) की ओर बढ़ाएं। TypeScript तब प्रत्येक namespace के लिए वैध कीज़ का अनुमान लगाता है, इसलिए `t()` कॉल्स को एंड-टू-एंड चेक किया जाता है।
|
|
197
|
+
|
|
198
|
+
```ts fileName="src/types/i18next.d.ts"
|
|
199
|
+
import "i18next";
|
|
200
|
+
|
|
201
|
+
declare module "i18next" {
|
|
202
|
+
interface CustomTypeOptions {
|
|
203
|
+
defaultNS: "common";
|
|
204
|
+
resources: {
|
|
205
|
+
common: typeof import("@/locales/en/common.json");
|
|
206
|
+
about: typeof import("@/locales/en/about.json");
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
> सुझाव: इस घोषणा को `src/types` के अंतर्गत स्टोर करें (यदि फ़ोल्डर मौजूद नहीं है तो बनाएं)। Next.js पहले से ही `tsconfig.json` में `src` को शामिल करता है, इसलिए यह ऑगमेंटेशन स्वचालित रूप से पकड़ लिया जाता है। यदि नहीं, तो अपने `tsconfig.json` फ़ाइल में निम्नलिखित जोड़ें:
|
|
213
|
+
|
|
214
|
+
```json5 fileName="tsconfig.json"
|
|
215
|
+
{
|
|
216
|
+
"include": ["src/types/**/*.ts"],
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
इसके साथ आप ऑटोकंप्लीट और कंपाइल-टाइम चेक्स पर भरोसा कर सकते हैं:
|
|
221
|
+
|
|
222
|
+
```tsx
|
|
223
|
+
import { useTranslation, type TFunction } from "react-i18next";
|
|
224
|
+
|
|
225
|
+
const { t } = useTranslation("about");
|
|
226
|
+
|
|
227
|
+
// ठीक है, टाइप किया गया: t("counter.increment")
|
|
228
|
+
// त्रुटि, कंपाइल त्रुटि: t("doesNotExist")
|
|
229
|
+
export type AboutTranslator = TFunction<"about">;
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### चरण 5: सर्वर-साइड i18n इनिशियलाइज़ेशन सेट करें
|
|
233
|
+
|
|
234
|
+
सर्वर-साइड i18n इनिशियलाइज़ेशन फ़ंक्शन बनाएं जो सर्वर कंपोनेंट्स के लिए अनुवाद लोड करता है। यह फ़ंक्शन सर्वर-साइड रेंडरिंग के लिए एक अलग i18next इंस्टेंस बनाता है, यह सुनिश्चित करते हुए कि रेंडरिंग से पहले अनुवाद लोड हो जाएं।
|
|
235
|
+
|
|
236
|
+
सर्वर कंपोनेंट्स को अपना खुद का i18next इंस्टेंस चाहिए क्योंकि वे क्लाइंट कंपोनेंट्स से अलग संदर्भ में चलते हैं। सर्वर पर अनुवादों को प्रीलोड करने से अनुवादित नहीं हुए कंटेंट का फ्लैश रोका जाता है और SEO में सुधार होता है क्योंकि सर्च इंजन अनुवादित कंटेंट देख पाते हैं।
|
|
237
|
+
|
|
238
|
+
```ts fileName="src/app/i18n/server.ts"
|
|
239
|
+
import { createInstance } from "i18next";
|
|
240
|
+
import { initReactI18next } from "react-i18next/initReactI18next";
|
|
241
|
+
import resourcesToBackend from "i18next-resources-to-backend";
|
|
242
|
+
import { defaultLocale } from "@/i18n.config";
|
|
243
|
+
import { namespaces, type Namespace } from "@/i18n.namespaces";
|
|
244
|
+
|
|
245
|
+
// i18next के लिए डायनामिक रिसोर्स लोडिंग कॉन्फ़िगर करें
|
|
246
|
+
// यह फ़ंक्शन locale और namespace के आधार पर अनुवाद JSON फ़ाइलों को डायनामिक रूप से इम्पोर्ट करता है
|
|
247
|
+
// उदाहरण: locale="fr", namespace="about" -> "@/locales/fr/about.json" को इम्पोर्ट करता है
|
|
248
|
+
const backend = resourcesToBackend(
|
|
249
|
+
(locale: string, namespace: string) =>
|
|
250
|
+
import(`@/locales/${locale}/${namespace}.json`)
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
const DEFAULT_NAMESPACES = [
|
|
254
|
+
namespaces[0],
|
|
255
|
+
] as const satisfies readonly Namespace[];
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* सर्वर-साइड रेंडरिंग के लिए i18next इंस्टेंस इनिशियलाइज़ करें
|
|
259
|
+
*
|
|
260
|
+
* @returns सर्वर-साइड उपयोग के लिए तैयार इनिशियलाइज़्ड i18next इंस्टेंस
|
|
261
|
+
*/
|
|
262
|
+
export async function initI18next(
|
|
263
|
+
locale: string,
|
|
264
|
+
ns: readonly Namespace[] = DEFAULT_NAMESPACES
|
|
265
|
+
) {
|
|
266
|
+
// एक नया i18next इंस्टेंस बनाएं (क्लाइंट-साइड इंस्टेंस से अलग)
|
|
267
|
+
const i18n = createInstance();
|
|
268
|
+
|
|
269
|
+
// React इंटीग्रेशन और बैकएंड लोडर के साथ इनिशियलाइज़ करें
|
|
270
|
+
await i18n
|
|
271
|
+
.use(initReactI18next) // React hooks सपोर्ट सक्षम करें
|
|
272
|
+
.use(backend) // डायनामिक रिसोर्स लोडिंग सक्षम करें
|
|
273
|
+
.init({
|
|
274
|
+
lng: locale,
|
|
275
|
+
fallbackLng: defaultLocale,
|
|
276
|
+
ns, // बेहतर प्रदर्शन के लिए केवल निर्दिष्ट namespaces लोड करें
|
|
277
|
+
defaultNS: "common", // जब कोई namespace निर्दिष्ट न हो तो डिफ़ॉल्ट namespace
|
|
278
|
+
interpolation: { escapeValue: false }, // HTML को escape न करें (React XSS सुरक्षा संभालता है)
|
|
279
|
+
react: { useSuspense: false }, // SSR संगतता के लिए Suspense अक्षम करें
|
|
280
|
+
returnNull: false, // गायब keys के लिए null की बजाय खाली स्ट्रिंग लौटाएं
|
|
281
|
+
initImmediate: false, // संसाधन लोड होने तक इनिशियलाइज़ेशन को स्थगित करें (तेज़ SSR)
|
|
282
|
+
});
|
|
283
|
+
return i18n;
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### चरण 6: क्लाइंट-साइड i18n प्रोवाइडर बनाएं
|
|
288
|
+
|
|
289
|
+
एक क्लाइंट कंपोनेंट प्रोवाइडर बनाएं जो आपके एप्लिकेशन को i18next संदर्भ के साथ लपेटता है। यह प्रोवाइडर सर्वर से पहले से लोड की गई अनुवाद सामग्री प्राप्त करता है ताकि अनुवादित सामग्री के फ्लैश (FOUC) को रोका जा सके और डुप्लिकेट फेचिंग से बचा जा सके।
|
|
290
|
+
|
|
291
|
+
क्लाइंट कंपोनेंट्स को अपना खुद का i18next इंस्टेंस चाहिए जो ब्राउज़र में चलता है। सर्वर से पहले से लोड किए गए संसाधनों को स्वीकार करके, हम निर्बाध हाइड्रेशन सुनिश्चित करते हैं और सामग्री के फ्लैशिंग को रोकते हैं। यह प्रोवाइडर स्थानीय भाषा परिवर्तन और नेमस्पेस लोडिंग को भी गतिशील रूप से प्रबंधित करता है।
|
|
292
|
+
|
|
293
|
+
```tsx fileName="src/components/I18nProvider.tsx"
|
|
294
|
+
"use client";
|
|
295
|
+
|
|
296
|
+
import { useEffect, useState } from "react";
|
|
297
|
+
import { I18nextProvider } from "react-i18next";
|
|
298
|
+
import { createInstance, type ResourceLanguage } from "i18next";
|
|
299
|
+
import { initReactI18next } from "react-i18next/initReactI18next";
|
|
300
|
+
import resourcesToBackend from "i18next-resources-to-backend";
|
|
301
|
+
import { defaultLocale } from "@/i18n.config";
|
|
302
|
+
import { namespaces as allNamespaces, type Namespace } from "@/i18n.namespaces";
|
|
303
|
+
|
|
304
|
+
// क्लाइंट-साइड के लिए डायनामिक रिसोर्स लोडिंग कॉन्फ़िगर करें
|
|
305
|
+
// सर्वर-साइड के समान पैटर्न, लेकिन यह इंस्टेंस ब्राउज़र में चलता है
|
|
306
|
+
const backend = resourcesToBackend(
|
|
307
|
+
(locale: string, namespace: string) =>
|
|
308
|
+
import(`@/locales/${locale}/${namespace}.json`)
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
type Props = {
|
|
312
|
+
locale: string;
|
|
313
|
+
namespaces?: readonly Namespace[];
|
|
314
|
+
// सर्वर से प्री-लोडेड संसाधन (FOUC - अनुवादित सामग्री के फ्लैश को रोकता है)
|
|
315
|
+
// प्रारूप: { namespace: translationBundle }
|
|
316
|
+
resources?: Record<Namespace, ResourceLanguage>;
|
|
317
|
+
children: React.ReactNode;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* क्लाइंट-साइड i18n प्रदाता जो ऐप को i18next संदर्भ के साथ लपेटता है
|
|
322
|
+
* सर्वर से पहले से लोड किए गए संसाधन प्राप्त करता है ताकि अनुवादों को पुनः प्राप्त करने से बचा जा सके
|
|
323
|
+
*/
|
|
324
|
+
export default function I18nProvider({
|
|
325
|
+
locale,
|
|
326
|
+
namespaces = [allNamespaces[0]] as const,
|
|
327
|
+
resources,
|
|
328
|
+
children,
|
|
329
|
+
}: Props) {
|
|
330
|
+
// useState लेज़ी इनिशियलाइज़र का उपयोग करके i18n इंस्टेंस केवल एक बार बनाएं
|
|
331
|
+
// यह सुनिश्चित करता है कि इंस्टेंस केवल एक बार बनाया जाए, हर रेंडर पर नहीं
|
|
332
|
+
const [i18n] = useState(() => {
|
|
333
|
+
const i18nInstance = createInstance();
|
|
334
|
+
|
|
335
|
+
i18nInstance
|
|
336
|
+
.use(initReactI18next)
|
|
337
|
+
.use(backend)
|
|
338
|
+
.init({
|
|
339
|
+
lng: locale,
|
|
340
|
+
fallbackLng: defaultLocale,
|
|
341
|
+
ns: namespaces,
|
|
342
|
+
// यदि संसाधन (सर्वर से) प्रदान किए गए हैं, तो क्लाइंट-साइड से पुनः प्राप्ति से बचने के लिए उनका उपयोग करें
|
|
343
|
+
// यह FOUC को रोकता है और प्रारंभिक लोड प्रदर्शन में सुधार करता है
|
|
344
|
+
resources: resources ? { [locale]: resources } : undefined,
|
|
345
|
+
defaultNS: "common",
|
|
346
|
+
interpolation: { escapeValue: false },
|
|
347
|
+
react: { useSuspense: false },
|
|
348
|
+
returnNull: false, // अपरिभाषित मान लौटने से रोकें
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
return i18nInstance;
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// जब locale prop बदलता है तो भाषा अपडेट करें
|
|
355
|
+
useEffect(() => {
|
|
356
|
+
i18n.changeLanguage(locale);
|
|
357
|
+
}, [locale, i18n]);
|
|
358
|
+
|
|
359
|
+
// सुनिश्चित करें कि सभी आवश्यक namespaces क्लाइंट-साइड पर लोड हों
|
|
360
|
+
// सही ढंग से arrays की तुलना के लिए join("|") को dependency के रूप में उपयोग करना
|
|
361
|
+
useEffect(() => {
|
|
362
|
+
i18n.loadNamespaces(namespaces);
|
|
363
|
+
}, [namespaces.join("|"), i18n]);
|
|
364
|
+
|
|
365
|
+
// React context के माध्यम से सभी child components को i18n instance प्रदान करें
|
|
366
|
+
return <I18nextProvider i18n={i18n}>{children}</I18nextProvider>;
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### चरण 7: डायनामिक लोकल रूट्स परिभाषित करें
|
|
371
|
+
|
|
372
|
+
अपने ऐप फ़ोल्डर में `[locale]` डायरेक्टरी बनाकर लोकल के लिए डायनामिक रूटिंग सेट करें। इससे Next.js लोकल-आधारित रूटिंग को संभाल सकता है जहाँ प्रत्येक लोकल URL सेगमेंट बन जाता है (जैसे, `/en/about`, `/fr/about`)।
|
|
373
|
+
|
|
374
|
+
डायनामिक रूट्स का उपयोग करने से Next.js बिल्ड समय पर सभी लोकल के लिए स्थैतिक पेज जेनरेट कर सकता है, जिससे प्रदर्शन और SEO में सुधार होता है। लेआउट कंपोनेंट HTML के `lang` और `dir` एट्रिब्यूट्स को लोकल के आधार पर सेट करता है, जो पहुंच और सर्च इंजन की समझ के लिए महत्वपूर्ण है।
|
|
375
|
+
|
|
376
|
+
```tsx fileName="src/app/[locale]/layout.tsx"
|
|
377
|
+
import type { ReactNode } from "react";
|
|
378
|
+
import { locales, defaultLocale, isRtl, type Locale } from "@/i18n.config";
|
|
379
|
+
|
|
380
|
+
// डायनामिक पैरामीटर को अक्षम करें - सभी लोकल्स को बिल्ड समय पर जाना जाना चाहिए
|
|
381
|
+
// यह सभी लोकल रूट्स के लिए स्थैतिक जेनरेशन सुनिश्चित करता है
|
|
382
|
+
export const dynamicParams = false;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* बिल्ड समय पर सभी लोकल्स के लिए स्थैतिक पैरामीटर जनरेट करें
|
|
386
|
+
* Next.js यहां लौटाए गए प्रत्येक लोकल के लिए पेज प्री-रेंडर करेगा
|
|
387
|
+
* उदाहरण: [{ locale: "en" }, { locale: "fr" }]
|
|
388
|
+
*/
|
|
389
|
+
export function generateStaticParams() {
|
|
390
|
+
return locales.map((locale) => ({ locale }));
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* रूट लेआउट कॉम्पोनेंट जो लोकल-विशिष्ट HTML एट्रिब्यूट्स को संभालता है
|
|
395
|
+
* लोकल के आधार पर lang एट्रिब्यूट और टेक्स्ट दिशा (ltr/rtl) सेट करता है
|
|
396
|
+
*/
|
|
397
|
+
export default function LocaleLayout({
|
|
398
|
+
children,
|
|
399
|
+
params,
|
|
400
|
+
}: {
|
|
401
|
+
children: ReactNode;
|
|
402
|
+
params: { locale: string };
|
|
403
|
+
}) {
|
|
404
|
+
/// URL पैरामीटर से locale को मान्य करें
|
|
405
|
+
// यदि अमान्य locale प्रदान किया गया है, तो डिफ़ॉल्ट locale पर वापस जाएं
|
|
406
|
+
const locale: Locale = (locales as readonly string[]).includes(params.locale)
|
|
407
|
+
? (params.locale as any)
|
|
408
|
+
: defaultLocale;
|
|
409
|
+
|
|
410
|
+
// locale के आधार पर टेक्स्ट दिशा निर्धारित करें
|
|
411
|
+
// अरबी जैसी RTL भाषाओं के लिए सही टेक्स्ट रेंडरिंग हेतु dir="rtl" आवश्यक है
|
|
412
|
+
const dir = isRtl(locale) ? "rtl" : "ltr";
|
|
413
|
+
|
|
414
|
+
return (
|
|
415
|
+
<html lang={locale} dir={dir}>
|
|
416
|
+
<body>{children}</body>
|
|
417
|
+
</html>
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### चरण 8: अपनी अनुवाद फ़ाइलें बनाएं
|
|
423
|
+
|
|
424
|
+
प्रत्येक locale और namespace के लिए JSON फ़ाइलें बनाएं। यह संरचना आपको अनुवादों को तार्किक रूप से व्यवस्थित करने और केवल उस पृष्ठ के लिए आवश्यक अनुवाद लोड करने की अनुमति देती है।
|
|
425
|
+
|
|
426
|
+
नामस्थान (namespace) के अनुसार अनुवादों को व्यवस्थित करना (जैसे, `common.json`, `about.json`) कोड स्प्लिटिंग को सक्षम बनाता है और बंडल का आकार कम करता है। आप केवल उन अनुवादों को लोड करते हैं जो प्रत्येक पेज के लिए आवश्यक होते हैं, जिससे प्रदर्शन में सुधार होता है।
|
|
427
|
+
|
|
428
|
+
```json fileName="src/locales/en/common.json"
|
|
429
|
+
{
|
|
430
|
+
"appTitle": "Next.js i18n App",
|
|
431
|
+
"appDescription": "Example Next.js application with internationalization using i18next"
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
```json fileName="src/locales/fr/common.json"
|
|
436
|
+
{
|
|
437
|
+
"appTitle": "Application Next.js i18n",
|
|
438
|
+
"appDescription": "Exemple d'application Next.js avec internationalisation utilisant i18next"
|
|
439
|
+
}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
```json fileName="src/locales/en/home.json"
|
|
443
|
+
{
|
|
444
|
+
"title": "Home",
|
|
445
|
+
"description": "Home page description",
|
|
446
|
+
"welcome": "Welcome",
|
|
447
|
+
"greeting": "Hello, world!",
|
|
448
|
+
"aboutPage": "About Page",
|
|
449
|
+
"documentation": "Documentation"
|
|
450
|
+
}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
```json fileName="src/locales/hi/home.json"
|
|
454
|
+
{
|
|
455
|
+
"title": "मुखपृष्ठ",
|
|
456
|
+
"description": "मुखपृष्ठ विवरण",
|
|
457
|
+
"welcome": "स्वागत है",
|
|
458
|
+
"greeting": "नमस्ते, दुनिया!",
|
|
459
|
+
"aboutPage": "के बारे में पृष्ठ",
|
|
460
|
+
"documentation": "प्रलेखन"
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
```json fileName="src/locales/hi/about.json"
|
|
465
|
+
{
|
|
466
|
+
"title": "के बारे में",
|
|
467
|
+
"description": "के बारे में पृष्ठ विवरण",
|
|
468
|
+
"counter": {
|
|
469
|
+
"label": "काउंटर",
|
|
470
|
+
"increment": "बढ़ाएं",
|
|
471
|
+
"description": "काउंटर बढ़ाने के लिए बटन पर क्लिक करें"
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### चरण 9: अपने पृष्ठों में अनुवादों का उपयोग करें
|
|
477
|
+
|
|
478
|
+
एक पेज कॉम्पोनेंट बनाएं जो सर्वर पर i18next को इनिशियलाइज़ करता है और अनुवादों को सर्वर और क्लाइंट दोनों कॉम्पोनेंट्स को पास करता है। यह सुनिश्चित करता है कि अनुवाद रेंडरिंग से पहले लोड हो जाएं और कंटेंट फ्लैशिंग से बचा जा सके।
|
|
479
|
+
|
|
480
|
+
सर्वर-साइड इनिशियलाइज़ेशन पेज के रेंडर होने से पहले अनुवाद लोड करता है, जिससे SEO बेहतर होता है और FOUC (फ्लैश ऑफ अनस्टाइल्ड कंटेंट) से बचाव होता है। प्रीलोडेड रिसोर्सेज को क्लाइंट प्रोवाइडर को पास करके, हम डुप्लिकेट फेचिंग से बचते हैं और स्मूथ हाइड्रेशन सुनिश्चित करते हैं।
|
|
481
|
+
|
|
482
|
+
```tsx fileName="src/app/[locale]/about/index.tsx"
|
|
483
|
+
import I18nProvider from "@/components/I18nProvider";
|
|
484
|
+
import { initI18next } from "@/app/i18n/server";
|
|
485
|
+
import type { Locale } from "@/i18n.config";
|
|
486
|
+
import { namespaces as allNamespaces, type Namespace } from "@/i18n.namespaces";
|
|
487
|
+
import type { ResourceLanguage } from "i18next";
|
|
488
|
+
import ClientComponent from "@/components/ClientComponent";
|
|
489
|
+
import ServerComponent from "@/components/ServerComponent";
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* सर्वर कंपोनेंट पेज जो i18n इनिशियलाइज़ेशन को संभालता है
|
|
493
|
+
* सर्वर पर अनुवादों को प्री-लोड करता है और उन्हें क्लाइंट कंपोनेंट्स को पास करता है
|
|
494
|
+
*/
|
|
495
|
+
export default async function AboutPage({
|
|
496
|
+
params: { locale },
|
|
497
|
+
}: {
|
|
498
|
+
params: { locale: Locale };
|
|
499
|
+
}) {
|
|
500
|
+
// परिभाषित करें कि इस पेज को कौन से अनुवाद नेमस्पेस की आवश्यकता है
|
|
501
|
+
// टाइप सुरक्षा और ऑटोकंप्लीट के लिए केंद्रीकृत सूची का पुन: उपयोग करें
|
|
502
|
+
const pageNamespaces = allNamespaces;
|
|
503
|
+
|
|
504
|
+
// आवश्यक नेमस्पेस के साथ सर्वर पर i18next को इनिशियलाइज़ करें
|
|
505
|
+
// यह सर्वर-साइड अनुवाद JSON फ़ाइलें लोड करता है
|
|
506
|
+
const i18n = await initI18next(locale, pageNamespaces);
|
|
507
|
+
|
|
508
|
+
// "about" namespace के लिए एक स्थिर अनुवाद फ़ंक्शन प्राप्त करें
|
|
509
|
+
// getFixedT namespace को लॉक करता है, इसलिए t("title") का उपयोग करें बजाय t("about:title") के
|
|
510
|
+
const tAbout = i18n.getFixedT(locale, "about");
|
|
511
|
+
|
|
512
|
+
// i18n instance से अनुवाद बंडल निकालें
|
|
513
|
+
// यह डेटा I18nProvider को पास किया जाता है ताकि क्लाइंट-साइड i18n को हाइड्रेट किया जा सके
|
|
514
|
+
// FOUC (Flash of Untranslated Content) को रोकता है और डुप्लिकेट fetching से बचाता है
|
|
515
|
+
const resources = Object.fromEntries(
|
|
516
|
+
pageNamespaces.map((ns) => [ns, i18n.getResourceBundle(locale, ns)])
|
|
517
|
+
) satisfies Record<Namespace, ResourceLanguage>;
|
|
518
|
+
|
|
519
|
+
return (
|
|
520
|
+
<I18nProvider
|
|
521
|
+
locale={locale}
|
|
522
|
+
namespaces={pageNamespaces}
|
|
523
|
+
resources={resources}
|
|
524
|
+
>
|
|
525
|
+
<main>
|
|
526
|
+
<h1>{tAbout("title")}</h1>
|
|
527
|
+
|
|
528
|
+
<ClientComponent />
|
|
529
|
+
<ServerComponent t={tAbout} locale={locale} count={0} />
|
|
530
|
+
</main>
|
|
531
|
+
</I18nProvider>
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### चरण 10: क्लाइंट कंपोनेंट्स में अनुवाद का उपयोग करें
|
|
537
|
+
|
|
538
|
+
क्लाइंट कंपोनेंट्स अनुवादों तक पहुँचने के लिए `useTranslation` हुक का उपयोग कर सकते हैं। यह हुक अनुवाद फ़ंक्शन और i18n इंस्टेंस तक पहुँच प्रदान करता है, जिससे आप सामग्री का अनुवाद कर सकते हैं और लोकल जानकारी प्राप्त कर सकते हैं।
|
|
539
|
+
|
|
540
|
+
क्लाइंट कंपोनेंट्स को अनुवादों तक पहुँचने के लिए React हुक्स की आवश्यकता होती है। `useTranslation` हुक i18next के साथ सहजता से एकीकृत होता है और जब लोकल बदलता है तो प्रतिक्रियाशील अपडेट प्रदान करता है।
|
|
541
|
+
|
|
542
|
+
> सुनिश्चित करें कि पेज/प्रोवाइडर में केवल आवश्यक namespaces शामिल हों (जैसे, `about`)।
|
|
543
|
+
> यदि आप React < 19 का उपयोग कर रहे हैं, तो भारी फॉर्मेटर्स जैसे `Intl.NumberFormat` को मेमोज़ करें।
|
|
544
|
+
|
|
545
|
+
```tsx fileName="src/components/ClientComponent.tsx"
|
|
546
|
+
"use client";
|
|
547
|
+
|
|
548
|
+
import { useState } from "react";
|
|
549
|
+
import { useTranslation } from "react-i18next";
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* क्लाइंट कंपोनेंट उदाहरण जो React hooks का उपयोग करता है अनुवादों के लिए
|
|
553
|
+
* useState, useEffect, और useTranslation जैसे hooks का उपयोग कर सकता है
|
|
554
|
+
*/
|
|
555
|
+
const ClientComponent = () => {
|
|
556
|
+
// useTranslation hook अनुवाद फ़ंक्शन और i18n इंस्टेंस तक पहुंच प्रदान करता है
|
|
557
|
+
// केवल "about" namespace के अनुवाद लोड करने के लिए namespace निर्दिष्ट करें
|
|
558
|
+
const { t, i18n } = useTranslation("about");
|
|
559
|
+
const [count, setCount] = useState(0);
|
|
560
|
+
|
|
561
|
+
// locale-संवेदनशील संख्या स्वरूपक बनाएँ
|
|
562
|
+
// i18n.language वर्तमान locale प्रदान करता है (जैसे, "en", "fr")
|
|
563
|
+
// Intl.NumberFormat संख्याओं को locale के अनुसार स्वरूपित करता है
|
|
564
|
+
const numberFormat = new Intl.NumberFormat(i18n.language);
|
|
565
|
+
|
|
566
|
+
return (
|
|
567
|
+
<div className="flex flex-col items-center gap-4">
|
|
568
|
+
{/* स्थानीय-विशिष्ट स्वरूपण का उपयोग करके संख्या स्वरूपित करें */}
|
|
569
|
+
<p className="text-5xl font-bold text-white m-0">
|
|
570
|
+
{numberFormat.format(count)}
|
|
571
|
+
</p>
|
|
572
|
+
<button
|
|
573
|
+
type="button"
|
|
574
|
+
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
|
575
|
+
aria-label={t("counter.label")}
|
|
576
|
+
onClick={() => setCount((c) => c + 1)}
|
|
577
|
+
>
|
|
578
|
+
{t("counter.increment")}
|
|
579
|
+
</button>
|
|
580
|
+
</div>
|
|
581
|
+
);
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
export default ClientComponent;
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### चरण 11: सर्वर कंपोनेंट्स में अनुवादों का उपयोग करें
|
|
588
|
+
|
|
589
|
+
सर्वर कंपोनेंट्स React hooks का उपयोग नहीं कर सकते हैं, इसलिए वे अपने पैरेंट कंपोनेंट्स से props के माध्यम से अनुवाद प्राप्त करते हैं। यह तरीका सर्वर कंपोनेंट्स को synchronous बनाए रखता है और उन्हें क्लाइंट कंपोनेंट्स के अंदर नेस्ट करने की अनुमति देता है।
|
|
590
|
+
|
|
591
|
+
सर्वर कंपोनेंट्स जो क्लाइंट बाउंड्रीज़ के अंतर्गत नेस्ट हो सकते हैं, उन्हें synchronous होना आवश्यक है। अनुवादित स्ट्रिंग्स और locale जानकारी को props के रूप में पास करके, हम async ऑपरेशंस से बचते हैं और सही रेंडरिंग सुनिश्चित करते हैं।
|
|
592
|
+
|
|
593
|
+
```tsx fileName="src/components/ServerComponent.tsx"
|
|
594
|
+
import type { TFunction } from "i18next";
|
|
595
|
+
|
|
596
|
+
type ServerComponentProps = {
|
|
597
|
+
// पैरेंट सर्वर कंपोनेंट से पास किया गया अनुवाद फ़ंक्शन
|
|
598
|
+
// सर्वर कंपोनेंट्स hooks का उपयोग नहीं कर सकते, इसलिए अनुवाद props के माध्यम से आते हैं
|
|
599
|
+
t: TFunction<"about">;
|
|
600
|
+
locale: string;
|
|
601
|
+
count: number;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* सर्वर कंपोनेंट उदाहरण - अनुवाद props के माध्यम से प्राप्त करता है
|
|
606
|
+
* क्लाइंट कंपोनेंट्स (async सर्वर कंपोनेंट्स) के अंदर नेस्ट किया जा सकता है
|
|
607
|
+
* React hooks का उपयोग नहीं कर सकता, इसलिए सभी डेटा props या async ऑपरेशंस से आना चाहिए
|
|
608
|
+
*/
|
|
609
|
+
const ServerComponent = ({ t, locale, count }: ServerComponentProps) => {
|
|
610
|
+
// locale का उपयोग करके सर्वर-साइड नंबर फॉर्मेट करें
|
|
611
|
+
// यह SSR के दौरान सर्वर पर चलता है, जिससे प्रारंभिक पेज लोड बेहतर होता है
|
|
612
|
+
const formatted = new Intl.NumberFormat(locale).format(count);
|
|
613
|
+
|
|
614
|
+
return (
|
|
615
|
+
<div className="flex flex-col items-center gap-4">
|
|
616
|
+
<p className="text-5xl font-bold text-white m-0">{formatted}</p>
|
|
617
|
+
{/* prop के रूप में पास किए गए अनुवाद फ़ंक्शन का उपयोग करें */}
|
|
618
|
+
<div className="flex flex-col items-center gap-2">
|
|
619
|
+
<span className="text-xl font-semibold text-white">
|
|
620
|
+
{t("counter.label")}
|
|
621
|
+
</span>
|
|
622
|
+
<span className="text-sm opacity-80 italic">
|
|
623
|
+
{t("counter.description")}
|
|
624
|
+
</span>
|
|
625
|
+
</div>
|
|
626
|
+
</div>
|
|
627
|
+
);
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
export default ServerComponent;
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
### (वैकल्पिक) चरण 12: अपनी सामग्री की भाषा बदलें
|
|
636
|
+
|
|
637
|
+
Next.js में अपनी सामग्री की भाषा बदलने के लिए, अनुशंसित तरीका है locale-पूर्वसर्ग वाले URL और Next.js लिंक का उपयोग करना। नीचे दिया गया उदाहरण वर्तमान locale को route से पढ़ता है, pathname से इसे हटाता है, और उपलब्ध प्रत्येक locale के लिए एक लिंक रेंडर करता है।
|
|
638
|
+
|
|
639
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx"
|
|
640
|
+
"use client";
|
|
641
|
+
|
|
642
|
+
import Link from "next/link";
|
|
643
|
+
import { useParams, usePathname } from "next/navigation";
|
|
644
|
+
import { useMemo } from "react";
|
|
645
|
+
import { defaultLocale, getCookie, type Locale, locales } from "@/i18n.config";
|
|
646
|
+
|
|
647
|
+
export default function LocaleSwitcher() {
|
|
648
|
+
const params = useParams();
|
|
649
|
+
const pathname = usePathname();
|
|
650
|
+
|
|
651
|
+
const activeLocale = (params?.locale as Locale | undefined) ?? defaultLocale;
|
|
652
|
+
|
|
653
|
+
const getLocaleLabel = (locale: Locale): string => {
|
|
654
|
+
try {
|
|
655
|
+
const displayNames = new Intl.DisplayNames([locale], {
|
|
656
|
+
type: "language",
|
|
657
|
+
});
|
|
658
|
+
return displayNames.of(locale) ?? locale.toUpperCase();
|
|
659
|
+
} catch {
|
|
660
|
+
return locale.toUpperCase();
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
const basePath = useMemo(() => {
|
|
665
|
+
if (!pathname) return "/";
|
|
666
|
+
|
|
667
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
668
|
+
|
|
669
|
+
if (segments.length === 0) return "/";
|
|
670
|
+
|
|
671
|
+
const maybeLocale = segments[0] as Locale;
|
|
672
|
+
|
|
673
|
+
if ((locales as readonly string[]).includes(maybeLocale)) {
|
|
674
|
+
const rest = segments.slice(1).join("/");
|
|
675
|
+
return rest ? `/${rest}` : "/";
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
return pathname;
|
|
679
|
+
}, [pathname]);
|
|
680
|
+
|
|
681
|
+
return (
|
|
682
|
+
<nav aria-label="भाषा चयनकर्ता">
|
|
683
|
+
{(locales as readonly Locale[]).map((locale) => {
|
|
684
|
+
const isActive = locale === activeLocale;
|
|
685
|
+
|
|
686
|
+
const href =
|
|
687
|
+
locale === defaultLocale ? basePath : `/${locale}${basePath}`;
|
|
688
|
+
|
|
689
|
+
return (
|
|
690
|
+
<Link
|
|
691
|
+
key={locale}
|
|
692
|
+
href={href}
|
|
693
|
+
aria-current={isActive ? "पृष्ठ" : undefined}
|
|
694
|
+
onClick={() => {
|
|
695
|
+
document.cookie = getCookie(locale);
|
|
696
|
+
}}
|
|
697
|
+
>
|
|
698
|
+
{getLocaleLabel(locale)}
|
|
699
|
+
</Link>
|
|
700
|
+
);
|
|
701
|
+
})}
|
|
702
|
+
</nav>
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
### (वैकल्पिक) चरण 13: एक स्थानीयकृत Link कॉम्पोनेंट बनाएं
|
|
708
|
+
|
|
709
|
+
अपने ऐप में स्थानीयकृत URLs का पुन: उपयोग नेविगेशन को सुसंगत और SEO-अनुकूल बनाए रखता है। `next/link` को एक छोटे हेल्पर में लपेटें जो आंतरिक रूट्स के सामने सक्रिय locale जोड़ता है जबकि बाहरी URLs को अपरिवर्तित छोड़ता है।
|
|
710
|
+
|
|
711
|
+
```tsx fileName="src/components/LocalizedLink.tsx"
|
|
712
|
+
"use client";
|
|
713
|
+
|
|
714
|
+
import NextLink, { type LinkProps } from "next/link";
|
|
715
|
+
import { useParams } from "next/navigation";
|
|
716
|
+
import type { ComponentProps, PropsWithChildren } from "react";
|
|
717
|
+
import {
|
|
718
|
+
defaultLocale,
|
|
719
|
+
type Locale,
|
|
720
|
+
locales,
|
|
721
|
+
localizedPath,
|
|
722
|
+
} from "@/i18n.config";
|
|
723
|
+
|
|
724
|
+
const isExternal = (href: string) => /^https?:\/\//.test(href);
|
|
725
|
+
|
|
726
|
+
type LocalizedLinkProps = PropsWithChildren<
|
|
727
|
+
Omit<LinkProps, "href"> &
|
|
728
|
+
Omit<ComponentProps<"a">, "href"> & { href: string; locale?: Locale }
|
|
729
|
+
>;
|
|
730
|
+
|
|
731
|
+
export default function LocalizedLink({
|
|
732
|
+
href,
|
|
733
|
+
locale,
|
|
734
|
+
children,
|
|
735
|
+
...props
|
|
736
|
+
}: LocalizedLinkProps) {
|
|
737
|
+
const params = useParams();
|
|
738
|
+
const fallback = (params?.locale as Locale | undefined) ?? defaultLocale;
|
|
739
|
+
const normalizedLocale = (locales as readonly string[]).includes(fallback)
|
|
740
|
+
? ((locale ?? fallback) as Locale)
|
|
741
|
+
: defaultLocale;
|
|
742
|
+
|
|
743
|
+
const normalizedPath = href.startsWith("/") ? href : `/${href}`;
|
|
744
|
+
const localizedHref = isExternal(href)
|
|
745
|
+
? href
|
|
746
|
+
: localizedPath(normalizedLocale, normalizedPath);
|
|
747
|
+
|
|
748
|
+
return (
|
|
749
|
+
<NextLink href={localizedHref} {...props}>
|
|
750
|
+
{children}
|
|
751
|
+
</NextLink>
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
> सुझाव: क्योंकि `LocalizedLink` एक ड्रॉप-इन रिप्लेसमेंट है, इसलिए आयातों को धीरे-धीरे बदलकर और कंपोनेंट को locale-विशिष्ट URLs संभालने दें, क्रमिक रूप से माइग्रेट करें।
|
|
757
|
+
|
|
758
|
+
### (वैकल्पिक) चरण 14: सर्वर एक्शन्स के अंदर सक्रिय locale तक पहुँचें
|
|
759
|
+
|
|
760
|
+
सर्वर एक्शन्स को अक्सर ईमेल, लॉगिंग, या थर्ड-पार्टी इंटीग्रेशन के लिए वर्तमान locale की आवश्यकता होती है। अपने प्रॉक्सी द्वारा सेट किए गए locale कुकी को `Accept-Language` हेडर के साथ एक फॉलबैक के रूप में संयोजित करें।
|
|
761
|
+
|
|
762
|
+
```ts fileName="src/app/actions/get-current-locale.ts"
|
|
763
|
+
"use server";
|
|
764
|
+
|
|
765
|
+
import { cookies, headers } from "next/headers";
|
|
766
|
+
import { defaultLocale, locales, type Locale } from "@/i18n.config";
|
|
767
|
+
|
|
768
|
+
const KNOWN_LOCALES = new Set(locales as readonly string[]);
|
|
769
|
+
|
|
770
|
+
const normalize = (value: string | undefined): Locale | undefined => {
|
|
771
|
+
if (!value) return undefined;
|
|
772
|
+
const base = value.toLowerCase().split("-")[0];
|
|
773
|
+
return KNOWN_LOCALES.has(base) ? (base as Locale) : undefined;
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
export async function getCurrentLocale(): Promise<Locale> {
|
|
777
|
+
const cookieLocale = normalize(cookies().get("NEXT_LOCALE")?.value);
|
|
778
|
+
|
|
779
|
+
if (cookieLocale) return cookieLocale;
|
|
780
|
+
|
|
781
|
+
const headerLocale = normalize(headers().get("accept-language"));
|
|
782
|
+
return headerLocale ?? defaultLocale;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// वर्तमान locale का उपयोग करने वाली सर्वर क्रिया का उदाहरण
|
|
786
|
+
export async function stuffFromServer(formData: FormData) {
|
|
787
|
+
const locale = await getCurrentLocale();
|
|
788
|
+
|
|
789
|
+
// स्थानीयकृत साइड इफेक्ट्स (ईमेल, CRM, आदि) के लिए locale का उपयोग करें
|
|
790
|
+
console.log(`Stuff from server with locale ${locale}`);
|
|
791
|
+
}
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
> क्योंकि यह हेल्पर Next.js कुकीज़ और हेडर्स पर निर्भर करता है, यह Route Handlers, Server Actions, और अन्य केवल सर्वर-संदर्भों में काम करता है।
|
|
795
|
+
|
|
796
|
+
### (वैकल्पिक) चरण 15: अपने मेटाडेटा का अंतरराष्ट्रीयकरण करें
|
|
797
|
+
|
|
798
|
+
सामग्री का अनुवाद करना महत्वपूर्ण है, लेकिन अंतरराष्ट्रीयकरण का मुख्य उद्देश्य आपकी वेबसाइट को दुनिया के लिए अधिक दृश्यनीय बनाना है। I18n आपकी वेबसाइट की दृश्यता को उचित SEO के माध्यम से बढ़ाने के लिए एक अद्भुत साधन है।
|
|
799
|
+
|
|
800
|
+
सही तरीके से अंतरराष्ट्रीयकृत मेटाडेटा खोज इंजन को यह समझने में मदद करता है कि आपकी पृष्ठों पर कौन-कौन सी भाषाएँ उपलब्ध हैं। इसमें hreflang मेटा टैग सेट करना, शीर्षक और विवरणों का अनुवाद करना, और प्रत्येक लोकल के लिए कैनोनिकल URL सही ढंग से सेट करना शामिल है।
|
|
801
|
+
|
|
802
|
+
यहाँ बहुभाषी SEO के संबंध में कुछ अच्छी प्रथाओं की सूची है:
|
|
803
|
+
|
|
804
|
+
- `<head>` टैग में hreflang मेटा टैग सेट करें ताकि सर्च इंजन समझ सकें कि पेज पर कौन-कौन सी भाषाएँ उपलब्ध हैं
|
|
805
|
+
- sitemap.xml में सभी पेज अनुवादों को `http://www.w3.org/1999/xhtml` XML स्कीमा का उपयोग करके सूचीबद्ध करें
|
|
806
|
+
- robots.txt से प्रीफिक्स वाले पेजों को बाहर निकालना न भूलें (जैसे, `/dashboard`, `/fr/dashboard`, `/es/dashboard`)
|
|
807
|
+
- सबसे स्थानीयकृत पेज पर रीडायरेक्ट करने के लिए कस्टम Link कंपोनेंट का उपयोग करें (जैसे, फ्रेंच में `<a href="/fr/about">À propos</a>`)
|
|
808
|
+
|
|
809
|
+
डेवलपर्स अक्सर अपने पेजों को विभिन्न लोकल्स में सही ढंग से संदर्भित करना भूल जाते हैं। आइए इसे ठीक करें:
|
|
810
|
+
|
|
811
|
+
```tsx fileName="src/app/[locale]/about/layout.tsx"
|
|
812
|
+
import type { Metadata } from "next";
|
|
813
|
+
import {
|
|
814
|
+
locales,
|
|
815
|
+
defaultLocale,
|
|
816
|
+
localizedPath,
|
|
817
|
+
absoluteUrl,
|
|
818
|
+
} from "@/i18n.config";
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* प्रत्येक लोकल संस्करण के लिए SEO मेटाडेटा जनरेट करें
|
|
822
|
+
* यह फ़ंक्शन प्रत्येक locale के लिए build समय पर चलता है
|
|
823
|
+
*/
|
|
824
|
+
export async function generateMetadata({
|
|
825
|
+
params,
|
|
826
|
+
}: {
|
|
827
|
+
params: { locale: string };
|
|
828
|
+
}): Promise<Metadata> {
|
|
829
|
+
const { locale } = params;
|
|
830
|
+
|
|
831
|
+
// इस locale के लिए अनुवाद फ़ाइल को डायनामिक रूप से इम्पोर्ट करें
|
|
832
|
+
// मेटाडेटा के लिए अनुवादित शीर्षक और विवरण प्राप्त करने के लिए उपयोग किया जाता है
|
|
833
|
+
const messages = (await import(`@/locales/${locale}/about.json`)).default;
|
|
834
|
+
|
|
835
|
+
// सभी locales के लिए hreflang मैपिंग बनाएं
|
|
836
|
+
// खोज इंजन को भाषा विकल्प समझने में मदद करता है
|
|
837
|
+
// प्रारूप: { "en": "/about", "fr": "/fr/about" }
|
|
838
|
+
const languages = Object.fromEntries(
|
|
839
|
+
locales.map((locale) => [locale, localizedPath(locale, "/about")])
|
|
840
|
+
);
|
|
841
|
+
|
|
842
|
+
return {
|
|
843
|
+
title: messages.title,
|
|
844
|
+
description: messages.description,
|
|
845
|
+
alternates: {
|
|
846
|
+
// इस लोकल संस्करण के लिए कैनोनिकल URL
|
|
847
|
+
canonical: absoluteUrl(locale, "/about"),
|
|
848
|
+
// SEO के लिए भाषा विकल्प (hreflang टैग्स)
|
|
849
|
+
// "x-default" डिफ़ॉल्ट लोकल संस्करण निर्दिष्ट करता है
|
|
850
|
+
languages: {
|
|
851
|
+
...languages,
|
|
852
|
+
"x-default": absoluteUrl(defaultLocale, "/about"),
|
|
853
|
+
},
|
|
854
|
+
},
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
export default async function AboutPage() {
|
|
859
|
+
return <h1>About</h1>;
|
|
860
|
+
}
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
### (वैकल्पिक) चरण 16: अपने साइटमैप को अंतरराष्ट्रीयकृत करें
|
|
864
|
+
|
|
865
|
+
एक साइटमैप बनाएं जिसमें आपके पृष्ठों के सभी लोकल संस्करण शामिल हों। यह सर्च इंजन को आपकी सामग्री के सभी भाषा संस्करणों को खोजने और इंडेक्स करने में मदद करता है।
|
|
866
|
+
|
|
867
|
+
एक सही तरीके से अंतरराष्ट्रीयकृत साइटमैप सुनिश्चित करता है कि सर्च इंजन आपके पृष्ठों के सभी भाषा संस्करणों को खोज और इंडेक्स कर सके। इससे अंतरराष्ट्रीय खोज परिणामों में दृश्यता में सुधार होता है।
|
|
868
|
+
|
|
869
|
+
```ts fileName="src/app/sitemap.ts"
|
|
870
|
+
import type { MetadataRoute } from "next";
|
|
871
|
+
import { defaultLocale, locales } from "@/i18n";
|
|
872
|
+
|
|
873
|
+
const origin = "https://example.com";
|
|
874
|
+
|
|
875
|
+
// स्थानीयकृत पथ स्वरूपित करने का फ़ंक्शन
|
|
876
|
+
const formatterLocalizedPath = (locale: string, path: string) =>
|
|
877
|
+
locale === defaultLocale ? `${origin}${path}` : `${origin}/${locale}${path}`;
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* सभी स्थानीय भाषाओं और उनके स्थानीयकृत पथों का मानचित्र प्राप्त करें
|
|
881
|
+
*
|
|
882
|
+
* उदाहरण आउटपुट:
|
|
883
|
+
* {
|
|
884
|
+
* "en": "https://example.com",
|
|
885
|
+
* "fr": "https://example.com/fr",
|
|
886
|
+
* "es": "https://example.com/es",
|
|
887
|
+
* "x-default": "https://example.com"
|
|
888
|
+
* }
|
|
889
|
+
*/
|
|
890
|
+
const getLocalizedMap = (path: string) =>
|
|
891
|
+
Object.fromEntries([
|
|
892
|
+
...locales.map((locale) => [locale, formatterLocalizedPath(locale, path)]),
|
|
893
|
+
["x-default", formatterLocalizedPath(defaultLocale, path)],
|
|
894
|
+
]);
|
|
895
|
+
|
|
896
|
+
ts fileName="src/app/sitemap.ts"
|
|
897
|
+
// बेहतर SEO के लिए सभी locale वेरिएंट्स के साथ साइटमैप जनरेट करें
|
|
898
|
+
// alternates फ़ील्ड सर्च इंजनों को भाषा संस्करणों के बारे में बताता है
|
|
899
|
+
export default function sitemap(): MetadataRoute.Sitemap {
|
|
900
|
+
return [
|
|
901
|
+
{
|
|
902
|
+
url: formatterLocalizedPath(defaultLocale, "/"),
|
|
903
|
+
lastModified: new Date(),
|
|
904
|
+
changeFrequency: "monthly",
|
|
905
|
+
priority: 1.0,
|
|
906
|
+
alternates: { languages: getLocalizedMap("/") },
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
url: formatterLocalizedPath(defaultLocale, "/about"),
|
|
910
|
+
lastModified: new Date(),
|
|
911
|
+
changeFrequency: "monthly",
|
|
912
|
+
priority: 0.7,
|
|
913
|
+
alternates: { languages: getLocalizedMap("/about") },
|
|
914
|
+
},
|
|
915
|
+
];
|
|
916
|
+
}
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
### (वैकल्पिक) चरण 17: अपने robots.txt को अंतरराष्ट्रीयकृत करें
|
|
920
|
+
|
|
921
|
+
अपने संरक्षित रूट्स के सभी लोकल संस्करणों को सही ढंग से संभालने के लिए एक robots.txt फ़ाइल बनाएं। यह सुनिश्चित करता है कि सर्च इंजन किसी भी भाषा में एडमिन या डैशबोर्ड पेजों को इंडेक्स न करें।
|
|
922
|
+
|
|
923
|
+
सभी लोकल के लिए robots.txt को सही तरीके से कॉन्फ़िगर करने से सर्च इंजन संवेदनशील पृष्ठों को किसी भी भाषा में इंडेक्स करने से रोकता है। यह सुरक्षा और गोपनीयता के लिए महत्वपूर्ण है।
|
|
924
|
+
|
|
925
|
+
```ts fileName="src/app/robots.ts"
|
|
926
|
+
import type { MetadataRoute } from "next";
|
|
927
|
+
import { defaultLocale, locales } from "@/i18n";
|
|
928
|
+
|
|
929
|
+
const origin = "https://example.com";
|
|
930
|
+
|
|
931
|
+
// सभी लोकल के लिए पथ उत्पन्न करें (जैसे, /admin, /fr/admin, /es/admin)
|
|
932
|
+
const withAllLocales = (path: string) => [
|
|
933
|
+
path,
|
|
934
|
+
...locales
|
|
935
|
+
.filter((locale) => locale !== defaultLocale)
|
|
936
|
+
.map((locale) => `/${locale}${path}`),
|
|
937
|
+
];
|
|
938
|
+
|
|
939
|
+
const disallow = [...withAllLocales("/dashboard"), ...withAllLocales("/admin")];
|
|
940
|
+
|
|
941
|
+
export default function robots(): MetadataRoute.Robots {
|
|
942
|
+
return {
|
|
943
|
+
rules: { userAgent: "*", allow: ["/"], disallow },
|
|
944
|
+
host: origin,
|
|
945
|
+
sitemap: `${origin}/sitemap.xml`,
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
### (वैकल्पिक) चरण 18: लोकल रूटिंग के लिए मिडलवेयर सेट करें
|
|
951
|
+
|
|
952
|
+
एक प्रॉक्सी बनाएं जो स्वचालित रूप से उपयोगकर्ता की पसंदीदा भाषा का पता लगाए और उन्हें उपयुक्त लोकल-प्रिफिक्स्ड URL पर पुनः निर्देशित करे। यह उपयोगकर्ता अनुभव को बेहतर बनाता है क्योंकि सामग्री उनकी पसंदीदा भाषा में दिखाई जाती है।
|
|
953
|
+
|
|
954
|
+
मिडलवेयर यह सुनिश्चित करता है कि जब उपयोगकर्ता आपकी साइट पर आते हैं तो उन्हें स्वचालित रूप से उनकी पसंदीदा भाषा में पुनः निर्देशित किया जाए। यह भविष्य की यात्राओं के लिए उपयोगकर्ता की पसंद को कुकी में भी सहेजता है।
|
|
955
|
+
|
|
956
|
+
```ts fileName="src/proxy.ts"
|
|
957
|
+
import { NextResponse, type NextRequest } from "next/server";
|
|
958
|
+
import { defaultLocale, locales } from "@/i18n.config";
|
|
959
|
+
|
|
960
|
+
// एक्सटेंशन्स वाले फाइलों से मेल खाने के लिए Regex (जैसे .js, .css, .png)
|
|
961
|
+
// लोकल रूटिंग से स्टैटिक एसेट्स को बाहर करने के लिए उपयोग किया जाता है
|
|
962
|
+
const PUBLIC_FILE = /\.[^/]+$/;
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Accept-Language हेडर से लोकल निकालना
|
|
966
|
+
* "fr-CA", "en-US" जैसे फॉर्मेट्स को संभालता है
|
|
967
|
+
* अगर ब्राउज़र भाषा समर्थित नहीं है तो डिफ़ॉल्ट लोकल पर वापस जाता है
|
|
968
|
+
*/
|
|
969
|
+
const pickLocale = (accept: string | null) => {
|
|
970
|
+
// पहली भाषा प्राथमिकता प्राप्त करें (जैसे "fr-CA" से "fr-CA,en-US;q=0.9")
|
|
971
|
+
const raw = accept?.split(",")[0] ?? defaultLocale;
|
|
972
|
+
// बेस भाषा कोड निकालें (जैसे "fr" से "fr-CA")
|
|
973
|
+
const base = raw.toLowerCase().split("-")[0];
|
|
974
|
+
// जांचें कि क्या हम इस लोकल का समर्थन करते हैं, अन्यथा डिफ़ॉल्ट का उपयोग करें
|
|
975
|
+
return (locales as readonly string[]).includes(base) ? base : defaultLocale;
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Next.js के लिए locale पहचान और रूटिंग का प्रॉक्सी
|
|
980
|
+
* पेज रेंडर होने से पहले हर अनुरोध पर चलता है
|
|
981
|
+
* आवश्यक होने पर स्वचालित रूप से locale-पूर्वसर्ग वाले URL पर पुनर्निर्देशित करता है
|
|
982
|
+
*/
|
|
983
|
+
export function proxy(request: NextRequest) {
|
|
984
|
+
const { pathname } = request.nextUrl;
|
|
985
|
+
|
|
986
|
+
// Next.js के आंतरिक हिस्सों, API रूट्स, और स्थैतिक फाइलों के लिए प्रॉक्सी को छोड़ दें
|
|
987
|
+
// इन्हें locale-पूर्वसर्ग नहीं होना चाहिए
|
|
988
|
+
if (
|
|
989
|
+
pathname.startsWith("/_next") ||
|
|
990
|
+
pathname.startsWith("/api") ||
|
|
991
|
+
pathname.startsWith("/static") ||
|
|
992
|
+
PUBLIC_FILE.test(pathname)
|
|
993
|
+
) {
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// जांचें कि URL में पहले से ही locale पूर्वसर्ग है या नहीं
|
|
998
|
+
// उदाहरण: "/fr/about" या "/en" सही लौटाएगा
|
|
999
|
+
const hasLocale = (locales as readonly string[]).some(
|
|
1000
|
+
(locale) => pathname === `/${locale}` || pathname.startsWith(`/${locale}/`)
|
|
1001
|
+
);
|
|
1002
|
+
|
|
1003
|
+
// यदि कोई locale उपसर्ग नहीं है, तो locale का पता लगाएं और पुनर्निर्देशित करें
|
|
1004
|
+
if (!hasLocale) {
|
|
1005
|
+
// पहले कुकी से locale प्राप्त करने का प्रयास करें (उपयोगकर्ता की प्राथमिकता)
|
|
1006
|
+
const cookieLocale = request.cookies.get("NEXT_LOCALE")?.value;
|
|
1007
|
+
|
|
1008
|
+
// यदि कुकी locale मान्य है तो उसका उपयोग करें, अन्यथा ब्राउज़र हेडर से पता लगाएं
|
|
1009
|
+
const locale =
|
|
1010
|
+
cookieLocale && (locales as readonly string[]).includes(cookieLocale)
|
|
1011
|
+
? cookieLocale
|
|
1012
|
+
: pickLocale(request.headers.get("accept-language"));
|
|
1013
|
+
|
|
1014
|
+
// pathname संशोधित करने के लिए URL क्लोन करें
|
|
1015
|
+
const url = request.nextUrl.clone();
|
|
1016
|
+
// pathname में locale उपसर्ग जोड़ें
|
|
1017
|
+
// डबल स्लैश से बचने के लिए रूट पथ को विशेष रूप से संभालें
|
|
1018
|
+
url.pathname = `/${locale}${pathname === "/" ? "" : pathname}`;
|
|
1019
|
+
|
|
1020
|
+
// रीडायरेक्ट प्रतिक्रिया बनाएं और locale कुकी सेट करें
|
|
1021
|
+
const res = NextResponse.redirect(url);
|
|
1022
|
+
res.cookies.set("NEXT_LOCALE", locale, { path: "/" });
|
|
1023
|
+
return res;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
export const config = {
|
|
1028
|
+
matcher: [
|
|
1029
|
+
// सभी पथों से मेल खाएं सिवाय:
|
|
1030
|
+
// - API रूट्स (/api/*)
|
|
1031
|
+
// - Next.js आंतरिक (/_next/*)
|
|
1032
|
+
// - स्थैतिक फाइलें (/static/*)
|
|
1033
|
+
// - एक्सटेंशन वाली फाइलें (.*\\..*)
|
|
1034
|
+
"/((?!api|_next|static|.*\\..*).*)",
|
|
1035
|
+
],
|
|
1036
|
+
};
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
### (वैकल्पिक) चरण 19: Intlayer का उपयोग करके अपने अनुवादों को स्वचालित करें
|
|
1040
|
+
|
|
1041
|
+
Intlayer एक **मुफ्त** और **ओपन-सोर्स** लाइब्रेरी है जो आपके एप्लिकेशन में स्थानीयकरण प्रक्रिया में सहायता करने के लिए डिज़ाइन की गई है। जबकि i18next अनुवाद लोडिंग और प्रबंधन को संभालता है, Intlayer अनुवाद कार्यप्रवाह को स्वचालित करने में मदद करता है।
|
|
1042
|
+
|
|
1043
|
+
अनुवादों का प्रबंधन मैन्युअल रूप से करना समय लेने वाला और त्रुटिपूर्ण हो सकता है। Intlayer अनुवाद परीक्षण, निर्माण, और प्रबंधन को स्वचालित करता है, जिससे आपका समय बचता है और आपके एप्लिकेशन में स्थिरता सुनिश्चित होती है।
|
|
1044
|
+
|
|
1045
|
+
Intlayer आपको निम्नलिखित सुविधाएँ प्रदान करता है:
|
|
1046
|
+
|
|
1047
|
+
- **अपने कोडबेस में अपनी सामग्री जहाँ चाहें घोषित करें**
|
|
1048
|
+
Intlayer आपको `.content.{ts|js|json}` फाइलों का उपयोग करके अपनी सामग्री अपने कोडबेस में जहाँ चाहें घोषित करने की अनुमति देता है। यह आपकी सामग्री के बेहतर संगठन की अनुमति देगा, जिससे आपके कोडबेस की पठनीयता और रखरखाव में सुधार होगा।
|
|
1049
|
+
|
|
1050
|
+
- **लापता अनुवादों का परीक्षण करें**
|
|
1051
|
+
Intlayer परीक्षण फ़ंक्शन प्रदान करता है जिन्हें आप अपनी CI/CD पाइपलाइन में या अपनी यूनिट टेस्ट में एकीकृत कर सकते हैं। अपने अनुवादों के परीक्षण के बारे में अधिक जानने के लिए देखें [testing your translations](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/testing.md)।
|
|
1052
|
+
|
|
1053
|
+
- **अपने अनुवादों को स्वचालित करें**,
|
|
1054
|
+
Intlayer आपके अनुवादों को स्वचालित करने के लिए एक CLI और VSCode एक्सटेंशन प्रदान करता है। इसे आपके CI/CD पाइपलाइन में एकीकृत किया जा सकता है। [अपने अनुवादों को स्वचालित करने के बारे में अधिक जानें](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_cli.md)।
|
|
1055
|
+
आप अपनी **अपनी API कुंजी और अपनी पसंद के AI प्रदाता का उपयोग कर सकते हैं**। यह संदर्भ-सचेत अनुवाद भी प्रदान करता है, देखें [सामग्री भरें](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/autoFill.md)।
|
|
1056
|
+
|
|
1057
|
+
- **बाहरी सामग्री से कनेक्ट करें**
|
|
1058
|
+
- **अपने अनुवादों को स्वचालित करें**,
|
|
1059
|
+
Intlayer एक CLI और एक VSCode एक्सटेंशन प्रदान करता है ताकि आप अपने अनुवादों को स्वचालित कर सकें। इसे आपकी CI/CD पाइपलाइन में एकीकृत किया जा सकता है। [अपने अनुवादों को स्वचालित करने](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_cli.md) के बारे में अधिक जानें।
|
|
1060
|
+
आप अपनी **अपनी API कुंजी और अपनी पसंद के AI प्रदाता** का उपयोग कर सकते हैं। यह संदर्भ-सचेत अनुवाद भी प्रदान करता है, देखें [सामग्री भरें](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/autoFill.md)।
|
|
1061
|
+
|
|
1062
|
+
- **बाहरी सामग्री से कनेक्ट करें**
|
|
1063
|
+
Intlayer आपको अपनी सामग्री को एक बाहरी कंटेंट मैनेजमेंट सिस्टम (CMS) से जोड़ने की अनुमति देता है। इसे एक अनुकूलित तरीके से प्राप्त करने और अपनी JSON संसाधनों में सम्मिलित करने के लिए। [बाहरी सामग्री प्राप्त करने](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/dictionary/function_fetching.md) के बारे में अधिक जानें।
|
|
1064
|
+
|
|
1065
|
+
- **विज़ुअल एडिटर**
|
|
1066
|
+
Intlayer एक मुफ्त विज़ुअल एडिटर प्रदान करता है जिससे आप अपनी सामग्री को विज़ुअल एडिटर का उपयोग करके संपादित कर सकते हैं। [अपने अनुवादों का विज़ुअल संपादन](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/intlayer_visual_editor.md) के बारे में अधिक जानें।
|
|
1067
|
+
|
|
1068
|
+
और भी बहुत कुछ। Intlayer द्वारा प्रदान की गई सभी विशेषताओं को खोजने के लिए, कृपया [Intlayer के महत्व की दस्तावेज़ीकरण](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/interest_of_intlayer.md) देखें।
|