@intlayer/docs 5.8.1 → 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 +12 -12
- 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,440 @@
|
|
|
1
1
|
---
|
|
2
|
-
createdAt: 2025-
|
|
3
|
-
updatedAt: 2025-
|
|
4
|
-
title: Começando com Intlayer no
|
|
5
|
-
description:
|
|
2
|
+
createdAt: 2025-09-09
|
|
3
|
+
updatedAt: 2025-09-09
|
|
4
|
+
title: Começando com Intlayer no Tanstack Start
|
|
5
|
+
description: Aprenda como adicionar internacionalização (i18n) à sua aplicação Tanstack Start usando Intlayer. Siga este guia completo para tornar seu app multilíngue com roteamento sensível ao locale.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internacionalização
|
|
8
8
|
- Documentação
|
|
9
9
|
- Intlayer
|
|
10
|
-
-
|
|
11
|
-
- TanStack Router
|
|
10
|
+
- Tanstack Start
|
|
12
11
|
- React
|
|
13
12
|
- i18n
|
|
14
|
-
-
|
|
13
|
+
- TypeScript
|
|
14
|
+
- Roteamento por Locale
|
|
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
|
-
# Começando a Internacionalizar (i18n) com Intlayer e
|
|
24
|
+
# Começando a Internacionalizar (i18n) com Intlayer e Tanstack Start
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
Este guia demonstra como integrar o **Intlayer** para uma internacionalização perfeita em projetos Tanstack Start com roteamento sensível ao locale, suporte a TypeScript e práticas modernas de desenvolvimento.
|
|
24
27
|
|
|
25
|
-
|
|
28
|
+
## O que é o Intlayer?
|
|
26
29
|
|
|
27
|
-
-
|
|
28
|
-
- **Metadados e rotas dinâmicas** (prontas para SEO).
|
|
29
|
-
- **Troca de localidade em tempo de execução** (e auxiliares para detectar/persistir localidades).
|
|
30
|
-
- **Plugin Vite** para transformações em tempo de build + experiência de desenvolvimento (DX).
|
|
30
|
+
**Intlayer** é uma biblioteca inovadora e open-source de internacionalização (i18n) projetada para simplificar o suporte multilíngue em aplicações web modernas.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Com o Intlayer, você pode:
|
|
33
|
+
|
|
34
|
+
- **Gerenciar traduções facilmente** usando dicionários declarativos no nível do componente.
|
|
35
|
+
- **Localizar dinamicamente metadados**, rotas e conteúdo.
|
|
36
|
+
- **Garantir suporte a TypeScript** com tipos gerados automaticamente, melhorando o autocompletar e a detecção de erros.
|
|
37
|
+
- **Beneficiar-se de recursos avançados**, como detecção e troca dinâmica de locale.
|
|
38
|
+
- **Habilitar roteamento sensível ao locale** com o sistema de roteamento baseado em arquivos do Tanstack Start.
|
|
33
39
|
|
|
34
40
|
---
|
|
35
41
|
|
|
36
|
-
## Passo
|
|
42
|
+
## Guia Passo a Passo para Configurar o Intlayer em uma Aplicação Tanstack Start
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
# npm
|
|
40
|
-
npm i intlayer react-intlayer
|
|
41
|
-
npm i -D vite-intlayer
|
|
44
|
+
### Passo 1: Criar o Projeto
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
Comece criando um novo projeto TanStack Start seguindo o guia [Start new project](https://tanstack.com/start/latest/docs/framework/react/quick-start) no site do TanStack Start.
|
|
47
|
+
|
|
48
|
+
### Passo 2: Instalar os Pacotes do Intlayer
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
Instale os pacotes necessários usando seu gerenciador de pacotes preferido:
|
|
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
|
+
- **intlayer**
|
|
65
|
+
|
|
66
|
+
O pacote principal que fornece ferramentas de internacionalização para gerenciamento de configuração, tradução, [declaração de conteúdo](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dictionary/get_started.md), transpiração e [comandos CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_cli.md).
|
|
67
|
+
|
|
68
|
+
- **react-intlayer**
|
|
69
|
+
O pacote que integra o Intlayer com aplicações React. Ele fornece provedores de contexto e hooks para internacionalização em React.
|
|
70
|
+
|
|
71
|
+
- **vite-intlayer**
|
|
72
|
+
Inclui o plugin Vite para integrar o Intlayer com o [empacotador Vite](https://vite.dev/guide/why.html#why-bundle-for-production), além de middleware para detectar o locale preferido do usuário, gerenciar cookies e lidar com redirecionamento de URL.
|
|
57
73
|
|
|
58
|
-
|
|
74
|
+
### Passo 3: Configuração do seu projeto
|
|
59
75
|
|
|
60
|
-
Crie
|
|
76
|
+
Crie um arquivo de configuração para configurar os idiomas da sua aplicação:
|
|
61
77
|
|
|
62
|
-
```
|
|
63
|
-
import {
|
|
78
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
79
|
+
import type { IntlayerConfig } from "intlayer";
|
|
80
|
+
|
|
81
|
+
import { Locales } from "intlayer";
|
|
64
82
|
|
|
65
83
|
const config: IntlayerConfig = {
|
|
66
84
|
internationalization: {
|
|
67
|
-
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
68
85
|
defaultLocale: Locales.ENGLISH,
|
|
86
|
+
locales: [
|
|
87
|
+
Locales.ENGLISH,
|
|
88
|
+
Locales.FRENCH,
|
|
89
|
+
Locales.SPANISH,
|
|
90
|
+
// Seus outros idiomas
|
|
91
|
+
],
|
|
69
92
|
},
|
|
70
|
-
// Você também pode ajustar: contentDir, contentFileExtensions, opções de middleware, etc.
|
|
71
93
|
};
|
|
72
94
|
|
|
73
95
|
export default config;
|
|
74
96
|
```
|
|
75
97
|
|
|
76
|
-
|
|
98
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
99
|
+
import { Locales } from "intlayer";
|
|
77
100
|
|
|
78
|
-
|
|
101
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
102
|
+
const config = {
|
|
103
|
+
internationalization: {
|
|
104
|
+
defaultLocale: Locales.ENGLISH,
|
|
105
|
+
locales: [
|
|
106
|
+
Locales.ENGLISH,
|
|
107
|
+
Locales.FRENCH,
|
|
108
|
+
Locales.SPANISH,
|
|
109
|
+
// Seus outros idiomas
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
};
|
|
79
113
|
|
|
80
|
-
|
|
114
|
+
export default config;
|
|
115
|
+
```
|
|
81
116
|
|
|
82
|
-
|
|
117
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
118
|
+
const { Locales } = require("intlayer");
|
|
83
119
|
|
|
84
|
-
|
|
120
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
121
|
+
const config = {
|
|
122
|
+
internationalization: {
|
|
123
|
+
defaultLocale: Locales.ENGLISH,
|
|
124
|
+
locales: [
|
|
125
|
+
Locales.ENGLISH,
|
|
126
|
+
Locales.FRENCH,
|
|
127
|
+
Locales.SPANISH,
|
|
128
|
+
// Seus outros idiomas
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
module.exports = config;
|
|
134
|
+
```
|
|
85
135
|
|
|
86
|
-
|
|
136
|
+
> Através deste arquivo de configuração, você pode configurar URLs localizadas, redirecionamento de middleware, nomes de cookies, a localização e extensão das suas declarações de conteúdo, desabilitar logs do Intlayer no console, e muito mais. Para uma lista completa dos parâmetros disponíveis, consulte a [documentação de configuração](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/configuration.md).
|
|
137
|
+
|
|
138
|
+
### Passo 4: Integre o Intlayer na sua Configuração do Vite
|
|
139
|
+
|
|
140
|
+
Adicione o plugin intlayer na sua configuração:
|
|
141
|
+
|
|
142
|
+
```typescript fileName="vite.config.ts" codeFormat="typescript"
|
|
143
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
87
144
|
import { defineConfig } from "vite";
|
|
88
|
-
import
|
|
89
|
-
import
|
|
145
|
+
import { intlayerMiddlewarePlugin, intlayerPlugin } from "vite-intlayer";
|
|
146
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
90
147
|
|
|
91
148
|
export default defineConfig({
|
|
92
149
|
plugins: [
|
|
93
|
-
|
|
150
|
+
reactRouter(),
|
|
151
|
+
tsconfigPaths(),
|
|
94
152
|
intlayerPlugin(),
|
|
95
|
-
|
|
96
|
-
intLayerMiddlewarePlugin(),
|
|
153
|
+
intlayerMiddlewarePlugin(),
|
|
97
154
|
],
|
|
98
155
|
});
|
|
99
156
|
```
|
|
100
157
|
|
|
101
|
-
>
|
|
158
|
+
> O plugin `intlayerPlugin()` do Vite é usado para integrar o Intlayer com o Vite. Ele garante a construção dos arquivos de declaração de conteúdo e os monitora no modo de desenvolvimento. Define as variáveis de ambiente do Intlayer dentro da aplicação Vite. Além disso, fornece aliases para otimizar o desempenho.
|
|
102
159
|
|
|
103
|
-
|
|
160
|
+
### Passo 5: Crie Componentes de Layout
|
|
161
|
+
|
|
162
|
+
Configure seu layout raiz e layouts específicos por localidade:
|
|
163
|
+
|
|
164
|
+
#### Layout Raiz
|
|
165
|
+
|
|
166
|
+
```tsx fileName="src/routes/{-$locale}/route.tsx" codeFormat="typescript"
|
|
167
|
+
// src/routes/{-$locale}/route.tsx
|
|
168
|
+
import { createFileRoute, Navigate, Outlet } from "@tanstack/react-router";
|
|
169
|
+
import { configuration } from "intlayer";
|
|
170
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
171
|
+
|
|
172
|
+
import { useI18nHTMLAttributes } from "@/hooks/useI18nHTMLAttributes";
|
|
173
|
+
|
|
174
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
175
|
+
component: LayoutComponent,
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
function LayoutComponent() {
|
|
179
|
+
const { locale } = Route.useParams();
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<IntlayerProvider locale={locale}>
|
|
183
|
+
<Outlet />
|
|
184
|
+
</IntlayerProvider>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Passo 6: Declare Seu Conteúdo
|
|
104
190
|
|
|
105
|
-
|
|
191
|
+
Crie e gerencie suas declarações de conteúdo para armazenar traduções:
|
|
106
192
|
|
|
107
|
-
|
|
193
|
+
```tsx fileName="src/contents/page.content.ts" contentDeclarationFormat="typescript"
|
|
194
|
+
import type { Dictionary } from "intlayer";
|
|
108
195
|
|
|
109
|
-
|
|
110
|
-
import { t, type Dictionary } from "intlayer";
|
|
111
|
-
import type { ReactNode } from "react";
|
|
196
|
+
import { t } from "intlayer";
|
|
112
197
|
|
|
113
198
|
const appContent = {
|
|
114
|
-
key: "app",
|
|
115
199
|
content: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
200
|
+
links: {
|
|
201
|
+
about: t({
|
|
202
|
+
en: "About",
|
|
203
|
+
es: "Acerca de",
|
|
204
|
+
fr: "À propos",
|
|
205
|
+
}),
|
|
206
|
+
home: t({
|
|
207
|
+
en: "Home",
|
|
208
|
+
es: "Inicio",
|
|
209
|
+
fr: "Accueil",
|
|
210
|
+
pt: "Início",
|
|
211
|
+
}),
|
|
212
|
+
},
|
|
213
|
+
meta: {
|
|
214
|
+
description: t({
|
|
215
|
+
en: "This is an example of using Intlayer with TanStack Router",
|
|
216
|
+
es: "Este es un ejemplo de uso de Intlayer con TanStack Router",
|
|
217
|
+
fr: "Ceci est un exemple d'utilisation d'Intlayer avec TanStack Router",
|
|
218
|
+
pt: "Este é um exemplo de uso do Intlayer com TanStack Router",
|
|
219
|
+
}),
|
|
220
|
+
},
|
|
128
221
|
title: t({
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
fr: "
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
count: t({
|
|
135
|
-
pt: "a contagem é ",
|
|
136
|
-
en: "count is ",
|
|
137
|
-
fr: "le compte est ",
|
|
138
|
-
es: "el recuento es ",
|
|
139
|
-
}),
|
|
140
|
-
edit: t<ReactNode>({
|
|
141
|
-
pt: (
|
|
142
|
-
<>
|
|
143
|
-
Edite <code>src/routes/index.tsx</code> e salve para testar 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
|
-
pt: "Clique nos logos para saber mais",
|
|
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",
|
|
222
|
+
en: "Welcome to Intlayer + TanStack Router",
|
|
223
|
+
es: "Bienvenido a Intlayer + TanStack Router",
|
|
224
|
+
fr: "Bienvenue à Intlayer + TanStack Router",
|
|
225
|
+
pt: "Bem-vindo ao Intlayer + TanStack Router",
|
|
168
226
|
}),
|
|
169
227
|
},
|
|
228
|
+
key: "app",
|
|
170
229
|
} satisfies Dictionary;
|
|
171
230
|
|
|
172
231
|
export default appContent;
|
|
173
232
|
```
|
|
174
233
|
|
|
175
|
-
|
|
234
|
+
> Suas declarações de conteúdo podem ser definidas em qualquer lugar da sua aplicação assim que forem incluídas no diretório `contentDir` (por padrão, `./app`). E devem corresponder à extensão do arquivo de declaração de conteúdo (por padrão, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
176
235
|
|
|
177
|
-
>
|
|
236
|
+
> Para mais detalhes, consulte a [documentação de declaração de conteúdo](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dictionary/get_started.md).
|
|
178
237
|
|
|
179
|
-
|
|
238
|
+
### Passo 7: Criar Componentes e Hooks Sensíveis ao Locale
|
|
180
239
|
|
|
181
|
-
|
|
240
|
+
Crie um componente `LocalizedLink` para navegação sensível ao locale:
|
|
182
241
|
|
|
183
|
-
|
|
242
|
+
```tsx fileName="src/components/localized-link.tsx" codeFormat="typescript"
|
|
243
|
+
// src/components/localized-link.tsx
|
|
244
|
+
// eslint-disable-next-line no-restricted-imports
|
|
245
|
+
import { Link, type LinkProps } from "@tanstack/react-router";
|
|
246
|
+
import { getLocalizedUrl } from "intlayer";
|
|
247
|
+
import { useLocale } from "react-intlayer";
|
|
184
248
|
|
|
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
|
-
// Exemplo de uso de um dicionário no nível superior:
|
|
195
|
-
const content = useIntlayer("app");
|
|
249
|
+
type LocalizedLinkProps = {
|
|
250
|
+
to: string;
|
|
251
|
+
} & Omit<LinkProps, "to">;
|
|
196
252
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<nav className="flex gap-3 p-3">
|
|
200
|
-
<RouterLink to="/">Início</RouterLink>
|
|
201
|
-
<RouterLink to="/about">Sobre</RouterLink>
|
|
202
|
-
</nav>
|
|
203
|
-
<main className="p-6">
|
|
204
|
-
<h1>{content.title}</h1>
|
|
205
|
-
<Outlet />
|
|
206
|
-
</main>
|
|
207
|
-
</div>
|
|
208
|
-
);
|
|
209
|
-
}
|
|
253
|
+
export function LocalizedLink(props: LocalizedLinkProps) {
|
|
254
|
+
const { locale } = useLocale();
|
|
210
255
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
<AppShell />
|
|
215
|
-
</IntlayerProvider>
|
|
216
|
-
),
|
|
217
|
-
});
|
|
218
|
-
```
|
|
256
|
+
const isExternal = (to: string) => {
|
|
257
|
+
return /^(https?:)?\/\//.test(to);
|
|
258
|
+
};
|
|
219
259
|
|
|
220
|
-
|
|
260
|
+
const to = isExternal(props.to)
|
|
261
|
+
? props.to
|
|
262
|
+
: getLocalizedUrl(props.to, locale);
|
|
221
263
|
|
|
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
|
-
});
|
|
264
|
+
return <Link {...props} to={to as LinkProps["to"]} />;
|
|
265
|
+
}
|
|
245
266
|
```
|
|
246
267
|
|
|
247
|
-
|
|
248
|
-
>
|
|
249
|
-
> ```jsx
|
|
250
|
-
> <img alt={c.reactLogo.value} />
|
|
251
|
-
> ```
|
|
268
|
+
Crie um hook `useLocalizedNavigate` para navegação programática:
|
|
252
269
|
|
|
253
|
-
|
|
270
|
+
```tsx fileName="src/hooks/useLocalizedNavigate.tsx" codeFormat="typescript"
|
|
271
|
+
// src/hooks/useLocalizedNavigate.tsx
|
|
272
|
+
// eslint-disable-next-line no-restricted-imports
|
|
273
|
+
import { NavigateOptions, useNavigate } from "@tanstack/react-router";
|
|
274
|
+
import { getLocalizedUrl } from "intlayer";
|
|
275
|
+
import { useLocale } from "react-intlayer";
|
|
254
276
|
|
|
255
|
-
|
|
277
|
+
type LocalizedNavigateOptions = {
|
|
278
|
+
to: string;
|
|
279
|
+
} & Omit<NavigateOptions, "to">;
|
|
256
280
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
281
|
+
export const useLocalizedNavigate = () => {
|
|
282
|
+
const navigate = useNavigate();
|
|
283
|
+
const { locale } = useLocale();
|
|
260
284
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
285
|
+
const isExternal = (to: string) => {
|
|
286
|
+
return /^(https?:)?\/\//.test(to);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const localizedNavigate = (options: LocalizedNavigateOptions) => {
|
|
290
|
+
const to = isExternal(options.to)
|
|
291
|
+
? options.to
|
|
292
|
+
: getLocalizedUrl(options.to, locale);
|
|
293
|
+
|
|
294
|
+
navigate({ ...options, to: to as NavigateOptions["to"] });
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
return localizedNavigate;
|
|
298
|
+
};
|
|
271
299
|
```
|
|
272
300
|
|
|
273
|
-
|
|
301
|
+
### Passo 8: Utilize o Intlayer em Suas Páginas
|
|
274
302
|
|
|
275
|
-
|
|
303
|
+
Acesse seus dicionários de conteúdo em toda a sua aplicação:
|
|
276
304
|
|
|
277
|
-
|
|
305
|
+
#### Página de Redirecionamento Raiz
|
|
278
306
|
|
|
279
|
-
|
|
307
|
+
```tsx fileName="src/routes/page.tsx" codeFormat="typescript"
|
|
308
|
+
// src/routes/page.tsx
|
|
309
|
+
import { useLocale } from "react-intlayer";
|
|
310
|
+
import { Navigate } from "react-router";
|
|
280
311
|
|
|
281
|
-
|
|
312
|
+
export default function Page() {
|
|
313
|
+
const { locale } = useLocale();
|
|
282
314
|
|
|
283
|
-
|
|
315
|
+
return <Navigate replace to={locale} />;
|
|
316
|
+
}
|
|
317
|
+
```
|
|
284
318
|
|
|
285
|
-
|
|
319
|
+
#### Página Inicial Localizada
|
|
286
320
|
|
|
287
|
-
```tsx fileName="src/
|
|
288
|
-
import {
|
|
289
|
-
import {
|
|
290
|
-
import {
|
|
321
|
+
```tsx fileName="src/routes/{-$locale}/index.tsx" codeFormat="typescript"
|
|
322
|
+
import { createFileRoute } from "@tanstack/react-router";
|
|
323
|
+
import { getIntlayer } from "intlayer";
|
|
324
|
+
import { useIntlayer } from "react-intlayer";
|
|
291
325
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
326
|
+
import LocaleSwitcher from "@/components/locale-switcher";
|
|
327
|
+
import { LocalizedLink } from "@/components/localized-link";
|
|
328
|
+
import { useLocalizedNavigate } from "@/hooks/useLocalizedNavigate";
|
|
329
|
+
|
|
330
|
+
export const Route = createFileRoute("/{-$locale}/")({
|
|
331
|
+
component: RouteComponent,
|
|
332
|
+
head: ({ params }) => {
|
|
333
|
+
const { locale } = params;
|
|
334
|
+
const metaContent = getIntlayer("app", locale);
|
|
335
|
+
|
|
336
|
+
return {
|
|
337
|
+
meta: [
|
|
338
|
+
{ title: metaContent.title },
|
|
339
|
+
{ content: metaContent.meta.description, name: "description" },
|
|
340
|
+
],
|
|
341
|
+
};
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
function RouteComponent() {
|
|
346
|
+
const content = useIntlayer("app");
|
|
347
|
+
const navigate = useLocalizedNavigate();
|
|
305
348
|
|
|
306
349
|
return (
|
|
307
|
-
<div className="
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
|
|
350
|
+
<div className="grid place-items-center h-screen">
|
|
351
|
+
<div className="flex flex-col gap-4 items-center text-center">
|
|
352
|
+
{content.title}
|
|
353
|
+
<LocaleSwitcher />
|
|
354
|
+
<div className="flex gap-4">
|
|
355
|
+
<a href="/">Índice</a>
|
|
356
|
+
<LocalizedLink to="/">{content.links.home}</LocalizedLink>
|
|
357
|
+
<LocalizedLink to="/about">{content.links.about}</LocalizedLink>
|
|
358
|
+
</div>
|
|
359
|
+
<div className="flex gap-4">
|
|
360
|
+
<button onClick={() => navigate({ to: "/" })}>
|
|
361
|
+
{content.links.home}
|
|
362
|
+
</button>
|
|
363
|
+
<button onClick={() => navigate({ to: "/about" })}>
|
|
364
|
+
{content.links.about}
|
|
365
|
+
</button>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
311
368
|
</div>
|
|
312
369
|
);
|
|
313
370
|
}
|
|
314
371
|
```
|
|
315
372
|
|
|
316
|
-
|
|
373
|
+
> Para saber mais sobre o hook `useIntlayer`, consulte a [documentação](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/packages/react-intlayer/useIntlayer.md).
|
|
317
374
|
|
|
318
|
-
|
|
375
|
+
### Passo 9: Criar um Componente de Troca de Idioma
|
|
319
376
|
|
|
320
|
-
|
|
377
|
+
Crie um componente para permitir que os usuários mudem de idioma:
|
|
321
378
|
|
|
322
|
-
```tsx fileName="src/
|
|
323
|
-
import {
|
|
324
|
-
import {
|
|
325
|
-
|
|
379
|
+
```tsx fileName="src/components/locale-switcher.tsx" codeFormat="typescript"
|
|
380
|
+
import { useLocation } from "@tanstack/react-router";
|
|
381
|
+
import {
|
|
382
|
+
getHTMLTextDir,
|
|
383
|
+
getLocaleName,
|
|
384
|
+
getLocalizedUrl,
|
|
385
|
+
Locales,
|
|
386
|
+
} from "intlayer";
|
|
387
|
+
import { useIntlayer, useLocale } from "react-intlayer";
|
|
388
|
+
|
|
389
|
+
export default function LocaleSwitcher() {
|
|
390
|
+
const { pathname, searchStr } = useLocation();
|
|
391
|
+
const content = useIntlayer("locale-switcher");
|
|
392
|
+
|
|
393
|
+
const { availableLocales, locale, setLocale } = useLocale({
|
|
394
|
+
onLocaleChange: (newLocale) => {
|
|
395
|
+
const pathWithLocale = getLocalizedUrl(pathname + searchStr, newLocale);
|
|
396
|
+
location.replace(pathWithLocale);
|
|
397
|
+
},
|
|
398
|
+
});
|
|
326
399
|
|
|
327
|
-
function Document({
|
|
328
|
-
locale,
|
|
329
|
-
children,
|
|
330
|
-
}: {
|
|
331
|
-
locale: string;
|
|
332
|
-
children: React.ReactNode;
|
|
333
|
-
}) {
|
|
334
400
|
return (
|
|
335
|
-
<
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
401
|
+
<select
|
|
402
|
+
aria-label={content.label.toString()}
|
|
403
|
+
onChange={(e) => setLocale(e.target.value)}
|
|
404
|
+
value={locale}
|
|
405
|
+
>
|
|
406
|
+
{availableLocales.map((localeItem) => (
|
|
407
|
+
<option
|
|
408
|
+
dir={getHTMLTextDir(localeItem)}
|
|
409
|
+
key={localeItem}
|
|
410
|
+
lang={localeItem}
|
|
411
|
+
value={localeItem}
|
|
412
|
+
>
|
|
413
|
+
{/* Exemplo: Français (Francês) */}
|
|
414
|
+
{getLocaleName(localeItem, locale)} (
|
|
415
|
+
{getLocaleName(localeItem, Locales.ENGLISH)})
|
|
416
|
+
</option>
|
|
417
|
+
))}
|
|
418
|
+
</select>
|
|
343
419
|
);
|
|
344
420
|
}
|
|
345
|
-
|
|
346
|
-
export const Route = createRootRoute({
|
|
347
|
-
component: () => (
|
|
348
|
-
<IntlayerProvider>
|
|
349
|
-
{/* Se você calcular o locale no servidor, passe-o para o Document; caso contrário, o cliente corrigirá após a hidratação */}
|
|
350
|
-
<Document locale={document?.documentElement?.lang || "en"}>
|
|
351
|
-
<Outlet />
|
|
352
|
-
</Document>
|
|
353
|
-
</IntlayerProvider>
|
|
354
|
-
),
|
|
355
|
-
});
|
|
356
421
|
```
|
|
357
422
|
|
|
358
|
-
Para
|
|
423
|
+
> Para saber mais sobre o hook `useLocale`, consulte a [documentação](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/packages/react-intlayer/useLocale.md).
|
|
424
|
+
|
|
425
|
+
### Passo 10: Adicionar Gerenciamento de Atributos HTML (Opcional)
|
|
359
426
|
|
|
360
|
-
|
|
427
|
+
Crie um hook para gerenciar os atributos lang e dir do HTML:
|
|
428
|
+
|
|
429
|
+
```tsx fileName="src/hooks/useI18nHTMLAttributes.tsx" codeFormat="typescript"
|
|
430
|
+
// src/hooks/useI18nHTMLAttributes.tsx
|
|
431
|
+
import { getHTMLTextDir } from "intlayer";
|
|
361
432
|
import { useEffect } from "react";
|
|
362
433
|
import { useLocale } from "react-intlayer";
|
|
363
|
-
import { getHTMLTextDir } from "intlayer";
|
|
364
434
|
|
|
365
435
|
export const useI18nHTMLAttributes = () => {
|
|
366
436
|
const { locale } = useLocale();
|
|
437
|
+
|
|
367
438
|
useEffect(() => {
|
|
368
439
|
document.documentElement.lang = locale;
|
|
369
440
|
document.documentElement.dir = getHTMLTextDir(locale);
|
|
@@ -371,87 +442,185 @@ export const useI18nHTMLAttributes = () => {
|
|
|
371
442
|
};
|
|
372
443
|
```
|
|
373
444
|
|
|
374
|
-
|
|
445
|
+
Então use-o no seu componente raiz:
|
|
375
446
|
|
|
376
|
-
|
|
447
|
+
```tsx fileName="src/routes/{-$locale}/index.tsx" codeFormat="typescript"
|
|
448
|
+
import { createFileRoute, Navigate, Outlet } from "@tanstack/react-router";
|
|
449
|
+
import { configuration } from "intlayer";
|
|
450
|
+
import { IntlayerProvider, useLocale } from "react-intlayer";
|
|
377
451
|
|
|
378
|
-
|
|
452
|
+
import { useI18nHTMLAttributes } from "@/hooks/useI18nHTMLAttributes"; // importar o hook
|
|
379
453
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
forwardRef,
|
|
384
|
-
type AnchorHTMLAttributes,
|
|
385
|
-
type DetailedHTMLProps,
|
|
386
|
-
} from "react";
|
|
387
|
-
import { useLocale } from "react-intlayer";
|
|
454
|
+
export const Route = createFileRoute("/{-$locale}")({
|
|
455
|
+
component: LayoutComponent,
|
|
456
|
+
});
|
|
388
457
|
|
|
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";
|
|
458
|
+
function LayoutComponent() {
|
|
459
|
+
useI18nHTMLAttributes(); // adicione esta linha
|
|
460
|
+
|
|
461
|
+
const { locale } = Route.useParams();
|
|
462
|
+
|
|
463
|
+
return (
|
|
464
|
+
<IntlayerProvider locale={locale}>
|
|
465
|
+
<Outlet />
|
|
466
|
+
</IntlayerProvider>
|
|
467
|
+
);
|
|
468
|
+
}
|
|
410
469
|
```
|
|
411
470
|
|
|
412
|
-
|
|
471
|
+
### Passo 11: Construir e Executar Sua Aplicação
|
|
413
472
|
|
|
414
|
-
|
|
473
|
+
Construa os dicionários de conteúdo e execute sua aplicação:
|
|
415
474
|
|
|
416
|
-
|
|
475
|
+
```bash packageManager="npm"
|
|
476
|
+
# Construir os dicionários do Intlayer
|
|
477
|
+
npm run intlayer:build
|
|
417
478
|
|
|
418
|
-
|
|
479
|
+
# Iniciar o servidor de desenvolvimento
|
|
480
|
+
npm run dev
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
```bash packageManager="pnpm"
|
|
484
|
+
# Construir os dicionários do Intlayer
|
|
485
|
+
pnpm intlayer:build
|
|
486
|
+
|
|
487
|
+
# Iniciar o servidor de desenvolvimento
|
|
488
|
+
pnpm dev
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
```bash packageManager="yarn"
|
|
492
|
+
# Construir os dicionários do Intlayer
|
|
493
|
+
yarn intlayer:build
|
|
494
|
+
|
|
495
|
+
# Iniciar o servidor de desenvolvimento
|
|
496
|
+
yarn dev
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Passo 12: Configurar o TypeScript (Opcional)
|
|
500
|
+
|
|
501
|
+
Intlayer usa a ampliação de módulos para obter os benefícios do TypeScript e tornar sua base de código mais robusta.
|
|
502
|
+
|
|
503
|
+
Certifique-se de que sua configuração do TypeScript inclua os tipos gerados automaticamente:
|
|
419
504
|
|
|
420
505
|
```json5 fileName="tsconfig.json"
|
|
421
506
|
{
|
|
422
|
-
|
|
507
|
+
compilerOptions: {
|
|
508
|
+
// ... suas configurações existentes do TypeScript
|
|
509
|
+
},
|
|
510
|
+
include: [
|
|
511
|
+
// ... seus includes existentes
|
|
512
|
+
".intlayer/**/*.ts", // Inclua os tipos gerados automaticamente
|
|
513
|
+
],
|
|
423
514
|
}
|
|
424
515
|
```
|
|
425
516
|
|
|
426
|
-
|
|
517
|
+
### Configuração do Git
|
|
427
518
|
|
|
428
|
-
|
|
519
|
+
É recomendado ignorar os arquivos gerados pelo Intlayer. Isso permite que você evite comitar esses arquivos no seu repositório Git.
|
|
429
520
|
|
|
430
|
-
|
|
521
|
+
Para isso, você pode adicionar as seguintes instruções no seu arquivo `.gitignore`:
|
|
431
522
|
|
|
432
|
-
```gitignore
|
|
523
|
+
```plaintext fileName=".gitignore"
|
|
524
|
+
# Ignorar os arquivos gerados pelo Intlayer
|
|
433
525
|
.intlayer
|
|
434
526
|
```
|
|
435
527
|
|
|
436
528
|
---
|
|
437
529
|
|
|
530
|
+
### Passo 13: Criar Redirecionamento (Opcional)
|
|
531
|
+
|
|
532
|
+
```typescript fileName="src/routes/{-$locale}/rotue.tsx" codeFormat="typescript"
|
|
533
|
+
function LayoutComponent() {
|
|
534
|
+
useI18nHTMLAttributes();
|
|
535
|
+
|
|
536
|
+
const { locale } = Route.useParams();
|
|
537
|
+
const { locale: selectedLocale } = useLocale();
|
|
538
|
+
const { defaultLocale } = configuration.internationalization;
|
|
539
|
+
const { prefixDefault } = configuration.middleware;
|
|
540
|
+
|
|
541
|
+
// Redireciona para o locale padrão se nenhum locale estiver presente na URL quando prefixDefault for verdadeiro
|
|
542
|
+
if (selectedLocale === defaultLocale && !locale && prefixDefault) {
|
|
543
|
+
return <Navigate replace to={defaultLocale} />;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Redireciona para o locale selecionado se o locale na URL não corresponder ao locale selecionado
|
|
547
|
+
if (selectedLocale !== defaultLocale && !locale) {
|
|
548
|
+
return <Navigate replace to={selectedLocale} />;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
return (
|
|
552
|
+
<IntlayerProvider locale={locale}>
|
|
553
|
+
<Outlet />
|
|
554
|
+
</IntlayerProvider>
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
## Implantação em Produção
|
|
560
|
+
|
|
561
|
+
Ao implantar sua aplicação:
|
|
562
|
+
|
|
563
|
+
1. **Compile sua aplicação:**
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
npm run build
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
2. **Compile os dicionários do Intlayer:**
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
npm run intlayer:build
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
3. **Mova `vite-intlayer` para as dependências** se estiver usando middleware em produção:
|
|
576
|
+
```bash
|
|
577
|
+
npm install vite-intlayer --save
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
Sua aplicação agora suportará:
|
|
581
|
+
|
|
582
|
+
- **Estrutura de URL**: `/en`, `/en/about`, `/tr`, `/tr/about`
|
|
583
|
+
- **Detecção automática de localidade** baseada nas preferências do navegador
|
|
584
|
+
- **Roteamento consciente da localidade** com Tanstack Start
|
|
585
|
+
- **Suporte a TypeScript** com tipos gerados automaticamente
|
|
586
|
+
- **Renderização no servidor** com tratamento adequado da localidade
|
|
587
|
+
|
|
438
588
|
## Extensão VS Code
|
|
439
589
|
|
|
440
|
-
|
|
441
|
-
|
|
590
|
+
Para melhorar sua experiência de desenvolvimento com o Intlayer, você pode instalar a extensão oficial **Intlayer VS Code Extension**.
|
|
591
|
+
|
|
592
|
+
[Instalar no VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
593
|
+
|
|
594
|
+
Esta extensão oferece:
|
|
595
|
+
|
|
596
|
+
- **Autocompletar** para chaves de tradução.
|
|
597
|
+
- **Detecção de erros em tempo real** para traduções ausentes.
|
|
598
|
+
- **Visualizações inline** do conteúdo traduzido.
|
|
599
|
+
- **Ações rápidas** para criar e atualizar traduções facilmente.
|
|
600
|
+
|
|
601
|
+
Para mais detalhes sobre como usar a extensão, consulte a [documentação da extensão Intlayer para VS Code](https://intlayer.org/doc/vs-code-extension).
|
|
442
602
|
|
|
443
603
|
---
|
|
444
604
|
|
|
445
605
|
## Ir Além
|
|
446
606
|
|
|
447
|
-
|
|
448
|
-
- Modo CMS
|
|
449
|
-
- Detecção de localidade na edge / adaptadores
|
|
607
|
+
Para ir mais longe, você pode implementar o [editor visual](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_visual_editor.md) ou externalizar seu conteúdo usando o [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_CMS.md).
|
|
450
608
|
|
|
451
609
|
---
|
|
452
610
|
|
|
611
|
+
## Referências da Documentação
|
|
612
|
+
|
|
613
|
+
- [Documentação do Intlayer](https://intlayer.org)
|
|
614
|
+
- [Documentação do Tanstack Start](https://reactrouter.com/)
|
|
615
|
+
- [Hook useIntlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/packages/react-intlayer/useIntlayer.md)
|
|
616
|
+
- [Hook useLocale](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/packages/react-intlayer/useLocale.md)
|
|
617
|
+
- [Declaração de Conteúdo](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/dictionary/get_started.md)
|
|
618
|
+
- [Configuração](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/configuration.md)
|
|
619
|
+
|
|
620
|
+
Este guia abrangente fornece tudo o que você precisa para integrar o Intlayer com o Tanstack Start para uma aplicação totalmente internacionalizada com roteamento sensível ao idioma e suporte a TypeScript.
|
|
621
|
+
|
|
453
622
|
## Histórico da Documentação
|
|
454
623
|
|
|
455
|
-
| Versão | Data | Alterações
|
|
456
|
-
| ------ | ---------- |
|
|
457
|
-
|
|
|
624
|
+
| Versão | Data | Alterações |
|
|
625
|
+
| ------ | ---------- | ------------------------------ |
|
|
626
|
+
| 5.8.1 | 2025-09-09 | Adicionado para Tanstack Start |
|