@intlayer/docs 5.8.1-canary.0 → 6.0.0-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/rag_powered_documentation_assistant.md +282 -0
- package/blog/de/rag_powered_documentation_assistant.md +282 -0
- package/blog/en/rag_powered_documentation_assistant.md +289 -0
- package/blog/en-GB/rag_powered_documentation_assistant.md +284 -0
- package/blog/es/rag_powered_documentation_assistant.md +308 -0
- package/blog/fr/rag_powered_documentation_assistant.md +308 -0
- package/blog/hi/rag_powered_documentation_assistant.md +284 -0
- package/blog/it/rag_powered_documentation_assistant.md +284 -0
- package/blog/ja/rag_powered_documentation_assistant.md +284 -0
- package/blog/ko/rag_powered_documentation_assistant.md +283 -0
- package/blog/pt/rag_powered_documentation_assistant.md +284 -0
- package/blog/ru/rag_powered_documentation_assistant.md +284 -0
- package/blog/tr/index.md +69 -0
- package/blog/tr/internationalization_and_SEO.md +273 -0
- package/blog/tr/intlayer_with_i18next.md +162 -0
- package/blog/tr/intlayer_with_next-i18next.md +367 -0
- package/blog/tr/intlayer_with_next-intl.md +392 -0
- package/blog/tr/intlayer_with_react-i18next.md +346 -0
- package/blog/tr/intlayer_with_react-intl.md +345 -0
- package/blog/tr/list_i18n_technologies/CMS/drupal.md +143 -0
- package/blog/tr/list_i18n_technologies/CMS/wix.md +167 -0
- package/blog/tr/list_i18n_technologies/CMS/wordpress.md +188 -0
- package/blog/tr/list_i18n_technologies/frameworks/angular.md +125 -0
- package/blog/tr/list_i18n_technologies/frameworks/flutter.md +150 -0
- package/blog/tr/list_i18n_technologies/frameworks/react-native.md +217 -0
- package/blog/tr/list_i18n_technologies/frameworks/react.md +155 -0
- package/blog/tr/list_i18n_technologies/frameworks/svelte.md +129 -0
- package/blog/tr/list_i18n_technologies/frameworks/vue.md +130 -0
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +170 -0
- package/blog/tr/rag_powered_documentation_assistant.md +284 -0
- package/blog/tr/react-i18next_vs_react-intl_vs_intlayer.md +162 -0
- package/blog/tr/vue-i18n_vs_intlayer.md +276 -0
- package/blog/tr/what_is_internationalization.md +166 -0
- package/blog/zh/rag_powered_documentation_assistant.md +284 -0
- package/dist/cjs/generated/blog.entry.cjs +212 -0
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +660 -132
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +84 -0
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +6 -0
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +212 -0
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +660 -132
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +84 -0
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +6 -0
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/types/generated/blog.entry.d.ts +1 -0
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +5 -2
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
- package/dist/types/generated/legal.entry.d.ts.map +1 -1
- package/docs/ar/autoFill.md +41 -40
- package/docs/ar/configuration.md +202 -199
- package/docs/ar/dictionary/content_file.md +1059 -0
- package/docs/ar/intlayer_CMS.md +4 -4
- package/docs/ar/intlayer_with_nestjs.md +271 -0
- package/docs/ar/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ar/intlayer_with_react_router_v7.md +533 -0
- package/docs/ar/intlayer_with_tanstack.md +465 -299
- package/docs/ar/intlayer_with_vite+preact.md +7 -7
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/ar/packages/vite-intlayer/index.md +3 -3
- package/docs/ar/readme.md +261 -0
- package/docs/ar/testing.md +199 -0
- package/docs/de/autoFill.md +42 -19
- package/docs/de/configuration.md +155 -147
- package/docs/de/dictionary/content_file.md +1059 -0
- package/docs/de/intlayer_CMS.md +4 -5
- package/docs/de/intlayer_with_nestjs.md +270 -0
- package/docs/de/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/de/intlayer_with_react_router_v7.md +537 -0
- package/docs/de/intlayer_with_tanstack.md +469 -302
- package/docs/de/intlayer_with_vite+preact.md +7 -7
- package/docs/de/intlayer_with_vite+react.md +7 -7
- package/docs/de/intlayer_with_vite+vue.md +9 -9
- package/docs/de/packages/vite-intlayer/index.md +3 -3
- package/docs/de/readme.md +261 -0
- package/docs/de/testing.md +200 -0
- package/docs/en/CI_CD.md +4 -6
- package/docs/en/autoFill.md +25 -5
- package/docs/en/configuration.md +45 -54
- package/docs/en/dictionary/content_file.md +1054 -0
- package/docs/en/intlayer_CMS.md +8 -7
- package/docs/en/intlayer_cli.md +112 -5
- package/docs/en/intlayer_with_nestjs.md +268 -0
- package/docs/en/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/en/intlayer_with_react_router_v7.md +531 -0
- package/docs/en/intlayer_with_tanstack.md +463 -294
- package/docs/en/intlayer_with_vite+preact.md +8 -8
- package/docs/en/intlayer_with_vite+react.md +8 -8
- package/docs/en/intlayer_with_vite+vue.md +8 -8
- package/docs/en/packages/intlayer/getLocalizedUrl.md +102 -25
- package/docs/en/packages/vite-intlayer/index.md +3 -3
- package/docs/en/readme.md +261 -0
- package/docs/en/testing.md +200 -0
- package/docs/en-GB/autoFill.md +29 -6
- package/docs/en-GB/configuration.md +79 -71
- package/docs/en-GB/dictionary/content_file.md +1084 -0
- package/docs/en-GB/intlayer_CMS.md +4 -5
- package/docs/en-GB/intlayer_with_nestjs.md +268 -0
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/en-GB/intlayer_with_react_router_v7.md +533 -0
- package/docs/en-GB/intlayer_with_tanstack.md +466 -299
- package/docs/en-GB/intlayer_with_vite+preact.md +7 -7
- package/docs/en-GB/intlayer_with_vite+react.md +7 -7
- package/docs/en-GB/intlayer_with_vite+vue.md +9 -9
- package/docs/en-GB/packages/vite-intlayer/index.md +3 -3
- package/docs/en-GB/readme.md +261 -0
- package/docs/en-GB/testing.md +200 -0
- package/docs/es/autoFill.md +45 -23
- package/docs/es/configuration.md +171 -167
- package/docs/es/dictionary/content_file.md +1088 -0
- package/docs/es/intlayer_CMS.md +4 -5
- package/docs/es/intlayer_with_nestjs.md +268 -0
- package/docs/es/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/es/intlayer_with_react_router_v7.md +533 -0
- package/docs/es/intlayer_with_tanstack.md +469 -280
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/es/packages/vite-intlayer/index.md +3 -3
- package/docs/es/readme.md +261 -0
- package/docs/es/testing.md +200 -0
- package/docs/fr/autoFill.md +47 -24
- package/docs/fr/configuration.md +213 -198
- package/docs/fr/dictionary/content_file.md +1054 -0
- package/docs/fr/intlayer_CMS.md +4 -5
- package/docs/fr/intlayer_with_nestjs.md +268 -0
- package/docs/fr/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/fr/intlayer_with_react_router_v7.md +549 -0
- package/docs/fr/intlayer_with_tanstack.md +465 -279
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/packages/vite-intlayer/index.md +3 -3
- package/docs/fr/readme.md +261 -0
- package/docs/fr/testing.md +200 -0
- package/docs/hi/autoFill.md +47 -25
- package/docs/hi/configuration.md +194 -189
- package/docs/hi/dictionary/content_file.md +1056 -0
- package/docs/hi/intlayer_CMS.md +4 -5
- package/docs/hi/intlayer_with_nestjs.md +269 -0
- package/docs/hi/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/hi/intlayer_with_react_router_v7.md +533 -0
- package/docs/hi/intlayer_with_tanstack.md +467 -282
- package/docs/hi/intlayer_with_vite+preact.md +7 -7
- package/docs/hi/intlayer_with_vite+react.md +7 -7
- package/docs/hi/intlayer_with_vite+vue.md +9 -9
- package/docs/hi/packages/vite-intlayer/index.md +3 -3
- package/docs/hi/readme.md +261 -0
- package/docs/hi/testing.md +200 -0
- package/docs/it/autoFill.md +46 -24
- package/docs/it/configuration.md +169 -161
- package/docs/it/dictionary/content_file.md +1061 -0
- package/docs/it/intlayer_CMS.md +4 -5
- package/docs/it/intlayer_with_nestjs.md +268 -0
- package/docs/it/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/it/intlayer_with_react_router_v7.md +535 -0
- package/docs/it/intlayer_with_tanstack.md +467 -301
- package/docs/it/intlayer_with_vite+preact.md +7 -7
- package/docs/it/intlayer_with_vite+react.md +7 -7
- package/docs/it/intlayer_with_vite+vue.md +9 -9
- package/docs/it/packages/vite-intlayer/index.md +3 -3
- package/docs/it/readme.md +261 -0
- package/docs/it/testing.md +200 -0
- package/docs/ja/autoFill.md +45 -23
- package/docs/ja/configuration.md +243 -204
- package/docs/ja/dictionary/content_file.md +1064 -0
- package/docs/ja/intlayer_CMS.md +4 -5
- package/docs/ja/intlayer_with_nestjs.md +268 -0
- package/docs/ja/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ja/intlayer_with_react_router_v7.md +534 -0
- package/docs/ja/intlayer_with_tanstack.md +467 -303
- package/docs/ja/intlayer_with_vite+preact.md +7 -7
- package/docs/ja/intlayer_with_vite+react.md +7 -7
- package/docs/ja/intlayer_with_vite+vue.md +9 -9
- package/docs/ja/packages/vite-intlayer/index.md +3 -3
- package/docs/ja/readme.md +263 -0
- package/docs/ja/testing.md +200 -0
- package/docs/ko/autoFill.md +39 -16
- package/docs/ko/configuration.md +217 -197
- package/docs/ko/dictionary/content_file.md +1060 -0
- package/docs/ko/intlayer_CMS.md +4 -5
- package/docs/ko/intlayer_with_nestjs.md +268 -0
- package/docs/ko/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ko/intlayer_with_react_router_v7.md +540 -0
- package/docs/ko/intlayer_with_tanstack.md +466 -302
- package/docs/ko/intlayer_with_vite+preact.md +7 -7
- package/docs/ko/intlayer_with_vite+react.md +7 -7
- package/docs/ko/intlayer_with_vite+vue.md +9 -9
- package/docs/ko/packages/vite-intlayer/index.md +3 -3
- package/docs/ko/readme.md +261 -0
- package/docs/ko/testing.md +200 -0
- package/docs/pt/autoFill.md +39 -15
- package/docs/pt/configuration.md +165 -147
- package/docs/pt/dictionary/content_file.md +1062 -0
- package/docs/pt/intlayer_CMS.md +4 -5
- package/docs/pt/intlayer_with_nestjs.md +271 -0
- package/docs/pt/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/pt/intlayer_with_react_router_v7.md +535 -0
- package/docs/pt/intlayer_with_tanstack.md +469 -300
- package/docs/pt/intlayer_with_vite+preact.md +7 -7
- package/docs/pt/intlayer_with_vite+react.md +7 -7
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/pt/packages/vite-intlayer/index.md +3 -3
- package/docs/pt/readme.md +261 -0
- package/docs/pt/testing.md +200 -0
- package/docs/ru/autoFill.md +52 -30
- package/docs/ru/configuration.md +164 -117
- package/docs/ru/dictionary/content_file.md +1064 -0
- package/docs/ru/intlayer_CMS.md +4 -4
- package/docs/ru/intlayer_with_nestjs.md +270 -0
- package/docs/ru/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/ru/intlayer_with_react_router_v7.md +534 -0
- package/docs/ru/intlayer_with_tanstack.md +470 -305
- package/docs/ru/intlayer_with_vite+preact.md +7 -7
- package/docs/ru/intlayer_with_vite+react.md +7 -7
- package/docs/ru/intlayer_with_vite+vue.md +9 -9
- package/docs/ru/packages/vite-intlayer/index.md +3 -3
- package/docs/ru/readme.md +261 -0
- package/docs/ru/testing.md +202 -0
- package/docs/tr/CI_CD.md +198 -0
- package/docs/tr/autoFill.md +201 -0
- package/docs/tr/configuration.md +585 -0
- package/docs/tr/dictionary/condition.md +243 -0
- package/docs/tr/dictionary/content_file.md +1055 -0
- package/docs/tr/dictionary/enumeration.md +251 -0
- package/docs/tr/dictionary/file.md +228 -0
- package/docs/tr/dictionary/function_fetching.md +218 -0
- package/docs/tr/dictionary/gender.md +279 -0
- package/docs/tr/dictionary/insertion.md +191 -0
- package/docs/tr/dictionary/markdown.md +385 -0
- package/docs/tr/dictionary/nesting.md +279 -0
- package/docs/tr/dictionary/translation.md +315 -0
- package/docs/tr/formatters.md +618 -0
- package/docs/tr/how_works_intlayer.md +254 -0
- package/docs/tr/index.md +168 -0
- package/docs/tr/interest_of_intlayer.md +288 -0
- package/docs/tr/intlayer_CMS.md +347 -0
- package/docs/tr/intlayer_cli.md +570 -0
- package/docs/tr/intlayer_visual_editor.md +269 -0
- package/docs/tr/intlayer_with_angular.md +694 -0
- package/docs/tr/intlayer_with_create_react_app.md +1218 -0
- package/docs/tr/intlayer_with_express.md +415 -0
- package/docs/tr/intlayer_with_lynx+react.md +511 -0
- package/docs/tr/intlayer_with_nestjs.md +268 -0
- package/docs/tr/intlayer_with_nextjs_14.md +1029 -0
- package/docs/tr/intlayer_with_nextjs_15.md +1506 -0
- package/docs/tr/intlayer_with_nextjs_page_router.md +1484 -0
- package/docs/tr/intlayer_with_nuxt.md +773 -0
- package/docs/tr/intlayer_with_react_native+expo.md +660 -0
- package/docs/tr/intlayer_with_react_router_v7.md +531 -0
- package/docs/tr/intlayer_with_tanstack.md +452 -0
- package/docs/tr/intlayer_with_vite+preact.md +1673 -0
- package/docs/tr/intlayer_with_vite+react.md +1632 -0
- package/docs/tr/intlayer_with_vite+solid.md +288 -0
- package/docs/tr/intlayer_with_vite+svelte.md +288 -0
- package/docs/tr/intlayer_with_vite+vue.md +1042 -0
- package/docs/tr/introduction.md +209 -0
- package/docs/tr/locale_mapper.md +244 -0
- package/docs/tr/mcp_server.md +207 -0
- package/docs/tr/packages/@intlayer/api/index.md +58 -0
- package/docs/tr/packages/@intlayer/chokidar/index.md +57 -0
- package/docs/tr/packages/@intlayer/cli/index.md +47 -0
- package/docs/tr/packages/@intlayer/config/index.md +142 -0
- package/docs/tr/packages/@intlayer/core/index.md +51 -0
- package/docs/tr/packages/@intlayer/design-system/index.md +47 -0
- package/docs/tr/packages/@intlayer/dictionary-entry/index.md +53 -0
- package/docs/tr/packages/@intlayer/editor/index.md +47 -0
- package/docs/tr/packages/@intlayer/editor-react/index.md +47 -0
- package/docs/tr/packages/@intlayer/webpack/index.md +61 -0
- package/docs/tr/packages/angular-intlayer/index.md +59 -0
- package/docs/tr/packages/express-intlayer/index.md +258 -0
- package/docs/tr/packages/express-intlayer/t.md +459 -0
- package/docs/tr/packages/intlayer/getConfiguration.md +151 -0
- package/docs/tr/packages/intlayer/getEnumeration.md +165 -0
- package/docs/tr/packages/intlayer/getHTMLTextDir.md +127 -0
- package/docs/tr/packages/intlayer/getLocaleLang.md +87 -0
- package/docs/tr/packages/intlayer/getLocaleName.md +124 -0
- package/docs/tr/packages/intlayer/getLocalizedUrl.md +324 -0
- package/docs/tr/packages/intlayer/getMultilingualUrls.md +225 -0
- package/docs/tr/packages/intlayer/getPathWithoutLocale.md +81 -0
- package/docs/tr/packages/intlayer/getTranslation.md +196 -0
- package/docs/tr/packages/intlayer/getTranslationContent.md +195 -0
- package/docs/tr/packages/intlayer/index.md +505 -0
- package/docs/tr/packages/intlayer-cli/index.md +71 -0
- package/docs/tr/packages/intlayer-editor/index.md +139 -0
- package/docs/tr/packages/lynx-intlayer/index.md +85 -0
- package/docs/tr/packages/next-intlayer/index.md +154 -0
- package/docs/tr/packages/next-intlayer/t.md +354 -0
- package/docs/tr/packages/next-intlayer/useDictionary.md +270 -0
- package/docs/tr/packages/next-intlayer/useIntlayer.md +265 -0
- package/docs/tr/packages/next-intlayer/useLocale.md +133 -0
- package/docs/tr/packages/nuxt-intlayer/index.md +59 -0
- package/docs/tr/packages/preact-intlayer/index.md +55 -0
- package/docs/tr/packages/react-intlayer/index.md +148 -0
- package/docs/tr/packages/react-intlayer/t.md +304 -0
- package/docs/tr/packages/react-intlayer/useDictionary.md +554 -0
- package/docs/tr/packages/react-intlayer/useI18n.md +478 -0
- package/docs/tr/packages/react-intlayer/useIntlayer.md +253 -0
- package/docs/tr/packages/react-intlayer/useLocale.md +212 -0
- package/docs/tr/packages/react-native-intlayer/index.md +85 -0
- package/docs/tr/packages/react-scripts-intlayer/index.md +82 -0
- package/docs/tr/packages/solid-intlayer/index.md +56 -0
- package/docs/tr/packages/svelte-intlayer/index.md +55 -0
- package/docs/tr/packages/vite-intlayer/index.md +82 -0
- package/docs/tr/packages/vue-intlayer/index.md +59 -0
- package/docs/tr/per_locale_file.md +321 -0
- package/docs/tr/readme.md +261 -0
- package/docs/tr/roadmap.md +338 -0
- package/docs/tr/testing.md +200 -0
- package/docs/tr/vs_code_extension.md +154 -0
- package/docs/zh/autoFill.md +40 -18
- package/docs/zh/configuration.md +245 -226
- package/docs/zh/dictionary/content_file.md +1064 -0
- package/docs/zh/intlayer_CMS.md +4 -5
- package/docs/zh/intlayer_with_nestjs.md +268 -0
- package/docs/zh/intlayer_with_nextjs_page_router.md +1 -1
- package/docs/zh/intlayer_with_react_router_v7.md +535 -0
- package/docs/zh/intlayer_with_tanstack.md +468 -278
- package/docs/zh/intlayer_with_vite+preact.md +7 -7
- package/docs/zh/intlayer_with_vite+react.md +7 -7
- package/docs/zh/intlayer_with_vite+vue.md +7 -7
- package/docs/zh/packages/vite-intlayer/index.md +3 -3
- package/docs/zh/readme.md +261 -0
- package/docs/zh/testing.md +198 -0
- package/frequent_questions/tr/SSR_Next_no_[locale].md +105 -0
- package/frequent_questions/tr/array_as_content_declaration.md +72 -0
- package/frequent_questions/tr/build_dictionaries.md +59 -0
- package/frequent_questions/tr/build_error_CI_CD.md +75 -0
- package/frequent_questions/tr/customized_locale_list.md +65 -0
- package/frequent_questions/tr/domain_routing.md +114 -0
- package/frequent_questions/tr/esbuild_error.md +30 -0
- package/frequent_questions/tr/get_locale_cookie.md +142 -0
- package/frequent_questions/tr/intlayer_command_undefined.md +156 -0
- package/frequent_questions/tr/locale_incorect_in_url.md +74 -0
- package/frequent_questions/tr/static_rendering.md +45 -0
- package/frequent_questions/tr/translated_path_url.md +56 -0
- package/frequent_questions/tr/unknown_command.md +98 -0
- package/legal/tr/privacy_notice.md +83 -0
- package/legal/tr/terms_of_service.md +55 -0
- package/package.json +13 -13
- package/src/generated/blog.entry.ts +212 -0
- package/src/generated/docs.entry.ts +663 -135
- package/src/generated/frequentQuestions.entry.ts +85 -1
- package/src/generated/legal.entry.ts +7 -1
- package/docs/ar/dictionary/content_extention_customization.md +0 -100
- package/docs/ar/dictionary/get_started.md +0 -527
- package/docs/de/dictionary/content_extention_customization.md +0 -100
- package/docs/de/dictionary/get_started.md +0 -531
- package/docs/en/dictionary/content_extention_customization.md +0 -102
- package/docs/en/dictionary/get_started.md +0 -529
- package/docs/en-GB/dictionary/content_extention_customization.md +0 -100
- package/docs/en-GB/dictionary/get_started.md +0 -591
- package/docs/es/dictionary/content_extention_customization.md +0 -100
- package/docs/es/dictionary/get_started.md +0 -527
- package/docs/fr/dictionary/content_extention_customization.md +0 -100
- package/docs/fr/dictionary/get_started.md +0 -527
- package/docs/hi/dictionary/content_extention_customization.md +0 -100
- package/docs/hi/dictionary/get_started.md +0 -527
- package/docs/it/dictionary/content_extention_customization.md +0 -113
- package/docs/it/dictionary/get_started.md +0 -573
- package/docs/ja/dictionary/content_extention_customization.md +0 -113
- package/docs/ja/dictionary/get_started.md +0 -576
- package/docs/ko/dictionary/content_extention_customization.md +0 -100
- package/docs/ko/dictionary/get_started.md +0 -530
- package/docs/pt/dictionary/content_extention_customization.md +0 -100
- package/docs/pt/dictionary/get_started.md +0 -532
- package/docs/ru/dictionary/content_extention_customization.md +0 -100
- package/docs/ru/dictionary/get_started.md +0 -575
- package/docs/zh/dictionary/content_extention_customization.md +0 -117
- package/docs/zh/dictionary/get_started.md +0 -533
|
@@ -1,369 +1,438 @@
|
|
|
1
1
|
---
|
|
2
|
-
createdAt: 2025-
|
|
3
|
-
updatedAt: 2025-
|
|
4
|
-
title: Getting Started with Intlayer in
|
|
5
|
-
description:
|
|
2
|
+
createdAt: 2025-09-09
|
|
3
|
+
updatedAt: 2025-09-09
|
|
4
|
+
title: Getting Started with Intlayer in Tanstack Start
|
|
5
|
+
description: Learn how to add internationalisation (i18n) to your Tanstack Start application using Intlayer. Follow this comprehensive guide to make your app multilingual with locale-aware routing.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internationalisation
|
|
8
8
|
- Documentation
|
|
9
9
|
- Intlayer
|
|
10
|
-
-
|
|
11
|
-
- TanStack Router
|
|
10
|
+
- Tanstack Start
|
|
12
11
|
- React
|
|
13
12
|
- i18n
|
|
14
|
-
-
|
|
13
|
+
- TypeScript
|
|
14
|
+
- Locale Routing
|
|
15
15
|
slugs:
|
|
16
16
|
- doc
|
|
17
17
|
- environment
|
|
18
|
+
- vite-and-react
|
|
18
19
|
- tanstack-start
|
|
20
|
+
applicationTemplate: https://github.com/AydinTheFirst/tanstack-start-intlayer
|
|
21
|
+
author: AydinTheFirst
|
|
19
22
|
---
|
|
20
23
|
|
|
21
|
-
# Getting Started Internationalising (i18n) with Intlayer and
|
|
24
|
+
# Getting Started Internationalising (i18n) with Intlayer and Tanstack Start
|
|
25
|
+
|
|
26
|
+
This guide demonstrates how to integrate **Intlayer** for seamless internationalisation in Tanstack Start projects with locale-aware routing, TypeScript support, and modern development practices.
|
|
22
27
|
|
|
23
28
|
## What is Intlayer?
|
|
24
29
|
|
|
25
|
-
**Intlayer** is an open-source i18n
|
|
30
|
+
**Intlayer** is an innovative, open-source internationalisation (i18n) library designed to simplify multilingual support in modern web applications.
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
- **Dynamic metadata & routes** (SEO-ready).
|
|
29
|
-
- **Runtime locale switching** (and helpers to detect/persist locales).
|
|
30
|
-
- **Vite plugin** for build-time transforms + developer experience (DX).
|
|
32
|
+
With Intlayer, you can:
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
- **Easily manage translations** using declarative dictionaries at the component level.
|
|
35
|
+
- **Dynamically localise metadata**, routes, and content.
|
|
36
|
+
- **Ensure TypeScript support** with autogenerated types, improving autocompletion and error detection.
|
|
37
|
+
- **Benefit from advanced features**, like dynamic locale detection and switching.
|
|
38
|
+
- **Enable locale-aware routing** with Tanstack Start's file-based routing system.
|
|
33
39
|
|
|
34
40
|
---
|
|
35
41
|
|
|
36
|
-
## Step
|
|
42
|
+
## Step-by-Step Guide to Set Up Intlayer in a Tanstack Start Application
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
# npm
|
|
40
|
-
npm i intlayer react-intlayer
|
|
41
|
-
npm i -D vite-intlayer
|
|
44
|
+
### Step 1: Create Project
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
Start by creating a new TanStack Start project by following the [Start new project](https://tanstack.com/start/latest/docs/framework/react/quick-start) guide on the TanStack Start website.
|
|
47
|
+
|
|
48
|
+
### Step 2: Install Intlayer Packages
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
Install the necessary packages using your preferred package manager:
|
|
51
|
+
|
|
52
|
+
```bash packageManager="npm"
|
|
53
|
+
npm install intlayer react-intlayer
|
|
54
|
+
npm install vite-intlayer --save-dev
|
|
50
55
|
```
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
```bash packageManager="pnpm"
|
|
58
|
+
pnpm add intlayer react-intlayer
|
|
59
|
+
pnpm add vite-intlayer --save-dev
|
|
60
|
+
```
|
|
55
61
|
|
|
56
|
-
|
|
62
|
+
- **intlayer**
|
|
63
|
+
|
|
64
|
+
The core package that provides internationalisation tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/get_started.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md).
|
|
65
|
+
|
|
66
|
+
- **react-intlayer**
|
|
67
|
+
The package that integrates Intlayer with React applications. It provides context providers and hooks for React internationalisation.
|
|
57
68
|
|
|
58
|
-
|
|
69
|
+
- **vite-intlayer**
|
|
70
|
+
Includes the Vite plugin for integrating Intlayer with the [Vite bundler](https://vite.dev/guide/why.html#why-bundle-for-production), as well as middleware for detecting the user's preferred locale, managing cookies, and handling URL redirection.
|
|
59
71
|
|
|
60
|
-
|
|
72
|
+
### Step 3: Configuration of your project
|
|
61
73
|
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
Create a config file to configure the languages of your application:
|
|
75
|
+
|
|
76
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
77
|
+
import type { IntlayerConfig } from "intlayer";
|
|
78
|
+
|
|
79
|
+
import { Locales } from "intlayer";
|
|
64
80
|
|
|
65
81
|
const config: IntlayerConfig = {
|
|
66
82
|
internationalization: {
|
|
67
|
-
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
68
83
|
defaultLocale: Locales.ENGLISH,
|
|
84
|
+
locales: [
|
|
85
|
+
Locales.ENGLISH,
|
|
86
|
+
Locales.FRENCH,
|
|
87
|
+
Locales.SPANISH,
|
|
88
|
+
// Your other locales
|
|
89
|
+
],
|
|
69
90
|
},
|
|
70
|
-
// You can also tweak: contentDir, contentFileExtensions, middleware options, etc.
|
|
71
91
|
};
|
|
72
92
|
|
|
73
93
|
export default config;
|
|
74
94
|
```
|
|
75
95
|
|
|
76
|
-
|
|
96
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
97
|
+
import { Locales } from "intlayer";
|
|
98
|
+
|
|
99
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
100
|
+
const config = {
|
|
101
|
+
internationalization: {
|
|
102
|
+
defaultLocale: Locales.ENGLISH,
|
|
103
|
+
locales: [
|
|
104
|
+
Locales.ENGLISH,
|
|
105
|
+
Locales.FRENCH,
|
|
106
|
+
Locales.SPANISH,
|
|
107
|
+
// Your other locales
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
};
|
|
77
111
|
|
|
78
|
-
|
|
112
|
+
export default config;
|
|
113
|
+
```
|
|
79
114
|
|
|
80
|
-
|
|
115
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
116
|
+
const { Locales } = require("intlayer");
|
|
81
117
|
|
|
82
|
-
|
|
118
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
119
|
+
const config = {
|
|
120
|
+
internationalization: {
|
|
121
|
+
defaultLocale: Locales.ENGLISH,
|
|
122
|
+
locales: [
|
|
123
|
+
Locales.ENGLISH,
|
|
124
|
+
Locales.FRENCH,
|
|
125
|
+
Locales.SPANISH,
|
|
126
|
+
// Your other locales
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
module.exports = config;
|
|
132
|
+
```
|
|
83
133
|
|
|
84
|
-
|
|
134
|
+
> Through this configuration file, you can set up localised URLs, middleware redirection, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/configuration.md).
|
|
85
135
|
|
|
86
|
-
|
|
136
|
+
### Step 4: Integrate Intlayer in Your Vite Configuration
|
|
137
|
+
|
|
138
|
+
Add the intlayer plugin into your configuration:
|
|
139
|
+
|
|
140
|
+
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
141
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
87
142
|
import { defineConfig } from "vite";
|
|
88
|
-
import
|
|
89
|
-
import
|
|
143
|
+
import { intlayerMiddlewarePlugin, intlayerPlugin } from "vite-intlayer";
|
|
144
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
90
145
|
|
|
91
146
|
export default defineConfig({
|
|
92
147
|
plugins: [
|
|
93
|
-
|
|
148
|
+
reactRouter(),
|
|
149
|
+
tsconfigPaths(),
|
|
94
150
|
intlayerPlugin(),
|
|
95
|
-
|
|
96
|
-
intLayerMiddlewarePlugin(),
|
|
151
|
+
intlayerMiddlewarePlugin(),
|
|
97
152
|
],
|
|
98
153
|
});
|
|
99
154
|
```
|
|
100
155
|
|
|
101
|
-
>
|
|
156
|
+
> The `intlayerPlugin()` Vite plugin is used to integrate Intlayer with Vite. It ensures the building of content declaration files and monitors them in development mode. It defines Intlayer environment variables within the Vite application. Additionally, it provides aliases to optimise performance.
|
|
102
157
|
|
|
103
|
-
|
|
158
|
+
### Step 5: Create Layout Components
|
|
159
|
+
|
|
160
|
+
Set up your root layout and locale-specific layouts:
|
|
161
|
+
|
|
162
|
+
#### Root Layout
|
|
104
163
|
|
|
105
|
-
|
|
164
|
+
```tsx fileName="src/routes/{-$locale}/route.tsx" codeFormat="typescript"
|
|
165
|
+
// src/routes/{-$locale}/route.tsx
|
|
166
|
+
import { createFileRoute, Navigate, Outlet } from "@tanstack/react-router";
|
|
167
|
+
import { configuration } from "intlayer";
|
|
168
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
169
|
+
|
|
170
|
+
import { useI18nHTMLAttributes } from "@/hooks/useI18nHTMLAttributes";
|
|
171
|
+
|
|
172
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
173
|
+
component: LayoutComponent,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
function LayoutComponent() {
|
|
177
|
+
const { locale } = Route.useParams();
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<IntlayerProvider locale={locale}>
|
|
181
|
+
<Outlet />
|
|
182
|
+
</IntlayerProvider>
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
```
|
|
106
186
|
|
|
107
|
-
|
|
187
|
+
### Step 6: Declare Your Content
|
|
108
188
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
189
|
+
Create and manage your content declarations to store translations:
|
|
190
|
+
|
|
191
|
+
```tsx fileName="src/contents/page.content.ts" contentDeclarationFormat="typescript"
|
|
192
|
+
import type { Dictionary } from "intlayer";
|
|
193
|
+
|
|
194
|
+
import { t } from "intlayer";
|
|
112
195
|
|
|
113
196
|
const appContent = {
|
|
114
|
-
key: "app",
|
|
115
197
|
content: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
198
|
+
links: {
|
|
199
|
+
about: t({
|
|
200
|
+
en: "About",
|
|
201
|
+
es: "Acerca de",
|
|
202
|
+
fr: "À propos",
|
|
203
|
+
}),
|
|
204
|
+
home: t({
|
|
205
|
+
"en-GB": "Home",
|
|
206
|
+
en: "Home",
|
|
207
|
+
es: "Inicio",
|
|
208
|
+
fr: "Accueil",
|
|
209
|
+
}),
|
|
210
|
+
},
|
|
211
|
+
meta: {
|
|
212
|
+
description: t({
|
|
213
|
+
"en-GB": "This is an example of using Intlayer with TanStack Router",
|
|
214
|
+
en: "This is an example of using Intlayer with TanStack Router",
|
|
215
|
+
es: "Este es un ejemplo de uso de Intlayer con TanStack Router",
|
|
216
|
+
fr: "Ceci est un exemple d'utilisation d'Intlayer avec TanStack Router",
|
|
217
|
+
}),
|
|
218
|
+
},
|
|
128
219
|
title: t({
|
|
129
|
-
"en-GB": "
|
|
130
|
-
en: "
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
count: t({
|
|
135
|
-
"en-GB": "count is ",
|
|
136
|
-
en: "count is ",
|
|
137
|
-
fr: "le compte est ",
|
|
138
|
-
es: "el recuento es ",
|
|
139
|
-
}),
|
|
140
|
-
edit: t<ReactNode>({
|
|
141
|
-
"en-GB": (
|
|
142
|
-
<>
|
|
143
|
-
Edit <code>src/routes/index.tsx</code> and save to test HMR
|
|
144
|
-
</>
|
|
145
|
-
),
|
|
146
|
-
en: (
|
|
147
|
-
<>
|
|
148
|
-
Edit <code>src/routes/index.tsx</code> and save to test HMR
|
|
149
|
-
</>
|
|
150
|
-
),
|
|
151
|
-
fr: (
|
|
152
|
-
<>
|
|
153
|
-
Éditez <code>src/routes/index.tsx</code> et enregistrez pour tester
|
|
154
|
-
HMR
|
|
155
|
-
</>
|
|
156
|
-
),
|
|
157
|
-
es: (
|
|
158
|
-
<>
|
|
159
|
-
Edita <code>src/routes/index.tsx</code> y guarda para probar HMR
|
|
160
|
-
</>
|
|
161
|
-
),
|
|
162
|
-
}),
|
|
163
|
-
readTheDocs: t({
|
|
164
|
-
"en-GB": "Click the logos to learn more",
|
|
165
|
-
en: "Click the logos to learn more",
|
|
166
|
-
fr: "Cliquez sur les logos pour en savoir plus",
|
|
167
|
-
es: "Haz clic en los logotipos para saber más",
|
|
220
|
+
"en-GB": "Welcome to Intlayer + TanStack Router",
|
|
221
|
+
en: "Welcome to Intlayer + TanStack Router",
|
|
222
|
+
es: "Bienvenido a Intlayer + TanStack Router",
|
|
223
|
+
fr: "Bienvenue à Intlayer + TanStack Router",
|
|
168
224
|
}),
|
|
169
225
|
},
|
|
226
|
+
key: "app",
|
|
170
227
|
} satisfies Dictionary;
|
|
171
228
|
|
|
172
229
|
export default appContent;
|
|
173
230
|
```
|
|
174
231
|
|
|
175
|
-
|
|
232
|
+
> Your content declarations can be defined anywhere in your application as soon as they are included in the `contentDir` directory (by default, `./app`). And match the content declaration file extension (by default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
176
233
|
|
|
177
|
-
>
|
|
234
|
+
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/dictionary/get_started.md).
|
|
178
235
|
|
|
179
|
-
|
|
236
|
+
### Step 7: Create Locale-Aware Components and Hooks
|
|
180
237
|
|
|
181
|
-
|
|
238
|
+
Create a `LocalizedLink` component for locale-aware navigation:
|
|
182
239
|
|
|
183
|
-
|
|
240
|
+
```tsx fileName="src/components/localized-link.tsx" codeFormat="typescript"
|
|
241
|
+
// src/components/localized-link.tsx
|
|
242
|
+
// eslint-disable-next-line no-restricted-imports
|
|
243
|
+
import { Link, type LinkProps } from "@tanstack/react-router";
|
|
244
|
+
import { getLocalizedUrl } from "intlayer";
|
|
245
|
+
import { useLocale } from "react-intlayer";
|
|
184
246
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
createRootRoute,
|
|
189
|
-
Link as RouterLink,
|
|
190
|
-
} from "@tanstack/react-router";
|
|
191
|
-
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
192
|
-
|
|
193
|
-
function AppShell() {
|
|
194
|
-
// Example of using a dictionary at the top level:
|
|
195
|
-
const content = useIntlayer("app");
|
|
247
|
+
type LocalizedLinkProps = {
|
|
248
|
+
to: string;
|
|
249
|
+
} & Omit<LinkProps, "to">;
|
|
196
250
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<nav className="flex gap-3 p-3">
|
|
200
|
-
<RouterLink to="/">Home</RouterLink>
|
|
201
|
-
<RouterLink to="/about">About</RouterLink>
|
|
202
|
-
</nav>
|
|
203
|
-
<main className="p-6">
|
|
204
|
-
<h1>{content.title}</h1>
|
|
205
|
-
<Outlet />
|
|
206
|
-
</main>
|
|
207
|
-
</div>
|
|
208
|
-
);
|
|
209
|
-
}
|
|
251
|
+
export function LocalizedLink(props: LocalizedLinkProps) {
|
|
252
|
+
const { locale } = useLocale();
|
|
210
253
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
<AppShell />
|
|
215
|
-
</IntlayerProvider>
|
|
216
|
-
),
|
|
217
|
-
});
|
|
218
|
-
```
|
|
254
|
+
const isExternal = (to: string) => {
|
|
255
|
+
return /^(https?:)?\/\//.test(to);
|
|
256
|
+
};
|
|
219
257
|
|
|
220
|
-
|
|
258
|
+
const to = isExternal(props.to)
|
|
259
|
+
? props.to
|
|
260
|
+
: getLocalizedUrl(props.to, locale);
|
|
221
261
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
import { useIntlayer } from "react-intlayer";
|
|
225
|
-
import reactLogo from "../assets/react.svg";
|
|
226
|
-
|
|
227
|
-
export const Route = createFileRoute("/")({
|
|
228
|
-
component: () => {
|
|
229
|
-
const content = useIntlayer("app");
|
|
230
|
-
return (
|
|
231
|
-
<>
|
|
232
|
-
<button>{content.count}0</button>
|
|
233
|
-
<p>{content.edit}</p>
|
|
234
|
-
<img
|
|
235
|
-
src={reactLogo}
|
|
236
|
-
alt={content.reactLogo.value}
|
|
237
|
-
width={48}
|
|
238
|
-
height={48}
|
|
239
|
-
/>
|
|
240
|
-
<p className="opacity-70">{content.readTheDocs}</p>
|
|
241
|
-
</>
|
|
242
|
-
);
|
|
243
|
-
},
|
|
244
|
-
});
|
|
262
|
+
return <Link {...props} to={to as LinkProps["to"]} />;
|
|
263
|
+
}
|
|
245
264
|
```
|
|
246
265
|
|
|
247
|
-
|
|
248
|
-
>
|
|
249
|
-
> ```jsx
|
|
250
|
-
> <img alt={c.reactLogo.value} />
|
|
251
|
-
> ```
|
|
266
|
+
Create a `useLocalizedNavigate` hook for programme navigation:
|
|
252
267
|
|
|
253
|
-
|
|
268
|
+
```tsx fileName="src/hooks/useLocalizedNavigate.tsx" codeFormat="typescript"
|
|
269
|
+
// src/hooks/useLocalizedNavigate.tsx
|
|
270
|
+
// eslint-disable-next-line no-restricted-imports
|
|
271
|
+
import { NavigateOptions, useNavigate } from "@tanstack/react-router";
|
|
272
|
+
import { getLocalizedUrl } from "intlayer";
|
|
273
|
+
import { useLocale } from "react-intlayer";
|
|
254
274
|
|
|
255
|
-
|
|
275
|
+
type LocalizedNavigateOptions = {
|
|
276
|
+
to: string;
|
|
277
|
+
} & Omit<NavigateOptions, "to">;
|
|
256
278
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
279
|
+
export const useLocalizedNavigate = () => {
|
|
280
|
+
const navigate = useNavigate();
|
|
281
|
+
const { locale } = useLocale();
|
|
260
282
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
283
|
+
const isExternal = (to: string) => {
|
|
284
|
+
return /^(https?:)?\/\//.test(to);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const localizedNavigate = (options: LocalizedNavigateOptions) => {
|
|
288
|
+
const to = isExternal(options.to)
|
|
289
|
+
? options.to
|
|
290
|
+
: getLocalizedUrl(options.to, locale);
|
|
291
|
+
|
|
292
|
+
navigate({ ...options, to: to as NavigateOptions["to"] });
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
return localizedNavigate;
|
|
296
|
+
};
|
|
271
297
|
```
|
|
272
298
|
|
|
273
|
-
|
|
299
|
+
### Step 8: Utilise Intlayer in Your Pages
|
|
274
300
|
|
|
275
|
-
|
|
301
|
+
Access your content dictionaries throughout your application:
|
|
276
302
|
|
|
277
|
-
|
|
303
|
+
#### Root Redirect Page
|
|
278
304
|
|
|
279
|
-
|
|
305
|
+
```tsx fileName="src/routes/page.tsx" codeFormat="typescript"
|
|
306
|
+
// src/routes/page.tsx
|
|
307
|
+
import { useLocale } from "react-intlayer";
|
|
308
|
+
import { Navigate } from "react-router";
|
|
280
309
|
|
|
281
|
-
|
|
310
|
+
export default function Page() {
|
|
311
|
+
const { locale } = useLocale();
|
|
282
312
|
|
|
283
|
-
|
|
313
|
+
return <Navigate replace to={locale} />;
|
|
314
|
+
}
|
|
315
|
+
```
|
|
284
316
|
|
|
285
|
-
|
|
317
|
+
#### Localised Home Page
|
|
286
318
|
|
|
287
|
-
```tsx fileName="src/
|
|
288
|
-
import {
|
|
289
|
-
import {
|
|
290
|
-
import {
|
|
319
|
+
```tsx fileName="src/routes/{-$locale}/index.tsx" codeFormat="typescript"
|
|
320
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
321
|
+
import { getIntlayer } from "intlayer";
|
|
322
|
+
import { useIntlayer } from "react-intlayer";
|
|
291
323
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
324
|
+
import LocaleSwitcher from "@/components/locale-switcher";
|
|
325
|
+
import { LocalizedLink } from "@/components/localized-link";
|
|
326
|
+
import { useLocalizedNavigate } from "@/hooks/useLocalizedNavigate";
|
|
327
|
+
|
|
328
|
+
export const Route = createFileRoute("/{-$locale}/")({
|
|
329
|
+
component: RouteComponent,
|
|
330
|
+
head: ({ params }) => {
|
|
331
|
+
const { locale } = params;
|
|
332
|
+
const metaContent = getIntlayer("app", locale);
|
|
333
|
+
|
|
334
|
+
return {
|
|
335
|
+
meta: [
|
|
336
|
+
{ title: metaContent.title },
|
|
337
|
+
{ content: metaContent.meta.description, name: "description" },
|
|
338
|
+
],
|
|
339
|
+
};
|
|
340
|
+
},
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
function RouteComponent() {
|
|
344
|
+
const content = useIntlayer("app");
|
|
345
|
+
const navigate = useLocalizedNavigate();
|
|
305
346
|
|
|
306
347
|
return (
|
|
307
|
-
<div className="
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
|
|
348
|
+
<div className="grid place-items-center h-screen">
|
|
349
|
+
<div className="flex flex-col gap-4 items-center text-centre">
|
|
350
|
+
{content.title}
|
|
351
|
+
<LocaleSwitcher />
|
|
352
|
+
<div className="flex gap-4">
|
|
353
|
+
<a href="/">Index</a>
|
|
354
|
+
<LocalizedLink to="/">{content.links.home}</LocalizedLink>
|
|
355
|
+
<LocalizedLink to="/about">{content.links.about}</LocalizedLink>
|
|
356
|
+
</div>
|
|
357
|
+
<div className="flex gap-4">
|
|
358
|
+
<button onClick={() => navigate({ to: "/" })}>
|
|
359
|
+
{content.links.home}
|
|
360
|
+
</button>
|
|
361
|
+
<button onClick={() => navigate({ to: "/about" })}>
|
|
362
|
+
{content.links.about}
|
|
363
|
+
</button>
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
311
366
|
</div>
|
|
312
367
|
);
|
|
313
368
|
}
|
|
314
369
|
```
|
|
315
370
|
|
|
316
|
-
|
|
371
|
+
> To learn more about the `useIntlayer` hook, refer to the [documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/packages/react-intlayer/useIntlayer.md).
|
|
317
372
|
|
|
318
|
-
|
|
373
|
+
### Step 9: Create a Locale Switcher Component
|
|
319
374
|
|
|
320
|
-
|
|
375
|
+
Create a component to allow users to change languages:
|
|
321
376
|
|
|
322
|
-
```tsx fileName="src/
|
|
323
|
-
import {
|
|
324
|
-
import {
|
|
325
|
-
|
|
377
|
+
```tsx fileName="src/components/locale-switcher.tsx" codeFormat="typescript"
|
|
378
|
+
import { useLocation } from "@tanstack/react-router";
|
|
379
|
+
import {
|
|
380
|
+
getHTMLTextDir,
|
|
381
|
+
getLocaleName,
|
|
382
|
+
getLocalizedUrl,
|
|
383
|
+
Locales,
|
|
384
|
+
} from "intlayer";
|
|
385
|
+
import { useIntlayer, useLocale } from "react-intlayer";
|
|
386
|
+
|
|
387
|
+
export default function LocaleSwitcher() {
|
|
388
|
+
const { pathname, searchStr } = useLocation();
|
|
389
|
+
const content = useIntlayer("locale-switcher");
|
|
390
|
+
|
|
391
|
+
const { availableLocales, locale, setLocale } = useLocale({
|
|
392
|
+
onLocaleChange: (newLocale) => {
|
|
393
|
+
const pathWithLocale = getLocalizedUrl(pathname + searchStr, newLocale);
|
|
394
|
+
location.replace(pathWithLocale);
|
|
395
|
+
},
|
|
396
|
+
});
|
|
326
397
|
|
|
327
|
-
function Document({
|
|
328
|
-
locale,
|
|
329
|
-
children,
|
|
330
|
-
}: {
|
|
331
|
-
locale: string;
|
|
332
|
-
children: React.ReactNode;
|
|
333
|
-
}) {
|
|
334
398
|
return (
|
|
335
|
-
<
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
399
|
+
<select
|
|
400
|
+
aria-label={content.label.toString()}
|
|
401
|
+
onChange={(e) => setLocale(e.target.value)}
|
|
402
|
+
value={locale}
|
|
403
|
+
>
|
|
404
|
+
{availableLocales.map((localeItem) => (
|
|
405
|
+
<option
|
|
406
|
+
dir={getHTMLTextDir(localeItem)}
|
|
407
|
+
key={localeItem}
|
|
408
|
+
lang={localeItem}
|
|
409
|
+
value={localeItem}
|
|
410
|
+
>
|
|
411
|
+
{/* Example: Français (French) */}
|
|
412
|
+
{getLocaleName(localeItem, locale)} (
|
|
413
|
+
{getLocaleName(localeItem, Locales.ENGLISH)})
|
|
414
|
+
</option>
|
|
415
|
+
))}
|
|
416
|
+
</select>
|
|
343
417
|
);
|
|
344
418
|
}
|
|
345
|
-
|
|
346
|
-
export const Route = createRootRoute({
|
|
347
|
-
component: () => (
|
|
348
|
-
<IntlayerProvider>
|
|
349
|
-
{/* If you compute locale on server, pass it into Document; otherwise client will correct post-hydration */}
|
|
350
|
-
<Document locale={document?.documentElement?.lang || "en-GB"}>
|
|
351
|
-
<Outlet />
|
|
352
|
-
</Document>
|
|
353
|
-
</IntlayerProvider>
|
|
354
|
-
),
|
|
355
|
-
});
|
|
356
419
|
```
|
|
357
420
|
|
|
358
|
-
|
|
421
|
+
> To learn more about the `useLocale` hook, refer to the [documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/packages/react-intlayer/useLocale.md).
|
|
422
|
+
|
|
423
|
+
### Step 10: Add HTML Attributes Management (Optional)
|
|
359
424
|
|
|
360
|
-
|
|
425
|
+
Create a hook to manage HTML lang and dir attributes:
|
|
426
|
+
|
|
427
|
+
```tsx fileName="src/hooks/useI18nHTMLAttributes.tsx" codeFormat="typescript"
|
|
428
|
+
// src/hooks/useI18nHTMLAttributes.tsx
|
|
429
|
+
import { getHTMLTextDir } from "intlayer";
|
|
361
430
|
import { useEffect } from "react";
|
|
362
431
|
import { useLocale } from "react-intlayer";
|
|
363
|
-
import { getHTMLTextDir } from "intlayer";
|
|
364
432
|
|
|
365
433
|
export const useI18nHTMLAttributes = () => {
|
|
366
434
|
const { locale } = useLocale();
|
|
435
|
+
|
|
367
436
|
useEffect(() => {
|
|
368
437
|
document.documentElement.lang = locale;
|
|
369
438
|
document.documentElement.dir = getHTMLTextDir(locale);
|
|
@@ -371,87 +440,185 @@ export const useI18nHTMLAttributes = () => {
|
|
|
371
440
|
};
|
|
372
441
|
```
|
|
373
442
|
|
|
374
|
-
|
|
443
|
+
Then use it in your root component:
|
|
375
444
|
|
|
376
|
-
|
|
445
|
+
```tsx fileName="src/routes/{-$locale}/index.tsx" codeFormat="typescript"
|
|
446
|
+
import { createFileRoute, Navigate, Outlet } from "@tanstack/react-router";
|
|
447
|
+
import { configuration } from "intlayer";
|
|
448
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
377
449
|
|
|
378
|
-
|
|
450
|
+
import { useI18nHTMLAttributes } from "@/hooks/useI18nHTMLAttributes"; // import the hook
|
|
379
451
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
forwardRef,
|
|
384
|
-
type AnchorHTMLAttributes,
|
|
385
|
-
type DetailedHTMLProps,
|
|
386
|
-
} from "react";
|
|
387
|
-
import { useLocale } from "react-intlayer";
|
|
452
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
453
|
+
component: LayoutComponent,
|
|
454
|
+
});
|
|
388
455
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const hrefI18n =
|
|
401
|
-
href && !isExternal(href) ? getLocalizedUrl(href, locale) : href;
|
|
402
|
-
return (
|
|
403
|
-
<a href={hrefI18n} ref={ref} {...props}>
|
|
404
|
-
{children}
|
|
405
|
-
</a>
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
);
|
|
409
|
-
Link.displayName = "Link";
|
|
456
|
+
function LayoutComponent() {
|
|
457
|
+
useI18nHTMLAttributes(); // add this line
|
|
458
|
+
|
|
459
|
+
const { locale } = Route.useParams();
|
|
460
|
+
|
|
461
|
+
return (
|
|
462
|
+
<IntlayerProvider locale={locale}>
|
|
463
|
+
<Outlet />
|
|
464
|
+
</IntlayerProvider>
|
|
465
|
+
);
|
|
466
|
+
}
|
|
410
467
|
```
|
|
411
468
|
|
|
412
|
-
|
|
469
|
+
### Step 11: Build and Run Your Application
|
|
413
470
|
|
|
414
|
-
|
|
471
|
+
Build the content dictionaries and run your application:
|
|
415
472
|
|
|
416
|
-
|
|
473
|
+
```bash packageManager="npm"
|
|
474
|
+
# Build Intlayer dictionaries
|
|
475
|
+
npm run intlayer:build
|
|
417
476
|
|
|
418
|
-
|
|
477
|
+
# Start development server
|
|
478
|
+
npm run dev
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
```bash packageManager="pnpm"
|
|
482
|
+
# Build Intlayer dictionaries
|
|
483
|
+
pnpm intlayer:build
|
|
484
|
+
|
|
485
|
+
# Start development server
|
|
486
|
+
pnpm dev
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
```bash packageManager="yarn"
|
|
490
|
+
# Build Intlayer dictionaries
|
|
491
|
+
yarn intlayer:build
|
|
492
|
+
|
|
493
|
+
# Start development server
|
|
494
|
+
yarn dev
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### Step 12: Configure TypeScript (Optional)
|
|
498
|
+
|
|
499
|
+
Intlayer uses module augmentation to gain the benefits of TypeScript and strengthen your codebase.
|
|
500
|
+
|
|
501
|
+
Ensure your TypeScript configuration includes the autogenerated types:
|
|
419
502
|
|
|
420
503
|
```json5 fileName="tsconfig.json"
|
|
421
504
|
{
|
|
422
|
-
|
|
505
|
+
compilerOptions: {
|
|
506
|
+
// ... your existing TypeScript configurations
|
|
507
|
+
},
|
|
508
|
+
include: [
|
|
509
|
+
// ... your existing includes
|
|
510
|
+
".intlayer/**/*.ts", // Include the auto-generated types
|
|
511
|
+
],
|
|
423
512
|
}
|
|
424
513
|
```
|
|
425
514
|
|
|
426
|
-
|
|
515
|
+
### Git Configuration
|
|
427
516
|
|
|
428
|
-
|
|
517
|
+
It is recommended to ignore the files generated by Intlayer. This prevents you from committing them to your Git repository.
|
|
429
518
|
|
|
430
|
-
|
|
519
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
431
520
|
|
|
432
|
-
```gitignore
|
|
521
|
+
```plaintext fileName=".gitignore"
|
|
522
|
+
# Ignore the files generated by Intlayer
|
|
433
523
|
.intlayer
|
|
434
524
|
```
|
|
435
525
|
|
|
436
526
|
---
|
|
437
527
|
|
|
528
|
+
### Step 13: Create Redirection (Optional)
|
|
529
|
+
|
|
530
|
+
```typescript fileName="src/routes/{-$locale}/rotue.tsx" codeFormat="typescript"
|
|
531
|
+
function LayoutComponent() {
|
|
532
|
+
useI18nHTMLAttributes();
|
|
533
|
+
|
|
534
|
+
const { locale } = Route.useParams();
|
|
535
|
+
const { locale: selectedLocale } = useLocale();
|
|
536
|
+
const { defaultLocale } = configuration.internationalization;
|
|
537
|
+
const { prefixDefault } = configuration.middleware;
|
|
538
|
+
|
|
539
|
+
// Redirect to the default locale if no locale is present in the URL when prefixDefault is true
|
|
540
|
+
if (selectedLocale === defaultLocale && !locale && prefixDefault) {
|
|
541
|
+
return <Navigate replace to={defaultLocale} />;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// Redirect to the selected locale if the locale in the URL does not match the selected locale
|
|
545
|
+
if (selectedLocale !== defaultLocale && !locale) {
|
|
546
|
+
return <Navigate replace to={selectedLocale} />;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
return (
|
|
550
|
+
<IntlayerProvider locale={locale}>
|
|
551
|
+
<Outlet />
|
|
552
|
+
</IntlayerProvider>
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
## Production Deployment
|
|
558
|
+
|
|
559
|
+
When deploying your application:
|
|
560
|
+
|
|
561
|
+
1. **Build your application:**
|
|
562
|
+
|
|
563
|
+
```bash
|
|
564
|
+
npm run build
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
2. **Build Intlayer dictionaries:**
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
npm run intlayer:build
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
3. **Move `vite-intlayer` to dependencies** if using middleware in production:
|
|
574
|
+
```bash
|
|
575
|
+
npm install vite-intlayer --save
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
Your application will now support:
|
|
579
|
+
|
|
580
|
+
- **URL Structure**: `/en`, `/en/about`, `/tr`, `/tr/about`
|
|
581
|
+
- **Automatic locale detection** based on browser preferences
|
|
582
|
+
- **Locale-aware routing** with Tanstack Start
|
|
583
|
+
- **TypeScript support** with auto-generated types
|
|
584
|
+
- **Server-side rendering** with proper locale handling
|
|
585
|
+
|
|
438
586
|
## VS Code Extension
|
|
439
587
|
|
|
440
|
-
|
|
441
|
-
|
|
588
|
+
To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
|
|
589
|
+
|
|
590
|
+
[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
591
|
+
|
|
592
|
+
This extension provides:
|
|
593
|
+
|
|
594
|
+
- **Autocompletion** for translation keys.
|
|
595
|
+
- **Real-time error detection** for missing translations.
|
|
596
|
+
- **Inline previews** of translated content.
|
|
597
|
+
- **Quick actions** to easily create and update translations.
|
|
598
|
+
|
|
599
|
+
For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
|
|
442
600
|
|
|
443
601
|
---
|
|
444
602
|
|
|
445
603
|
## Go Further
|
|
446
604
|
|
|
447
|
-
-
|
|
448
|
-
- CMS mode
|
|
449
|
-
- Locale detection on the edge / adapters
|
|
605
|
+
To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/intlayer_visual_editor.md) or externalise your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/intlayer_CMS.md).
|
|
450
606
|
|
|
451
607
|
---
|
|
452
608
|
|
|
609
|
+
## Documentation References
|
|
610
|
+
|
|
611
|
+
- [Intlayer Documentation](https://intlayer.org)
|
|
612
|
+
- [Tanstack Start Documentation](https://reactrouter.com/)
|
|
613
|
+
- [useIntlayer hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/packages/react-intlayer/useIntlayer.md)
|
|
614
|
+
- [useLocale hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/packages/react-intlayer/useLocale.md)
|
|
615
|
+
- [Content Declaration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/dictionary/get_started.md)
|
|
616
|
+
- [Configuration](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/configuration.md)
|
|
617
|
+
|
|
618
|
+
This comprehensive guide provides everything you need to integrate Intlayer with Tanstack Start for a fully internationalised application with locale-aware routing and TypeScript support.
|
|
619
|
+
|
|
453
620
|
## Doc History
|
|
454
621
|
|
|
455
|
-
| Version | Date | Changes
|
|
456
|
-
| ------- | ---------- |
|
|
457
|
-
|
|
|
622
|
+
| Version | Date | Changes |
|
|
623
|
+
| ------- | ---------- | ------------------------ |
|
|
624
|
+
| 5.8.1 | 2025-09-09 | Added for Tanstack Start |
|