@intlayer/docs 5.5.8
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/LICENSE +202 -0
- package/ar/CI_CD.md +149 -0
- package/ar/autoFill.md +157 -0
- package/ar/concept/content/file.md +1 -0
- package/ar/configuration.md +492 -0
- package/ar/dictionary/condition.md +213 -0
- package/ar/dictionary/content_extention_customization.md +81 -0
- package/ar/dictionary/enumeration.md +221 -0
- package/ar/dictionary/file.md +209 -0
- package/ar/dictionary/function_fetching.md +190 -0
- package/ar/dictionary/get_started.md +490 -0
- package/ar/dictionary/insertion.md +161 -0
- package/ar/dictionary/markdown.md +343 -0
- package/ar/dictionary/nesting.md +249 -0
- package/ar/dictionary/translation.md +307 -0
- package/ar/header.md +7 -0
- package/ar/how_works_intlayer.md +219 -0
- package/ar/index.md +125 -0
- package/ar/interest_of_intlayer.md +132 -0
- package/ar/intlayer_CMS.md +328 -0
- package/ar/intlayer_cli.md +258 -0
- package/ar/intlayer_visual_editor.md +210 -0
- package/ar/intlayer_with_angular.md +3 -0
- package/ar/intlayer_with_create_react_app.md +1196 -0
- package/ar/intlayer_with_express.md +270 -0
- package/ar/intlayer_with_lynx+react.md +482 -0
- package/ar/intlayer_with_nextjs_14.md +1260 -0
- package/ar/intlayer_with_nextjs_15.md +1311 -0
- package/ar/intlayer_with_nextjs_page_router.md +1099 -0
- package/ar/intlayer_with_react_native+expo.md +539 -0
- package/ar/intlayer_with_vite+preact.md +1679 -0
- package/ar/intlayer_with_vite+react.md +1582 -0
- package/ar/intlayer_with_vite+solid.md +3 -0
- package/ar/intlayer_with_vite+svelte.md +3 -0
- package/ar/intlayer_with_vite+vue.md +989 -0
- package/ar/introduction.md +190 -0
- package/ar/mcp_server.md +150 -0
- package/ar/packages/@intlayer/api/index.md +31 -0
- package/ar/packages/@intlayer/chokidar/index.md +31 -0
- package/ar/packages/@intlayer/cli/index.md +1 -0
- package/ar/packages/@intlayer/config/index.md +116 -0
- package/ar/packages/@intlayer/core/index.md +25 -0
- package/ar/packages/@intlayer/design-system/index.md +21 -0
- package/ar/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/ar/packages/@intlayer/editor/index.md +21 -0
- package/ar/packages/@intlayer/editor-react/index.md +21 -0
- package/ar/packages/@intlayer/webpack/index.md +35 -0
- package/ar/packages/angular-intlayer/index.md +3 -0
- package/ar/packages/express-intlayer/index.md +232 -0
- package/ar/packages/express-intlayer/t.md +448 -0
- package/ar/packages/intlayer/getConfiguration.md +120 -0
- package/ar/packages/intlayer/getEnumeration.md +138 -0
- package/ar/packages/intlayer/getHTMLTextDir.md +97 -0
- package/ar/packages/intlayer/getLocaleLang.md +61 -0
- package/ar/packages/intlayer/getLocaleName.md +93 -0
- package/ar/packages/intlayer/getLocalizedUrl.md +221 -0
- package/ar/packages/intlayer/getMultilingualUrls.md +198 -0
- package/ar/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/ar/packages/intlayer/getTranslation.md +175 -0
- package/ar/packages/intlayer/getTranslationContent.md +175 -0
- package/ar/packages/intlayer/index.md +254 -0
- package/ar/packages/intlayer-cli/index.md +41 -0
- package/ar/packages/intlayer-editor/index.md +113 -0
- package/ar/packages/lynx-intlayer/index.md +58 -0
- package/ar/packages/next-intlayer/index.md +267 -0
- package/ar/packages/next-intlayer/t.md +341 -0
- package/ar/packages/next-intlayer/useDictionary.md +248 -0
- package/ar/packages/next-intlayer/useIntlayer.md +237 -0
- package/ar/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/ar/packages/next-intlayer/useLocale.md +105 -0
- package/ar/packages/preact-intlayer/index.md +3 -0
- package/ar/packages/react-intlayer/index.md +261 -0
- package/ar/packages/react-intlayer/t.md +283 -0
- package/ar/packages/react-intlayer/useDictionary.md +268 -0
- package/ar/packages/react-intlayer/useIntlayer.md +225 -0
- package/ar/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/ar/packages/react-intlayer/useLocale.md +184 -0
- package/ar/packages/react-native-intlayer/index.md +57 -0
- package/ar/packages/react-scripts-intlayer/index.md +57 -0
- package/ar/packages/solid-intlayer/index.md +3 -0
- package/ar/packages/svelte-intlayer/index.md +3 -0
- package/ar/packages/vite-intlayer/index.md +53 -0
- package/ar/packages/vue-intlayer/index.md +3 -0
- package/ar/per_locale_file.md +298 -0
- package/ar/privacy_notice.md +61 -0
- package/ar/roadmap.md +208 -0
- package/ar/terms_of_service.md +33 -0
- package/ar/vs_code_extension.md +139 -0
- package/de/CI_CD.md +149 -0
- package/de/angular-intlayer/index.md +3 -0
- package/de/autoFill.md +157 -0
- package/de/configuration.md +501 -0
- package/de/dictionary/condition.md +213 -0
- package/de/dictionary/content_extention_customization.md +81 -0
- package/de/dictionary/enumeration.md +221 -0
- package/de/dictionary/file.md +207 -0
- package/de/dictionary/function_fetching.md +190 -0
- package/de/dictionary/get_started.md +466 -0
- package/de/dictionary/insertion.md +167 -0
- package/de/dictionary/markdown.md +345 -0
- package/de/dictionary/nesting.md +252 -0
- package/de/dictionary/translation.md +287 -0
- package/de/header.md +5 -0
- package/de/how_works_intlayer.md +216 -0
- package/de/index.md +125 -0
- package/de/insertion.md +0 -0
- package/de/interest_of_intlayer.md +132 -0
- package/de/intlayer_CMS.md +334 -0
- package/de/intlayer_cli.md +274 -0
- package/de/intlayer_visual_editor.md +210 -0
- package/de/intlayer_with_angular.md +3 -0
- package/de/intlayer_with_create_react_app.md +1200 -0
- package/de/intlayer_with_express.md +268 -0
- package/de/intlayer_with_lynx+react.md +482 -0
- package/de/intlayer_with_nextjs_14.md +1258 -0
- package/de/intlayer_with_nextjs_15.md +1306 -0
- package/de/intlayer_with_nextjs_page_router.md +1087 -0
- package/de/intlayer_with_react_native+expo.md +539 -0
- package/de/intlayer_with_vite+preact.md +1701 -0
- package/de/intlayer_with_vite+react.md +1584 -0
- package/de/intlayer_with_vite+solid.md +3 -0
- package/de/intlayer_with_vite+svelte.md +3 -0
- package/de/intlayer_with_vite+vue.md +989 -0
- package/de/introduction.md +186 -0
- package/de/mcp_server.md +150 -0
- package/de/packages/@intlayer/api/index.md +31 -0
- package/de/packages/@intlayer/chokidar/index.md +31 -0
- package/de/packages/@intlayer/cli/index.md +21 -0
- package/de/packages/@intlayer/config/index.md +116 -0
- package/de/packages/@intlayer/core/index.md +25 -0
- package/de/packages/@intlayer/design-system/index.md +21 -0
- package/de/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/de/packages/@intlayer/editor/index.md +21 -0
- package/de/packages/@intlayer/editor-react/index.md +21 -0
- package/de/packages/@intlayer/webpack/index.md +35 -0
- package/de/packages/angular-intlayer/index.md +31 -0
- package/de/packages/express-intlayer/index.md +229 -0
- package/de/packages/express-intlayer/t.md +432 -0
- package/de/packages/intlayer/getConfiguration.md +120 -0
- package/de/packages/intlayer/getEnumeration.md +140 -0
- package/de/packages/intlayer/getHTMLTextDir.md +97 -0
- package/de/packages/intlayer/getLocaleLang.md +57 -0
- package/de/packages/intlayer/getLocaleName.md +93 -0
- package/de/packages/intlayer/getLocalizedUrl.md +221 -0
- package/de/packages/intlayer/getMultilingualUrls.md +198 -0
- package/de/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/de/packages/intlayer/getTranslation.md +166 -0
- package/de/packages/intlayer/getTranslationContent.md +166 -0
- package/de/packages/intlayer/index.md +478 -0
- package/de/packages/intlayer-cli/index.md +41 -0
- package/de/packages/intlayer-editor/index.md +113 -0
- package/de/packages/lynx-intlayer/index.md +58 -0
- package/de/packages/next-intlayer/index.md +263 -0
- package/de/packages/next-intlayer/t.md +325 -0
- package/de/packages/next-intlayer/useDictionary.md +242 -0
- package/de/packages/next-intlayer/useIntlayer.md +237 -0
- package/de/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/de/packages/next-intlayer/useLocale.md +105 -0
- package/de/packages/preact-intlayer/index.md +3 -0
- package/de/packages/react-intlayer/index.md +260 -0
- package/de/packages/react-intlayer/t.md +277 -0
- package/de/packages/react-intlayer/useDictionary.md +260 -0
- package/de/packages/react-intlayer/useIntlayer.md +225 -0
- package/de/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/de/packages/react-intlayer/useLocale.md +184 -0
- package/de/packages/react-native-intlayer/index.md +57 -0
- package/de/packages/react-scripts-intlayer/index.md +57 -0
- package/de/packages/solid-intlayer/index.md +3 -0
- package/de/packages/svelte-intlayer/index.md +3 -0
- package/de/packages/vite-intlayer/index.md +53 -0
- package/de/packages/vue-intlayer/index.md +3 -0
- package/de/per_locale_file.md +298 -0
- package/de/privacy_notice.md +61 -0
- package/de/roadmap.md +206 -0
- package/de/terms_of_service.md +33 -0
- package/de/vs_code_extension.md +139 -0
- package/en/CI_CD.md +149 -0
- package/en/autoFill.md +157 -0
- package/en/configuration.md +506 -0
- package/en/dictionary/condition.md +213 -0
- package/en/dictionary/content_extention_customization.md +81 -0
- package/en/dictionary/enumeration.md +221 -0
- package/en/dictionary/file.md +198 -0
- package/en/dictionary/function_fetching.md +190 -0
- package/en/dictionary/get_started.md +504 -0
- package/en/dictionary/insertion.md +167 -0
- package/en/dictionary/markdown.md +355 -0
- package/en/dictionary/nesting.md +249 -0
- package/en/dictionary/translation.md +285 -0
- package/en/frequent_questions/build_dictionaries.md +37 -0
- package/en/frequent_questions/domain_routing.md +92 -0
- package/en/frequent_questions/esbuild_error.md +9 -0
- package/en/frequent_questions/get_locale_cookie.md +121 -0
- package/en/frequent_questions/intlayer_command_undefined.md +135 -0
- package/en/frequent_questions/locale_incorect_in_url.md +52 -0
- package/en/frequent_questions/static_rendering.md +24 -0
- package/en/frequent_questions/unknown_command.md +76 -0
- package/en/header.md +5 -0
- package/en/how_works_intlayer.md +219 -0
- package/en/index.md +139 -0
- package/en/interest_of_intlayer.md +133 -0
- package/en/intlayer_CMS.md +334 -0
- package/en/intlayer_cli.md +309 -0
- package/en/intlayer_visual_editor.md +244 -0
- package/en/intlayer_with_angular.md +139 -0
- package/en/intlayer_with_create_react_app.md +1209 -0
- package/en/intlayer_with_express.md +391 -0
- package/en/intlayer_with_lynx+react.md +483 -0
- package/en/intlayer_with_nextjs_14.md +1298 -0
- package/en/intlayer_with_nextjs_15.md +1347 -0
- package/en/intlayer_with_nextjs_page_router.md +1126 -0
- package/en/intlayer_with_react_native+expo.md +630 -0
- package/en/intlayer_with_vite+preact.md +1659 -0
- package/en/intlayer_with_vite+react.md +1605 -0
- package/en/intlayer_with_vite+solid.md +254 -0
- package/en/intlayer_with_vite+svelte.md +254 -0
- package/en/intlayer_with_vite+vue.md +1000 -0
- package/en/introduction.md +185 -0
- package/en/mcp_server.md +150 -0
- package/en/packages/@intlayer/api/index.md +31 -0
- package/en/packages/@intlayer/chokidar/index.md +31 -0
- package/en/packages/@intlayer/cli/index.md +21 -0
- package/en/packages/@intlayer/config/index.md +116 -0
- package/en/packages/@intlayer/core/index.md +25 -0
- package/en/packages/@intlayer/design-system/index.md +21 -0
- package/en/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/en/packages/@intlayer/editor/index.md +21 -0
- package/en/packages/@intlayer/editor-react/index.md +21 -0
- package/en/packages/@intlayer/webpack/index.md +35 -0
- package/en/packages/angular-intlayer/index.md +31 -0
- package/en/packages/express-intlayer/index.md +229 -0
- package/en/packages/express-intlayer/t.md +432 -0
- package/en/packages/intlayer/getConfiguration.md +120 -0
- package/en/packages/intlayer/getEnumeration.md +138 -0
- package/en/packages/intlayer/getHTMLTextDir.md +97 -0
- package/en/packages/intlayer/getLocaleLang.md +57 -0
- package/en/packages/intlayer/getLocaleName.md +93 -0
- package/en/packages/intlayer/getLocalizedUrl.md +221 -0
- package/en/packages/intlayer/getMultilingualUrls.md +198 -0
- package/en/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/en/packages/intlayer/getTranslation.md +166 -0
- package/en/packages/intlayer/getTranslationContent.md +166 -0
- package/en/packages/intlayer/index.md +476 -0
- package/en/packages/intlayer-cli/index.md +41 -0
- package/en/packages/intlayer-editor/index.md +113 -0
- package/en/packages/lynx-intlayer/index.md +60 -0
- package/en/packages/next-intlayer/index.md +263 -0
- package/en/packages/next-intlayer/t.md +326 -0
- package/en/packages/next-intlayer/useDictionary.md +242 -0
- package/en/packages/next-intlayer/useIntlayer.md +237 -0
- package/en/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/en/packages/next-intlayer/useLocale.md +105 -0
- package/en/packages/preact-intlayer/index.md +31 -0
- package/en/packages/react-intlayer/index.md +257 -0
- package/en/packages/react-intlayer/t.md +277 -0
- package/en/packages/react-intlayer/useDictionary.md +260 -0
- package/en/packages/react-intlayer/useIntlayer.md +225 -0
- package/en/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/en/packages/react-intlayer/useLocale.md +184 -0
- package/en/packages/react-native-intlayer/index.md +59 -0
- package/en/packages/react-scripts-intlayer/index.md +57 -0
- package/en/packages/solid-intlayer/index.md +31 -0
- package/en/packages/svelte-intlayer/index.md +31 -0
- package/en/packages/vite-intlayer/index.md +53 -0
- package/en/packages/vue-intlayer/index.md +31 -0
- package/en/per_locale_file.md +297 -0
- package/en/privacy_notice.md +61 -0
- package/en/roadmap.md +270 -0
- package/en/t.md +163 -0
- package/en/terms_of_service.md +33 -0
- package/en/vs_code_extension.md +129 -0
- package/en-GB/CI_CD.md +149 -0
- package/en-GB/autoFill.md +0 -0
- package/en-GB/configuration.md +490 -0
- package/en-GB/dictionary/condition.md +213 -0
- package/en-GB/dictionary/content_extention_customization.md +83 -0
- package/en-GB/dictionary/enumeration.md +221 -0
- package/en-GB/dictionary/file.md +201 -0
- package/en-GB/dictionary/function_fetching.md +190 -0
- package/en-GB/dictionary/get_started.md +466 -0
- package/en-GB/dictionary/insertion.md +167 -0
- package/en-GB/dictionary/markdown.md +343 -0
- package/en-GB/dictionary/nesting.md +249 -0
- package/en-GB/dictionary/translation.md +285 -0
- package/en-GB/header.md +1 -0
- package/en-GB/how_works_intlayer.md +217 -0
- package/en-GB/index.md +142 -0
- package/en-GB/interest_of_intlayer.md +123 -0
- package/en-GB/intlayer_CMS.md +334 -0
- package/en-GB/intlayer_cli.md +239 -0
- package/en-GB/intlayer_visual_editor.md +210 -0
- package/en-GB/intlayer_with_angular.md +3 -0
- package/en-GB/intlayer_with_create_react_app.md +1192 -0
- package/en-GB/intlayer_with_express.md +267 -0
- package/en-GB/intlayer_with_lynx+react.md +484 -0
- package/en-GB/intlayer_with_nextjs_14.md +1267 -0
- package/en-GB/intlayer_with_nextjs_15.md +1308 -0
- package/en-GB/intlayer_with_nextjs_page_router.md +1087 -0
- package/en-GB/intlayer_with_react_native+expo.md +539 -0
- package/en-GB/intlayer_with_vite+preact.md +1648 -0
- package/en-GB/intlayer_with_vite+react.md +1430 -0
- package/en-GB/intlayer_with_vite+solid.md +3 -0
- package/en-GB/intlayer_with_vite+svelte.md +3 -0
- package/en-GB/intlayer_with_vite+vue.md +993 -0
- package/en-GB/introduction.md +201 -0
- package/en-GB/mcp_server.md +150 -0
- package/en-GB/packages/@intlayer/api/index.md +31 -0
- package/en-GB/packages/@intlayer/chokidar/index.md +31 -0
- package/en-GB/packages/@intlayer/cli/index.md +21 -0
- package/en-GB/packages/@intlayer/config/index.md +116 -0
- package/en-GB/packages/@intlayer/core/index.md +25 -0
- package/en-GB/packages/@intlayer/design-system/index.md +21 -0
- package/en-GB/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/en-GB/packages/@intlayer/editor/index.md +21 -0
- package/en-GB/packages/@intlayer/editor-react/index.md +21 -0
- package/en-GB/packages/@intlayer/webpack/index.md +35 -0
- package/en-GB/packages/angular-intlayer/index.md +3 -0
- package/en-GB/packages/express-intlayer/index.md +229 -0
- package/en-GB/packages/express-intlayer/t.md +432 -0
- package/en-GB/packages/intlayer/getConfiguration.md +120 -0
- package/en-GB/packages/intlayer/getEnumeration.md +140 -0
- package/en-GB/packages/intlayer/getHTMLTextDir.md +97 -0
- package/en-GB/packages/intlayer/getLocaleLang.md +57 -0
- package/en-GB/packages/intlayer/getLocaleName.md +93 -0
- package/en-GB/packages/intlayer/getLocalizedUrl.md +221 -0
- package/en-GB/packages/intlayer/getMultilingualUrls.md +198 -0
- package/en-GB/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/en-GB/packages/intlayer/getTranslation.md +166 -0
- package/en-GB/packages/intlayer/getTranslationContent.md +166 -0
- package/en-GB/packages/intlayer/index.md +476 -0
- package/en-GB/packages/intlayer-cli/index.md +41 -0
- package/en-GB/packages/intlayer-editor/index.md +113 -0
- package/en-GB/packages/lynx-intlayer/index.md +58 -0
- package/en-GB/packages/next-intlayer/index.md +263 -0
- package/en-GB/packages/next-intlayer/t.md +326 -0
- package/en-GB/packages/next-intlayer/useDictionary.md +242 -0
- package/en-GB/packages/next-intlayer/useIntlayer.md +237 -0
- package/en-GB/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/en-GB/packages/next-intlayer/useLocale.md +105 -0
- package/en-GB/packages/preact-intlayer/index.md +3 -0
- package/en-GB/packages/react-intlayer/index.md +257 -0
- package/en-GB/packages/react-intlayer/t.md +277 -0
- package/en-GB/packages/react-intlayer/useDictionary.md +260 -0
- package/en-GB/packages/react-intlayer/useIntlayer.md +225 -0
- package/en-GB/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/en-GB/packages/react-intlayer/useLocale.md +184 -0
- package/en-GB/packages/react-native-intlayer/index.md +57 -0
- package/en-GB/packages/react-scripts-intlayer/index.md +57 -0
- package/en-GB/packages/solid-intlayer/index.md +3 -0
- package/en-GB/packages/svelte-intlayer/index.md +3 -0
- package/en-GB/packages/vite-intlayer/index.md +53 -0
- package/en-GB/packages/vue-intlayer/index.md +3 -0
- package/en-GB/per_locale_file.md +298 -0
- package/en-GB/privacy_notice.md +57 -0
- package/en-GB/roadmap.md +206 -0
- package/en-GB/terms_of_service.md +33 -0
- package/en-GB/vs_code_extension.md +139 -0
- package/es/CI_CD.md +149 -0
- package/es/autoFill.md +157 -0
- package/es/configuration.md +503 -0
- package/es/dictionary/condition.md +213 -0
- package/es/dictionary/content_extention_customization.md +81 -0
- package/es/dictionary/enumeration.md +221 -0
- package/es/dictionary/file.md +206 -0
- package/es/dictionary/function_fetching.md +190 -0
- package/es/dictionary/get_started.md +466 -0
- package/es/dictionary/insertion.md +161 -0
- package/es/dictionary/markdown.md +338 -0
- package/es/dictionary/nesting.md +249 -0
- package/es/dictionary/translation.md +287 -0
- package/es/header.md +5 -0
- package/es/how_works_intlayer.md +217 -0
- package/es/index.md +122 -0
- package/es/interest_of_intlayer.md +132 -0
- package/es/intlayer_CMS.md +334 -0
- package/es/intlayer_cli.md +274 -0
- package/es/intlayer_visual_editor.md +210 -0
- package/es/intlayer_with_angular.md +3 -0
- package/es/intlayer_with_create_react_app.md +1192 -0
- package/es/intlayer_with_express.md +276 -0
- package/es/intlayer_with_lynx+react.md +475 -0
- package/es/intlayer_with_nextjs_14.md +1258 -0
- package/es/intlayer_with_nextjs_15.md +1308 -0
- package/es/intlayer_with_nextjs_page_router.md +1088 -0
- package/es/intlayer_with_react_native+expo.md +180 -0
- package/es/intlayer_with_vite+preact.md +1637 -0
- package/es/intlayer_with_vite+react.md +1592 -0
- package/es/intlayer_with_vite+solid.md +3 -0
- package/es/intlayer_with_vite+svelte.md +3 -0
- package/es/intlayer_with_vite+vue.md +947 -0
- package/es/introduction.md +184 -0
- package/es/mcp_server.md +150 -0
- package/es/packages/@intlayer/api/index.md +31 -0
- package/es/packages/@intlayer/chokidar/index.md +31 -0
- package/es/packages/@intlayer/cli/index.md +21 -0
- package/es/packages/@intlayer/config/index.md +116 -0
- package/es/packages/@intlayer/core/index.md +25 -0
- package/es/packages/@intlayer/design-system/index.md +21 -0
- package/es/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/es/packages/@intlayer/editor/index.md +21 -0
- package/es/packages/@intlayer/editor-react/index.md +21 -0
- package/es/packages/@intlayer/webpack/index.md +35 -0
- package/es/packages/angular-intlayer/index.md +3 -0
- package/es/packages/express-intlayer/index.md +229 -0
- package/es/packages/express-intlayer/t.md +432 -0
- package/es/packages/intlayer/getConfiguration.md +120 -0
- package/es/packages/intlayer/getEnumeration.md +138 -0
- package/es/packages/intlayer/getHTMLTextDir.md +97 -0
- package/es/packages/intlayer/getLocaleLang.md +57 -0
- package/es/packages/intlayer/getLocaleName.md +93 -0
- package/es/packages/intlayer/getLocalizedUrl.md +221 -0
- package/es/packages/intlayer/getMultilingualUrls.md +198 -0
- package/es/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/es/packages/intlayer/getTranslation.md +166 -0
- package/es/packages/intlayer/getTranslationContent.md +166 -0
- package/es/packages/intlayer/index.md +478 -0
- package/es/packages/intlayer-cli/index.md +41 -0
- package/es/packages/intlayer-editor/index.md +115 -0
- package/es/packages/lynx-intlayer/index.md +58 -0
- package/es/packages/next-intlayer/index.md +263 -0
- package/es/packages/next-intlayer/t.md +325 -0
- package/es/packages/next-intlayer/useDictionary.md +242 -0
- package/es/packages/next-intlayer/useIntlayer.md +237 -0
- package/es/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/es/packages/next-intlayer/useLocale.md +105 -0
- package/es/packages/preact-intlayer/index.md +3 -0
- package/es/packages/react-intlayer/index.md +263 -0
- package/es/packages/react-intlayer/t.md +277 -0
- package/es/packages/react-intlayer/useDictionary.md +270 -0
- package/es/packages/react-intlayer/useIntlayer.md +225 -0
- package/es/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/es/packages/react-intlayer/useLocale.md +184 -0
- package/es/packages/react-native-intlayer/index.md +57 -0
- package/es/packages/react-scripts-intlayer/index.md +57 -0
- package/es/packages/solid-intlayer/index.md +3 -0
- package/es/packages/svelte-intlayer/index.md +5 -0
- package/es/packages/vite-intlayer/index.md +53 -0
- package/es/packages/vue-intlayer/index.md +3 -0
- package/es/per_locale_file.md +293 -0
- package/es/privacy_notice.md +61 -0
- package/es/roadmap.md +157 -0
- package/es/terms_of_service.md +33 -0
- package/es/vs_code_extension.md +139 -0
- package/fr/CI_CD.md +149 -0
- package/fr/autoFill.md +157 -0
- package/fr/configuration.md +481 -0
- package/fr/dictionary/condition.md +213 -0
- package/fr/dictionary/content_extention_customization.md +81 -0
- package/fr/dictionary/enumeration.md +221 -0
- package/fr/dictionary/file.md +206 -0
- package/fr/dictionary/function_fetching.md +190 -0
- package/fr/dictionary/get_started.md +466 -0
- package/fr/dictionary/insertion.md +161 -0
- package/fr/dictionary/markdown.md +335 -0
- package/fr/dictionary/nesting.md +249 -0
- package/fr/dictionary/translation.md +287 -0
- package/fr/header.md +5 -0
- package/fr/how_works_intlayer.md +217 -0
- package/fr/index.md +122 -0
- package/fr/interest_of_intlayer.md +132 -0
- package/fr/intlayer_CMS.md +334 -0
- package/fr/intlayer_cli.md +274 -0
- package/fr/intlayer_visual_editor.md +210 -0
- package/fr/intlayer_with_angular.md +3 -0
- package/fr/intlayer_with_create_react_app.md +1192 -0
- package/fr/intlayer_with_express.md +270 -0
- package/fr/intlayer_with_lynx+react.md +466 -0
- package/fr/intlayer_with_nextjs_14.md +1258 -0
- package/fr/intlayer_with_nextjs_15.md +1308 -0
- package/fr/intlayer_with_nextjs_page_router.md +1085 -0
- package/fr/intlayer_with_react_native+expo.md +535 -0
- package/fr/intlayer_with_vite+preact.md +1621 -0
- package/fr/intlayer_with_vite+react.md +1589 -0
- package/fr/intlayer_with_vite+solid.md +3 -0
- package/fr/intlayer_with_vite+svelte.md +3 -0
- package/fr/intlayer_with_vite+vue.md +947 -0
- package/fr/introduction.md +190 -0
- package/fr/mcp_server.md +152 -0
- package/fr/packages/@intlayer/api/index.md +31 -0
- package/fr/packages/@intlayer/chokidar/index.md +31 -0
- package/fr/packages/@intlayer/cli/index.md +21 -0
- package/fr/packages/@intlayer/config/index.md +116 -0
- package/fr/packages/@intlayer/core/index.md +25 -0
- package/fr/packages/@intlayer/design-system/index.md +21 -0
- package/fr/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/fr/packages/@intlayer/editor/index.md +21 -0
- package/fr/packages/@intlayer/editor-react/index.md +21 -0
- package/fr/packages/@intlayer/webpack/index.md +35 -0
- package/fr/packages/angular-intlayer/index.md +3 -0
- package/fr/packages/express-intlayer/index.md +238 -0
- package/fr/packages/express-intlayer/t.md +432 -0
- package/fr/packages/intlayer/getConfiguration.md +120 -0
- package/fr/packages/intlayer/getEnumeration.md +138 -0
- package/fr/packages/intlayer/getHTMLTextDir.md +97 -0
- package/fr/packages/intlayer/getLocaleLang.md +57 -0
- package/fr/packages/intlayer/getLocaleName.md +93 -0
- package/fr/packages/intlayer/getLocalizedUrl.md +221 -0
- package/fr/packages/intlayer/getMultilingualUrls.md +198 -0
- package/fr/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/fr/packages/intlayer/getTranslation.md +166 -0
- package/fr/packages/intlayer/getTranslationContent.md +166 -0
- package/fr/packages/intlayer/index.md +476 -0
- package/fr/packages/intlayer-cli/index.md +41 -0
- package/fr/packages/intlayer-editor/index.md +115 -0
- package/fr/packages/lynx-intlayer/index.md +58 -0
- package/fr/packages/next-intlayer/index.md +266 -0
- package/fr/packages/next-intlayer/t.md +325 -0
- package/fr/packages/next-intlayer/useDictionary.md +242 -0
- package/fr/packages/next-intlayer/useIntlayer.md +237 -0
- package/fr/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/fr/packages/next-intlayer/useLocale.md +105 -0
- package/fr/packages/preact-intlayer/index.md +3 -0
- package/fr/packages/react-intlayer/index.md +257 -0
- package/fr/packages/react-intlayer/t.md +277 -0
- package/fr/packages/react-intlayer/useDictionary.md +269 -0
- package/fr/packages/react-intlayer/useIntlayer.md +234 -0
- package/fr/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/fr/packages/react-intlayer/useLocale.md +184 -0
- package/fr/packages/react-native-intlayer/index.md +57 -0
- package/fr/packages/react-scripts-intlayer/index.md +57 -0
- package/fr/packages/solid-intlayer/index.md +3 -0
- package/fr/packages/svelte-intlayer/index.md +3 -0
- package/fr/packages/vite-intlayer/index.md +53 -0
- package/fr/packages/vue-intlayer/index.md +3 -0
- package/fr/per_locale_file.md +297 -0
- package/fr/privacy_notice.md +57 -0
- package/fr/roadmap.md +206 -0
- package/fr/terms_of_service.md +33 -0
- package/fr/vs_code_extension.md +139 -0
- package/hi/CI_CD.md +149 -0
- package/hi/autoFill.md +157 -0
- package/hi/configuration.md +509 -0
- package/hi/dictionary/condition.md +213 -0
- package/hi/dictionary/content_extention_customization.md +81 -0
- package/hi/dictionary/enumeration.md +221 -0
- package/hi/dictionary/file.md +209 -0
- package/hi/dictionary/function_fetching.md +188 -0
- package/hi/dictionary/get_started.md +490 -0
- package/hi/dictionary/insertion.md +167 -0
- package/hi/dictionary/markdown.md +344 -0
- package/hi/dictionary/nesting.md +249 -0
- package/hi/dictionary/translation.md +307 -0
- package/hi/header.md +7 -0
- package/hi/how_works_intlayer.md +217 -0
- package/hi/index.md +125 -0
- package/hi/interest_of_intlayer.md +132 -0
- package/hi/intlayer_CMS.md +334 -0
- package/hi/intlayer_cli.md +274 -0
- package/hi/intlayer_visual_editor.md +210 -0
- package/hi/intlayer_with_angular.md +3 -0
- package/hi/intlayer_with_create_react_app.md +1395 -0
- package/hi/intlayer_with_express.md +273 -0
- package/hi/intlayer_with_lynx+react.md +456 -0
- package/hi/intlayer_with_nextjs_14.md +1283 -0
- package/hi/intlayer_with_nextjs_15.md +1319 -0
- package/hi/intlayer_with_nextjs_page_router.md +1097 -0
- package/hi/intlayer_with_react_native+expo.md +554 -0
- package/hi/intlayer_with_vite+preact.md +1538 -0
- package/hi/intlayer_with_vite+react.md +1540 -0
- package/hi/intlayer_with_vite+solid.md +3 -0
- package/hi/intlayer_with_vite+svelte.md +3 -0
- package/hi/intlayer_with_vite+vue.md +840 -0
- package/hi/introduction.md +190 -0
- package/hi/mcp_server.md +150 -0
- package/hi/packages/@intlayer/api/index.md +31 -0
- package/hi/packages/@intlayer/chokidar/index.md +31 -0
- package/hi/packages/@intlayer/cli/index.md +21 -0
- package/hi/packages/@intlayer/config/index.md +116 -0
- package/hi/packages/@intlayer/core/index.md +25 -0
- package/hi/packages/@intlayer/design-system/index.md +21 -0
- package/hi/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/hi/packages/@intlayer/editor/index.md +21 -0
- package/hi/packages/@intlayer/editor-react/index.md +21 -0
- package/hi/packages/@intlayer/webpack/index.md +35 -0
- package/hi/packages/angular-intlayer/index.md +3 -0
- package/hi/packages/express-intlayer/index.md +232 -0
- package/hi/packages/express-intlayer/t.md +445 -0
- package/hi/packages/intlayer/getConfiguration.md +120 -0
- package/hi/packages/intlayer/getEnumeration.md +138 -0
- package/hi/packages/intlayer/getHTMLTextDir.md +97 -0
- package/hi/packages/intlayer/getLocaleLang.md +57 -0
- package/hi/packages/intlayer/getLocaleName.md +93 -0
- package/hi/packages/intlayer/getLocalizedUrl.md +221 -0
- package/hi/packages/intlayer/getMultilingualUrls.md +198 -0
- package/hi/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/hi/packages/intlayer/getTranslation.md +175 -0
- package/hi/packages/intlayer/getTranslationContent.md +175 -0
- package/hi/packages/intlayer/index.md +314 -0
- package/hi/packages/intlayer-cli/index.md +41 -0
- package/hi/packages/intlayer-editor/index.md +113 -0
- package/hi/packages/lynx-intlayer/index.md +58 -0
- package/hi/packages/next-intlayer/index.md +270 -0
- package/hi/packages/next-intlayer/t.md +337 -0
- package/hi/packages/next-intlayer/useDictionary.md +248 -0
- package/hi/packages/next-intlayer/useIntlayer.md +237 -0
- package/hi/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/hi/packages/next-intlayer/useLocale.md +105 -0
- package/hi/packages/preact-intlayer/index.md +3 -0
- package/hi/packages/react-intlayer/index.md +261 -0
- package/hi/packages/react-intlayer/t.md +283 -0
- package/hi/packages/react-intlayer/useDictionary.md +268 -0
- package/hi/packages/react-intlayer/useIntlayer.md +225 -0
- package/hi/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/hi/packages/react-intlayer/useLocale.md +184 -0
- package/hi/packages/react-native-intlayer/index.md +57 -0
- package/hi/packages/react-scripts-intlayer/index.md +57 -0
- package/hi/packages/solid-intlayer/index.md +3 -0
- package/hi/packages/svelte-intlayer/index.md +3 -0
- package/hi/packages/vite-intlayer/index.md +53 -0
- package/hi/packages/vue-intlayer/index.md +3 -0
- package/hi/per_locale_file.md +298 -0
- package/hi/privacy_notice.md +61 -0
- package/hi/roadmap.md +206 -0
- package/hi/terms_of_service.md +33 -0
- package/hi/vs_code_extension.md +139 -0
- package/index.cjs +1265 -0
- package/index.d.ts +100 -0
- package/it/CI_CD.md +149 -0
- package/it/autoFill.md +157 -0
- package/it/configuration.md +503 -0
- package/it/dictionary/condition.md +213 -0
- package/it/dictionary/content_extention_customization.md +81 -0
- package/it/dictionary/enumeration.md +221 -0
- package/it/dictionary/file.md +207 -0
- package/it/dictionary/function_fetching.md +190 -0
- package/it/dictionary/get_started.md +466 -0
- package/it/dictionary/insertion.md +161 -0
- package/it/dictionary/markdown.md +343 -0
- package/it/dictionary/nesting.md +249 -0
- package/it/dictionary/translation.md +287 -0
- package/it/header.md +7 -0
- package/it/how_works_intlayer.md +217 -0
- package/it/index.md +125 -0
- package/it/interest_of_intlayer.md +132 -0
- package/it/intlayer_CMS.md +334 -0
- package/it/intlayer_cli.md +274 -0
- package/it/intlayer_visual_editor.md +210 -0
- package/it/intlayer_with_angular.md +3 -0
- package/it/intlayer_with_create_react_app.md +413 -0
- package/it/intlayer_with_express.md +267 -0
- package/it/intlayer_with_lynx+react.md +482 -0
- package/it/intlayer_with_nextjs_14.md +1269 -0
- package/it/intlayer_with_nextjs_15.md +1319 -0
- package/it/intlayer_with_nextjs_page_router.md +1095 -0
- package/it/intlayer_with_react_native+expo.md +261 -0
- package/it/intlayer_with_vite+preact.md +1681 -0
- package/it/intlayer_with_vite+react.md +1580 -0
- package/it/intlayer_with_vite+solid.md +3 -0
- package/it/intlayer_with_vite+svelte.md +3 -0
- package/it/intlayer_with_vite+vue.md +989 -0
- package/it/introduction.md +192 -0
- package/it/mcp_server.md +152 -0
- package/it/packages/@intlayer/api/index.md +31 -0
- package/it/packages/@intlayer/chokidar/index.md +31 -0
- package/it/packages/@intlayer/cli/index.md +21 -0
- package/it/packages/@intlayer/config/index.md +116 -0
- package/it/packages/@intlayer/core/index.md +25 -0
- package/it/packages/@intlayer/design-system/index.md +21 -0
- package/it/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/it/packages/@intlayer/editor/index.md +21 -0
- package/it/packages/@intlayer/editor-react/index.md +21 -0
- package/it/packages/@intlayer/webpack/index.md +35 -0
- package/it/packages/angular-intlayer/index.md +3 -0
- package/it/packages/express-intlayer/index.md +229 -0
- package/it/packages/express-intlayer/t.md +432 -0
- package/it/packages/intlayer/getConfiguration.md +120 -0
- package/it/packages/intlayer/getEnumeration.md +138 -0
- package/it/packages/intlayer/getHTMLTextDir.md +97 -0
- package/it/packages/intlayer/getLocaleLang.md +57 -0
- package/it/packages/intlayer/getLocaleName.md +93 -0
- package/it/packages/intlayer/getLocalizedUrl.md +221 -0
- package/it/packages/intlayer/getMultilingualUrls.md +200 -0
- package/it/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/it/packages/intlayer/getTranslation.md +166 -0
- package/it/packages/intlayer/getTranslationContent.md +166 -0
- package/it/packages/intlayer/index.md +479 -0
- package/it/packages/intlayer-cli/index.md +41 -0
- package/it/packages/intlayer-editor/index.md +113 -0
- package/it/packages/lynx-intlayer/index.md +58 -0
- package/it/packages/next-intlayer/index.md +267 -0
- package/it/packages/next-intlayer/t.md +326 -0
- package/it/packages/next-intlayer/useDictionary.md +242 -0
- package/it/packages/next-intlayer/useIntlayer.md +237 -0
- package/it/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/it/packages/next-intlayer/useLocale.md +105 -0
- package/it/packages/preact-intlayer/index.md +3 -0
- package/it/packages/react-intlayer/index.md +260 -0
- package/it/packages/react-intlayer/t.md +277 -0
- package/it/packages/react-intlayer/useDictionary.md +260 -0
- package/it/packages/react-intlayer/useIntlayer.md +225 -0
- package/it/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/it/packages/react-intlayer/useLocale.md +184 -0
- package/it/packages/react-native-intlayer/index.md +57 -0
- package/it/packages/react-scripts-intlayer/index.md +57 -0
- package/it/packages/solid-intlayer/index.md +5 -0
- package/it/packages/svelte-intlayer/index.md +3 -0
- package/it/packages/vite-intlayer/index.md +53 -0
- package/it/packages/vue-intlayer/index.md +5 -0
- package/it/per_locale_file.md +298 -0
- package/it/privacy_notice.md +61 -0
- package/it/roadmap.md +206 -0
- package/it/terms_of_service.md +33 -0
- package/it/vs_code_extension.md +139 -0
- package/ja/CI_CD.md +149 -0
- package/ja/autoFill.md +157 -0
- package/ja/configuration.md +507 -0
- package/ja/dictionary/condition.md +213 -0
- package/ja/dictionary/content_extention_customization.md +81 -0
- package/ja/dictionary/enumeration.md +221 -0
- package/ja/dictionary/file.md +209 -0
- package/ja/dictionary/function_fetching.md +190 -0
- package/ja/dictionary/get_started.md +466 -0
- package/ja/dictionary/insertion.md +161 -0
- package/ja/dictionary/markdown.md +343 -0
- package/ja/dictionary/nesting.md +249 -0
- package/ja/dictionary/translation.md +287 -0
- package/ja/header.md +7 -0
- package/ja/how_works_intlayer.md +217 -0
- package/ja/index.md +125 -0
- package/ja/interest_of_intlayer.md +132 -0
- package/ja/intlayer_CMS.md +334 -0
- package/ja/intlayer_cli.md +274 -0
- package/ja/intlayer_visual_editor.md +213 -0
- package/ja/intlayer_with_angular.md +3 -0
- package/ja/intlayer_with_create_react_app.md +1186 -0
- package/ja/intlayer_with_express.md +267 -0
- package/ja/intlayer_with_lynx+react.md +482 -0
- package/ja/intlayer_with_nextjs_14.md +1256 -0
- package/ja/intlayer_with_nextjs_15.md +1308 -0
- package/ja/intlayer_with_nextjs_page_router.md +1085 -0
- package/ja/intlayer_with_react_native+expo.md +537 -0
- package/ja/intlayer_with_vite+preact.md +1601 -0
- package/ja/intlayer_with_vite+react.md +1555 -0
- package/ja/intlayer_with_vite+solid.md +3 -0
- package/ja/intlayer_with_vite+svelte.md +3 -0
- package/ja/intlayer_with_vite+vue.md +990 -0
- package/ja/introduction.md +186 -0
- package/ja/mcp_server.md +150 -0
- package/ja/packages/@intlayer/api/index.md +31 -0
- package/ja/packages/@intlayer/chokidar/index.md +31 -0
- package/ja/packages/@intlayer/cli/index.md +21 -0
- package/ja/packages/@intlayer/config/index.md +116 -0
- package/ja/packages/@intlayer/core/index.md +25 -0
- package/ja/packages/@intlayer/design-system/index.md +21 -0
- package/ja/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/ja/packages/@intlayer/editor/index.md +21 -0
- package/ja/packages/@intlayer/editor-react/index.md +21 -0
- package/ja/packages/@intlayer/webpack/index.md +35 -0
- package/ja/packages/angular-intlayer/index.md +3 -0
- package/ja/packages/express-intlayer/index.md +229 -0
- package/ja/packages/express-intlayer/t.md +432 -0
- package/ja/packages/intlayer/getConfiguration.md +120 -0
- package/ja/packages/intlayer/getEnumeration.md +140 -0
- package/ja/packages/intlayer/getHTMLTextDir.md +97 -0
- package/ja/packages/intlayer/getLocaleLang.md +59 -0
- package/ja/packages/intlayer/getLocaleName.md +93 -0
- package/ja/packages/intlayer/getLocalizedUrl.md +221 -0
- package/ja/packages/intlayer/getMultilingualUrls.md +198 -0
- package/ja/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/ja/packages/intlayer/getTranslation.md +166 -0
- package/ja/packages/intlayer/getTranslationContent.md +166 -0
- package/ja/packages/intlayer/index.md +479 -0
- package/ja/packages/intlayer-cli/index.md +41 -0
- package/ja/packages/intlayer-editor/index.md +115 -0
- package/ja/packages/lynx-intlayer/index.md +58 -0
- package/ja/packages/next-intlayer/index.md +263 -0
- package/ja/packages/next-intlayer/t.md +326 -0
- package/ja/packages/next-intlayer/useDictionary.md +242 -0
- package/ja/packages/next-intlayer/useIntlayer.md +237 -0
- package/ja/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/ja/packages/next-intlayer/useLocale.md +105 -0
- package/ja/packages/preact-intlayer/index.md +3 -0
- package/ja/packages/react-intlayer/index.md +257 -0
- package/ja/packages/react-intlayer/t.md +277 -0
- package/ja/packages/react-intlayer/useDictionary.md +260 -0
- package/ja/packages/react-intlayer/useIntlayer.md +225 -0
- package/ja/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/ja/packages/react-intlayer/useLocale.md +184 -0
- package/ja/packages/react-native-intlayer/index.md +57 -0
- package/ja/packages/react-scripts-intlayer/index.md +57 -0
- package/ja/packages/solid-intlayer/index.md +3 -0
- package/ja/packages/svelte-intlayer/index.md +3 -0
- package/ja/packages/vite-intlayer/index.md +53 -0
- package/ja/packages/vue-intlayer/index.md +3 -0
- package/ja/per_locale_file.md +298 -0
- package/ja/privacy_notice.md +57 -0
- package/ja/roadmap.md +206 -0
- package/ja/terms_of_service.md +33 -0
- package/ja/vs_code_extension.md +139 -0
- package/ko/CI_CD.md +149 -0
- package/ko/autoFill.md +157 -0
- package/ko/configuration.md +507 -0
- package/ko/dictionary/condition.md +213 -0
- package/ko/dictionary/content_extention_customization.md +81 -0
- package/ko/dictionary/enumeration.md +221 -0
- package/ko/dictionary/file.md +207 -0
- package/ko/dictionary/function_fetching.md +190 -0
- package/ko/dictionary/get_started.md +466 -0
- package/ko/dictionary/insertion.md +167 -0
- package/ko/dictionary/markdown.md +343 -0
- package/ko/dictionary/nesting.md +249 -0
- package/ko/dictionary/translation.md +287 -0
- package/ko/header.md +7 -0
- package/ko/how_works_intlayer.md +216 -0
- package/ko/index.md +125 -0
- package/ko/interest_of_intlayer.md +132 -0
- package/ko/intlayer_CMS.md +334 -0
- package/ko/intlayer_cli.md +274 -0
- package/ko/intlayer_visual_editor.md +210 -0
- package/ko/intlayer_with_angular.md +3 -0
- package/ko/intlayer_with_create_react_app.md +1186 -0
- package/ko/intlayer_with_express.md +267 -0
- package/ko/intlayer_with_lynx+react.md +482 -0
- package/ko/intlayer_with_nextjs_14.md +1267 -0
- package/ko/intlayer_with_nextjs_15.md +1319 -0
- package/ko/intlayer_with_nextjs_page_router.md +1097 -0
- package/ko/intlayer_with_react_native+expo.md +537 -0
- package/ko/intlayer_with_vite+preact.md +1682 -0
- package/ko/intlayer_with_vite+react.md +1582 -0
- package/ko/intlayer_with_vite+solid.md +3 -0
- package/ko/intlayer_with_vite+svelte.md +3 -0
- package/ko/intlayer_with_vite+vue.md +988 -0
- package/ko/introduction.md +186 -0
- package/ko/mcp_server.md +150 -0
- package/ko/packages/@intlayer/api/index.md +31 -0
- package/ko/packages/@intlayer/chokidar/index.md +31 -0
- package/ko/packages/@intlayer/cli/index.md +21 -0
- package/ko/packages/@intlayer/config/index.md +116 -0
- package/ko/packages/@intlayer/core/index.md +25 -0
- package/ko/packages/@intlayer/design-system/index.md +21 -0
- package/ko/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/ko/packages/@intlayer/editor/index.md +21 -0
- package/ko/packages/@intlayer/editor-react/index.md +21 -0
- package/ko/packages/@intlayer/webpack/index.md +35 -0
- package/ko/packages/angular-intlayer/index.md +5 -0
- package/ko/packages/express-intlayer/index.md +229 -0
- package/ko/packages/express-intlayer/t.md +432 -0
- package/ko/packages/intlayer/getConfiguration.md +120 -0
- package/ko/packages/intlayer/getEnumeration.md +138 -0
- package/ko/packages/intlayer/getHTMLTextDir.md +97 -0
- package/ko/packages/intlayer/getLocaleLang.md +57 -0
- package/ko/packages/intlayer/getLocaleName.md +93 -0
- package/ko/packages/intlayer/getLocalizedUrl.md +221 -0
- package/ko/packages/intlayer/getMultilingualUrls.md +198 -0
- package/ko/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/ko/packages/intlayer/getTranslation.md +166 -0
- package/ko/packages/intlayer/getTranslationContent.md +166 -0
- package/ko/packages/intlayer/index.md +480 -0
- package/ko/packages/intlayer-cli/index.md +41 -0
- package/ko/packages/intlayer-editor/index.md +113 -0
- package/ko/packages/lynx-intlayer/index.md +58 -0
- package/ko/packages/next-intlayer/index.md +267 -0
- package/ko/packages/next-intlayer/t.md +337 -0
- package/ko/packages/next-intlayer/useDictionary.md +242 -0
- package/ko/packages/next-intlayer/useIntlayer.md +237 -0
- package/ko/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/ko/packages/next-intlayer/useLocale.md +105 -0
- package/ko/packages/preact-intlayer/index.md +3 -0
- package/ko/packages/react-intlayer/index.md +260 -0
- package/ko/packages/react-intlayer/t.md +277 -0
- package/ko/packages/react-intlayer/useDictionary.md +268 -0
- package/ko/packages/react-intlayer/useIntlayer.md +225 -0
- package/ko/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/ko/packages/react-intlayer/useLocale.md +184 -0
- package/ko/packages/react-native-intlayer/index.md +57 -0
- package/ko/packages/react-scripts-intlayer/index.md +57 -0
- package/ko/packages/solid-intlayer/index.md +3 -0
- package/ko/packages/svelte-intlayer/index.md +3 -0
- package/ko/packages/vite-intlayer/index.md +53 -0
- package/ko/packages/vue-intlayer/index.md +3 -0
- package/ko/per_locale_file.md +300 -0
- package/ko/privacy_notice.md +61 -0
- package/ko/roadmap.md +206 -0
- package/ko/terms_of_service.md +33 -0
- package/ko/vs_code_extension.md +139 -0
- package/package.json +96 -0
- package/pt/CI_CD.md +149 -0
- package/pt/autoFill.md +157 -0
- package/pt/configuration.md +503 -0
- package/pt/dictionary/condition.md +213 -0
- package/pt/dictionary/content_extention_customization.md +81 -0
- package/pt/dictionary/enumeration.md +221 -0
- package/pt/dictionary/file.md +210 -0
- package/pt/dictionary/function_fetching.md +190 -0
- package/pt/dictionary/get_started.md +490 -0
- package/pt/dictionary/insertion.md +161 -0
- package/pt/dictionary/markdown.md +339 -0
- package/pt/dictionary/nesting.md +249 -0
- package/pt/dictionary/translation.md +322 -0
- package/pt/header.md +7 -0
- package/pt/how_works_intlayer.md +216 -0
- package/pt/index.md +125 -0
- package/pt/interest_of_intlayer.md +132 -0
- package/pt/intlayer_CMS.md +334 -0
- package/pt/intlayer_cli.md +274 -0
- package/pt/intlayer_visual_editor.md +210 -0
- package/pt/intlayer_with_angular.md +3 -0
- package/pt/intlayer_with_create_react_app.md +1204 -0
- package/pt/intlayer_with_express.md +270 -0
- package/pt/intlayer_with_lynx+react.md +467 -0
- package/pt/intlayer_with_nextjs_14.md +1269 -0
- package/pt/intlayer_with_nextjs_15.md +1319 -0
- package/pt/intlayer_with_nextjs_page_router.md +1109 -0
- package/pt/intlayer_with_react_native+expo.md +259 -0
- package/pt/intlayer_with_vite+preact.md +1663 -0
- package/pt/intlayer_with_vite+react.md +1621 -0
- package/pt/intlayer_with_vite+solid.md +3 -0
- package/pt/intlayer_with_vite+svelte.md +3 -0
- package/pt/intlayer_with_vite+vue.md +989 -0
- package/pt/introduction.md +193 -0
- package/pt/mcp_server.md +150 -0
- package/pt/packages/@intlayer/api/index.md +31 -0
- package/pt/packages/@intlayer/chokidar/index.md +31 -0
- package/pt/packages/@intlayer/cli/index.md +21 -0
- package/pt/packages/@intlayer/config/index.md +116 -0
- package/pt/packages/@intlayer/core/index.md +25 -0
- package/pt/packages/@intlayer/design-system/index.md +21 -0
- package/pt/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/pt/packages/@intlayer/editor/index.md +21 -0
- package/pt/packages/@intlayer/editor-react/index.md +21 -0
- package/pt/packages/@intlayer/webpack/index.md +35 -0
- package/pt/packages/angular-intlayer/index.md +3 -0
- package/pt/packages/express-intlayer/index.md +232 -0
- package/pt/packages/express-intlayer/t.md +267 -0
- package/pt/packages/intlayer/getConfiguration.md +120 -0
- package/pt/packages/intlayer/getEnumeration.md +138 -0
- package/pt/packages/intlayer/getHTMLTextDir.md +97 -0
- package/pt/packages/intlayer/getLocaleLang.md +57 -0
- package/pt/packages/intlayer/getLocaleName.md +93 -0
- package/pt/packages/intlayer/getLocalizedUrl.md +221 -0
- package/pt/packages/intlayer/getMultilingualUrls.md +198 -0
- package/pt/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/pt/packages/intlayer/getTranslation.md +175 -0
- package/pt/packages/intlayer/getTranslationContent.md +177 -0
- package/pt/packages/intlayer/index.md +484 -0
- package/pt/packages/intlayer-cli/index.md +41 -0
- package/pt/packages/intlayer-editor/index.md +113 -0
- package/pt/packages/lynx-intlayer/index.md +58 -0
- package/pt/packages/next-intlayer/index.md +270 -0
- package/pt/packages/next-intlayer/t.md +341 -0
- package/pt/packages/next-intlayer/useDictionary.md +248 -0
- package/pt/packages/next-intlayer/useIntlayer.md +237 -0
- package/pt/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/pt/packages/next-intlayer/useLocale.md +105 -0
- package/pt/packages/preact-intlayer/index.md +3 -0
- package/pt/packages/react-intlayer/index.md +261 -0
- package/pt/packages/react-intlayer/t.md +289 -0
- package/pt/packages/react-intlayer/useDictionary.md +268 -0
- package/pt/packages/react-intlayer/useIntlayer.md +225 -0
- package/pt/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/pt/packages/react-intlayer/useLocale.md +184 -0
- package/pt/packages/react-native-intlayer/index.md +57 -0
- package/pt/packages/react-scripts-intlayer/index.md +57 -0
- package/pt/packages/solid-intlayer/index.md +3 -0
- package/pt/packages/svelte-intlayer/index.md +3 -0
- package/pt/packages/vite-intlayer/index.md +53 -0
- package/pt/packages/vue-intlayer/index.md +3 -0
- package/pt/per_locale_file.md +298 -0
- package/pt/privacy_notice.md +61 -0
- package/pt/roadmap.md +206 -0
- package/pt/terms_of_service.md +33 -0
- package/pt/vs_code_extension.md +139 -0
- package/ru/CI_CD.md +149 -0
- package/ru/autoFill.md +157 -0
- package/ru/configuration.md +507 -0
- package/ru/dictionary/condition.md +213 -0
- package/ru/dictionary/content_extention_customization.md +81 -0
- package/ru/dictionary/enumeration.md +221 -0
- package/ru/dictionary/file.md +209 -0
- package/ru/dictionary/function_fetching.md +188 -0
- package/ru/dictionary/get_started.md +311 -0
- package/ru/dictionary/insertion.md +161 -0
- package/ru/dictionary/markdown.md +339 -0
- package/ru/dictionary/nesting.md +249 -0
- package/ru/dictionary/translation.md +322 -0
- package/ru/environment/angular.md +3 -0
- package/ru/header.md +7 -0
- package/ru/how_works_intlayer.md +217 -0
- package/ru/index.md +125 -0
- package/ru/interest_of_intlayer.md +132 -0
- package/ru/intlayer_CMS.md +334 -0
- package/ru/intlayer_cli.md +274 -0
- package/ru/intlayer_visual_editor.md +210 -0
- package/ru/intlayer_with_angular.md +3 -0
- package/ru/intlayer_with_create_react_app.md +1196 -0
- package/ru/intlayer_with_express.md +273 -0
- package/ru/intlayer_with_lynx+react.md +482 -0
- package/ru/intlayer_with_nextjs_14.md +1274 -0
- package/ru/intlayer_with_nextjs_15.md +1318 -0
- package/ru/intlayer_with_nextjs_page_router.md +1100 -0
- package/ru/intlayer_with_react_native+expo.md +537 -0
- package/ru/intlayer_with_vite+preact.md +1663 -0
- package/ru/intlayer_with_vite+react.md +1546 -0
- package/ru/intlayer_with_vite+solid.md +3 -0
- package/ru/intlayer_with_vite+svelte.md +3 -0
- package/ru/intlayer_with_vite+vue.md +987 -0
- package/ru/introduction.md +190 -0
- package/ru/mcp_server.md +152 -0
- package/ru/packages/@intlayer/api/index.md +31 -0
- package/ru/packages/@intlayer/chokidar/index.md +31 -0
- package/ru/packages/@intlayer/cli/index.md +23 -0
- package/ru/packages/@intlayer/config/index.md +116 -0
- package/ru/packages/@intlayer/core/index.md +25 -0
- package/ru/packages/@intlayer/design-system/index.md +21 -0
- package/ru/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/ru/packages/@intlayer/editor/index.md +21 -0
- package/ru/packages/@intlayer/editor-react/index.md +21 -0
- package/ru/packages/@intlayer/webpack/index.md +35 -0
- package/ru/packages/angular-intlayer/index.md +3 -0
- package/ru/packages/express-intlayer/index.md +235 -0
- package/ru/packages/express-intlayer/t.md +445 -0
- package/ru/packages/intlayer/getConfiguration.md +120 -0
- package/ru/packages/intlayer/getEnumeration.md +140 -0
- package/ru/packages/intlayer/getHTMLTextDir.md +97 -0
- package/ru/packages/intlayer/getLocaleLang.md +59 -0
- package/ru/packages/intlayer/getLocaleName.md +93 -0
- package/ru/packages/intlayer/getLocalizedUrl.md +221 -0
- package/ru/packages/intlayer/getMultilingualUrls.md +198 -0
- package/ru/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/ru/packages/intlayer/getTranslation.md +177 -0
- package/ru/packages/intlayer/getTranslationContent.md +175 -0
- package/ru/packages/intlayer/index.md +275 -0
- package/ru/packages/intlayer-cli/index.md +41 -0
- package/ru/packages/intlayer-editor/index.md +115 -0
- package/ru/packages/lynx-intlayer/index.md +58 -0
- package/ru/packages/next-intlayer/index.md +267 -0
- package/ru/packages/next-intlayer/t.md +340 -0
- package/ru/packages/next-intlayer/useDictionary.md +248 -0
- package/ru/packages/next-intlayer/useIntlayer.md +237 -0
- package/ru/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/ru/packages/next-intlayer/useLocale.md +105 -0
- package/ru/packages/preact-intlayer/index.md +3 -0
- package/ru/packages/react-intlayer/index.md +261 -0
- package/ru/packages/react-intlayer/t.md +289 -0
- package/ru/packages/react-intlayer/useDictionary.md +268 -0
- package/ru/packages/react-intlayer/useIntlayer.md +225 -0
- package/ru/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/ru/packages/react-intlayer/useLocale.md +184 -0
- package/ru/packages/react-native-intlayer/index.md +57 -0
- package/ru/packages/react-scripts-intlayer/index.md +57 -0
- package/ru/packages/solid-intlayer/index.md +3 -0
- package/ru/packages/svelte-intlayer/index.md +3 -0
- package/ru/packages/vite-intlayer/index.md +53 -0
- package/ru/packages/vue-intlayer/index.md +3 -0
- package/ru/per_locale_file.md +298 -0
- package/ru/privacy_notice.md +61 -0
- package/ru/roadmap.md +206 -0
- package/ru/terms_of_service.md +33 -0
- package/ru/vs_code_extension.md +139 -0
- package/zh/CI_CD.md +149 -0
- package/zh/autoFill.md +157 -0
- package/zh/configuration.md +484 -0
- package/zh/dictionary/condition.md +213 -0
- package/zh/dictionary/content_extention_customization.md +81 -0
- package/zh/dictionary/enumeration.md +221 -0
- package/zh/dictionary/file.md +209 -0
- package/zh/dictionary/function_fetching.md +188 -0
- package/zh/dictionary/get_started.md +490 -0
- package/zh/dictionary/insertion.md +161 -0
- package/zh/dictionary/markdown.md +342 -0
- package/zh/dictionary/nesting.md +249 -0
- package/zh/dictionary/translation.md +287 -0
- package/zh/header.md +7 -0
- package/zh/how_works_intlayer.md +217 -0
- package/zh/index.md +125 -0
- package/zh/interest_of_intlayer.md +132 -0
- package/zh/intlayer_CMS.md +334 -0
- package/zh/intlayer_cli.md +274 -0
- package/zh/intlayer_visual_editor.md +210 -0
- package/zh/intlayer_with_angular.md +3 -0
- package/zh/intlayer_with_create_react_app.md +1196 -0
- package/zh/intlayer_with_express.md +267 -0
- package/zh/intlayer_with_lynx+react.md +484 -0
- package/zh/intlayer_with_nextjs_14.md +1286 -0
- package/zh/intlayer_with_nextjs_15.md +1322 -0
- package/zh/intlayer_with_nextjs_page_router.md +1097 -0
- package/zh/intlayer_with_react_native+expo.md +539 -0
- package/zh/intlayer_with_vite+preact.md +1681 -0
- package/zh/intlayer_with_vite+react.md +1577 -0
- package/zh/intlayer_with_vite+solid.md +3 -0
- package/zh/intlayer_with_vite+svelte.md +3 -0
- package/zh/intlayer_with_vite+vue.md +988 -0
- package/zh/introduction.md +186 -0
- package/zh/mcp_server.md +152 -0
- package/zh/packages/@intlayer/api/index.md +31 -0
- package/zh/packages/@intlayer/chokidar/index.md +31 -0
- package/zh/packages/@intlayer/cli/index.md +21 -0
- package/zh/packages/@intlayer/config/index.md +116 -0
- package/zh/packages/@intlayer/core/index.md +25 -0
- package/zh/packages/@intlayer/design-system/index.md +21 -0
- package/zh/packages/@intlayer/dictionary-entry/index.md +21 -0
- package/zh/packages/@intlayer/editor/index.md +21 -0
- package/zh/packages/@intlayer/editor-react/index.md +21 -0
- package/zh/packages/@intlayer/webpack/index.md +35 -0
- package/zh/packages/angular-intlayer/index.md +3 -0
- package/zh/packages/express-intlayer/index.md +229 -0
- package/zh/packages/express-intlayer/t.md +432 -0
- package/zh/packages/intlayer/getConfiguration.md +120 -0
- package/zh/packages/intlayer/getEnumeration.md +140 -0
- package/zh/packages/intlayer/getHTMLTextDir.md +97 -0
- package/zh/packages/intlayer/getLocaleLang.md +57 -0
- package/zh/packages/intlayer/getLocaleName.md +93 -0
- package/zh/packages/intlayer/getLocalizedUrl.md +221 -0
- package/zh/packages/intlayer/getMultilingualUrls.md +198 -0
- package/zh/packages/intlayer/getPathWithoutLocale.md +50 -0
- package/zh/packages/intlayer/getTranslation.md +166 -0
- package/zh/packages/intlayer/getTranslationContent.md +166 -0
- package/zh/packages/intlayer/index.md +360 -0
- package/zh/packages/intlayer-cli/index.md +41 -0
- package/zh/packages/intlayer-editor/index.md +113 -0
- package/zh/packages/lynx-intlayer/index.md +60 -0
- package/zh/packages/next-intlayer/index.md +267 -0
- package/zh/packages/next-intlayer/t.md +338 -0
- package/zh/packages/next-intlayer/useDictionary.md +242 -0
- package/zh/packages/next-intlayer/useIntlayer.md +237 -0
- package/zh/packages/next-intlayer/useIntlayerAsync.md +211 -0
- package/zh/packages/next-intlayer/useLocale.md +105 -0
- package/zh/packages/preact-intlayer/index.md +3 -0
- package/zh/packages/react-intlayer/index.md +257 -0
- package/zh/packages/react-intlayer/t.md +271 -0
- package/zh/packages/react-intlayer/useDictionary.md +260 -0
- package/zh/packages/react-intlayer/useIntlayer.md +225 -0
- package/zh/packages/react-intlayer/useIntlayerAsync.md +226 -0
- package/zh/packages/react-intlayer/useLocale.md +184 -0
- package/zh/packages/react-native-intlayer/index.md +57 -0
- package/zh/packages/react-scripts-intlayer/index.md +57 -0
- package/zh/packages/solid-intlayer/index.md +3 -0
- package/zh/packages/svelte-intlayer/index.md +3 -0
- package/zh/packages/vite-intlayer/index.md +53 -0
- package/zh/packages/vue-intlayer/index.md +3 -0
- package/zh/per_locale_file.md +298 -0
- package/zh/privacy_notice.md +61 -0
- package/zh/roadmap.md +206 -0
- package/zh/terms_of_service.md +33 -0
- package/zh/vs_code_extension.md +139 -0
|
@@ -0,0 +1,1209 @@
|
|
|
1
|
+
# Getting Started Internationalizing (i18n) with Intlayer and React Create App
|
|
2
|
+
|
|
3
|
+
See [Application Template](https://github.com/aymericzip/intlayer-react-cra-template) on GitHub.
|
|
4
|
+
|
|
5
|
+
## What is Intlayer?
|
|
6
|
+
|
|
7
|
+
**Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
|
|
8
|
+
|
|
9
|
+
With Intlayer, you can:
|
|
10
|
+
|
|
11
|
+
- **Easily manage translations** using declarative dictionaries at the component level.
|
|
12
|
+
- **Dynamically localize metadata**, routes, and content.
|
|
13
|
+
- **Ensure TypeScript support** with autogenerated types, improving autocompletion and error detection.
|
|
14
|
+
- **Benefit from advanced features**, like dynamic locale detection and switching.
|
|
15
|
+
|
|
16
|
+
## Step-by-Step Guide to Set Up Intlayer in a React Application
|
|
17
|
+
|
|
18
|
+
### Step 1: Install Dependencies
|
|
19
|
+
|
|
20
|
+
Install the necessary packages using npm:
|
|
21
|
+
|
|
22
|
+
```bash packageManager="npm"
|
|
23
|
+
npm install intlayer react-intlayer react-scripts-intlayer
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```bash packageManager="pnpm"
|
|
27
|
+
pnpm add intlayer react-intlayer react-scripts-intlayer
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash packageManager="yarn"
|
|
31
|
+
yarn add intlayer react-intlayer react-scripts-intlayer
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **intlayer**
|
|
35
|
+
|
|
36
|
+
The core package that provides internationalization tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/en/dictionary/get_started.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_cli.md).
|
|
37
|
+
|
|
38
|
+
- **react-intlayer**
|
|
39
|
+
|
|
40
|
+
The package that integrates Intlayer with React application. It provides context providers and hooks for React internationalization.
|
|
41
|
+
|
|
42
|
+
- **react-scripts-intlayer**
|
|
43
|
+
|
|
44
|
+
Includes the `react-scripts-intlayer` commands and plugins for integrating Intlayer with the Create React App based application. These plugins are based on [craco](https://craco.js.org/) and includes additional configuration for the [Webpack](https://webpack.js.org/) bundler.
|
|
45
|
+
|
|
46
|
+
### Step 2: Configuration of your project
|
|
47
|
+
|
|
48
|
+
Create a config file to configure the languages of your application:
|
|
49
|
+
|
|
50
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
51
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
52
|
+
|
|
53
|
+
const config: IntlayerConfig = {
|
|
54
|
+
internationalization: {
|
|
55
|
+
locales: [
|
|
56
|
+
Locales.ENGLISH,
|
|
57
|
+
Locales.FRENCH,
|
|
58
|
+
Locales.SPANISH,
|
|
59
|
+
// Your other locales
|
|
60
|
+
],
|
|
61
|
+
defaultLocale: Locales.ENGLISH,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default config;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
69
|
+
import { Locales } from "intlayer";
|
|
70
|
+
|
|
71
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
72
|
+
const config = {
|
|
73
|
+
internationalization: {
|
|
74
|
+
locales: [
|
|
75
|
+
Locales.ENGLISH,
|
|
76
|
+
Locales.FRENCH,
|
|
77
|
+
Locales.SPANISH,
|
|
78
|
+
// Your other locales
|
|
79
|
+
],
|
|
80
|
+
defaultLocale: Locales.ENGLISH,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default config;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
88
|
+
const { Locales } = require("intlayer");
|
|
89
|
+
|
|
90
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
91
|
+
const config = {
|
|
92
|
+
internationalization: {
|
|
93
|
+
locales: [
|
|
94
|
+
Locales.ENGLISH,
|
|
95
|
+
Locales.FRENCH,
|
|
96
|
+
Locales.SPANISH,
|
|
97
|
+
// Your other locales
|
|
98
|
+
],
|
|
99
|
+
defaultLocale: Locales.ENGLISH,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
module.exports = config;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
> Through this configuration file, you can set up localized 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/en/configuration.md).
|
|
107
|
+
|
|
108
|
+
### Step 3: Integrate Intlayer in Your CRA Configuration
|
|
109
|
+
|
|
110
|
+
Change your scripts to use react-intlayer
|
|
111
|
+
|
|
112
|
+
```json fileName="package.json"
|
|
113
|
+
"scripts": {
|
|
114
|
+
"build": "react-scripts-intlayer build",
|
|
115
|
+
"start": "react-scripts-intlayer start",
|
|
116
|
+
"transpile": "intlayer build"
|
|
117
|
+
},
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> `react-scripts-intlayer` scripts are based on [CRACO](https://craco.js.org/). You can also implement your own setup based on the intlayer craco plugin. [See example here](https://github.com/aymericzip/intlayer/blob/main/examples/react-app/craco.config.js).
|
|
121
|
+
|
|
122
|
+
### Step 4: Declare Your Content
|
|
123
|
+
|
|
124
|
+
Create and manage your content declarations to store translations:
|
|
125
|
+
|
|
126
|
+
```tsx fileName="src/app.content.tsx" codeFormat="typescript"
|
|
127
|
+
import { t, type Dictionary } from "intlayer";
|
|
128
|
+
import React, { type ReactNode } from "react";
|
|
129
|
+
|
|
130
|
+
const appContent = {
|
|
131
|
+
key: "app",
|
|
132
|
+
content: {
|
|
133
|
+
getStarted: t<ReactNode>({
|
|
134
|
+
en: (
|
|
135
|
+
<>
|
|
136
|
+
Edit <code>src/App.tsx</code> and save to reload
|
|
137
|
+
</>
|
|
138
|
+
),
|
|
139
|
+
fr: (
|
|
140
|
+
<>
|
|
141
|
+
Éditez <code>src/App.tsx</code> et enregistrez pour recharger
|
|
142
|
+
</>
|
|
143
|
+
),
|
|
144
|
+
es: (
|
|
145
|
+
<>
|
|
146
|
+
Edita <code>src/App.tsx</code> y guarda para recargar
|
|
147
|
+
</>
|
|
148
|
+
),
|
|
149
|
+
}),
|
|
150
|
+
reactLink: {
|
|
151
|
+
href: "https://reactjs.org",
|
|
152
|
+
content: t({
|
|
153
|
+
en: "Learn React",
|
|
154
|
+
fr: "Apprendre React",
|
|
155
|
+
es: "Aprender React",
|
|
156
|
+
}),
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
} satisfies Dictionary;
|
|
160
|
+
|
|
161
|
+
export default appContent;
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```jsx fileName="src/app.content.mjx" codeFormat="esm"
|
|
165
|
+
import { t } from "intlayer";
|
|
166
|
+
|
|
167
|
+
/** @type {import('intlayer').Dictionary} */
|
|
168
|
+
const appContent = {
|
|
169
|
+
key: "app",
|
|
170
|
+
content: {
|
|
171
|
+
getStarted: t({
|
|
172
|
+
en: "Get started by editing",
|
|
173
|
+
fr: "Commencez par éditer",
|
|
174
|
+
es: "Comience por editar",
|
|
175
|
+
}),
|
|
176
|
+
reactLink: {
|
|
177
|
+
href: "https://reactjs.org",
|
|
178
|
+
content: t({
|
|
179
|
+
en: "Learn React",
|
|
180
|
+
fr: "Apprendre React",
|
|
181
|
+
es: "Aprender React",
|
|
182
|
+
}),
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export default appContent;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```jsx fileName="src/app.content.csx" codeFormat="commonjs"
|
|
191
|
+
const { t } = require("intlayer");
|
|
192
|
+
|
|
193
|
+
/** @type {import('intlayer').Dictionary} */
|
|
194
|
+
const appContent = {
|
|
195
|
+
key: "app",
|
|
196
|
+
content: {
|
|
197
|
+
getStarted: t({
|
|
198
|
+
en: "Get started by editing",
|
|
199
|
+
fr: "Commencez par éditer",
|
|
200
|
+
es: "Comience por editar",
|
|
201
|
+
}),
|
|
202
|
+
reactLink: {
|
|
203
|
+
href: "https://reactjs.org",
|
|
204
|
+
content: t({
|
|
205
|
+
en: "Learn React",
|
|
206
|
+
fr: "Apprendre React",
|
|
207
|
+
es: "Aprender React",
|
|
208
|
+
}),
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
module.exports = appContent;
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
> Your content declarations can be defined anywhere in your application as soon they are included into the `contentDir` directory (by default, `./src`). And match the content declaration file extension (by default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
217
|
+
|
|
218
|
+
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en/dictionary/get_started.md).
|
|
219
|
+
|
|
220
|
+
> If your content file includes TSX code, you should consider importing `import React from "react";` in your content file.
|
|
221
|
+
|
|
222
|
+
### Step 5: Utilize Intlayer in Your Code
|
|
223
|
+
|
|
224
|
+
Access your content dictionaries throughout your application:
|
|
225
|
+
|
|
226
|
+
```tsx {4,7} fileName="src/App.tsx" codeFormat="typescript"
|
|
227
|
+
import logo from "./logo.svg";
|
|
228
|
+
import "./App.css";
|
|
229
|
+
import type { FC } from "react";
|
|
230
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
231
|
+
|
|
232
|
+
const AppContent: FC = () => {
|
|
233
|
+
const content = useIntlayer("app");
|
|
234
|
+
|
|
235
|
+
return (
|
|
236
|
+
<div className="App">
|
|
237
|
+
<img src={logo} className="App-logo" alt="logo" />
|
|
238
|
+
|
|
239
|
+
{content.getStarted}
|
|
240
|
+
<a
|
|
241
|
+
className="App-link"
|
|
242
|
+
href={content.reactLink.href.value}
|
|
243
|
+
target="_blank"
|
|
244
|
+
rel="noopener noreferrer"
|
|
245
|
+
>
|
|
246
|
+
{content.reactLink.content}
|
|
247
|
+
</a>
|
|
248
|
+
</div>
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const App: FC = () => (
|
|
253
|
+
<IntlayerProvider>
|
|
254
|
+
<AppContent />
|
|
255
|
+
</IntlayerProvider>
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
export default App;
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```jsx {3,6} fileName="src/App.mjx" codeFormat="esm"
|
|
262
|
+
import "./App.css";
|
|
263
|
+
import logo from "./logo.svg";
|
|
264
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
265
|
+
|
|
266
|
+
const AppContent = () => {
|
|
267
|
+
const content = useIntlayer("app");
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<div className="App">
|
|
271
|
+
<img src={logo} className="App-logo" alt="logo" />
|
|
272
|
+
|
|
273
|
+
{content.getStarted}
|
|
274
|
+
<a
|
|
275
|
+
className="App-link"
|
|
276
|
+
href={content.reactLink.href.value}
|
|
277
|
+
target="_blank"
|
|
278
|
+
rel="noopener noreferrer"
|
|
279
|
+
>
|
|
280
|
+
{content.reactLink.content}
|
|
281
|
+
</a>
|
|
282
|
+
</div>
|
|
283
|
+
);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const App = () => (
|
|
287
|
+
<IntlayerProvider>
|
|
288
|
+
<AppContent />
|
|
289
|
+
</IntlayerProvider>
|
|
290
|
+
);
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
```jsx {3,6} fileName="src/App.csx" codeFormat="commonjs"
|
|
294
|
+
require("./App.css");
|
|
295
|
+
const logo = require("./logo.svg");
|
|
296
|
+
const { IntlayerProvider, useIntlayer } = require("react-intlayer");
|
|
297
|
+
|
|
298
|
+
const AppContent = () => {
|
|
299
|
+
const content = useIntlayer("app");
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<div className="App">
|
|
303
|
+
<img src={logo} className="App-logo" alt="logo" />
|
|
304
|
+
|
|
305
|
+
{content.getStarted}
|
|
306
|
+
<a
|
|
307
|
+
className="App-link"
|
|
308
|
+
href={content.reactLink.href.value}
|
|
309
|
+
target="_blank"
|
|
310
|
+
rel="noopener noreferrer"
|
|
311
|
+
>
|
|
312
|
+
{content.reactLink.content}
|
|
313
|
+
</a>
|
|
314
|
+
</div>
|
|
315
|
+
);
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
const App = () => (
|
|
319
|
+
<IntlayerProvider>
|
|
320
|
+
<AppContent />
|
|
321
|
+
</IntlayerProvider>
|
|
322
|
+
);
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
> Note: If you want to use your content in a `string` attribute, such as `alt`, `title`, `href`, `aria-label`, etc., you must call the value of the function, like:
|
|
326
|
+
|
|
327
|
+
> ```jsx
|
|
328
|
+
>
|
|
329
|
+
> ```
|
|
330
|
+
|
|
331
|
+
> <img src={content.image.src.value} alt={content.image.value} />
|
|
332
|
+
|
|
333
|
+
> ```
|
|
334
|
+
>
|
|
335
|
+
> ```
|
|
336
|
+
|
|
337
|
+
> To Learn more about the `useIntlayer` hook, refer to the [documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en/packages/react-intlayer/useIntlayer.md).
|
|
338
|
+
|
|
339
|
+
### (Optional) Step 6: Change the language of your content
|
|
340
|
+
|
|
341
|
+
To change the language of your content, you can use the `setLocale` function provided by the `useLocale` hook. This function allows you to set the locale of the application and update the content accordingly.
|
|
342
|
+
|
|
343
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
344
|
+
import { Locales } from "intlayer";
|
|
345
|
+
import { useLocale } from "react-intlayer";
|
|
346
|
+
|
|
347
|
+
const LocaleSwitcher = () => {
|
|
348
|
+
const { setLocale } = useLocale();
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
<button onClick={() => setLocale(Locales.English)}>
|
|
352
|
+
Change Language to English
|
|
353
|
+
</button>
|
|
354
|
+
);
|
|
355
|
+
};
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
```jsx fileName="src/components/LocaleSwitcher.mjx" codeFormat="esm"
|
|
359
|
+
import { Locales } from "intlayer";
|
|
360
|
+
import { useLocale } from "react-intlayer";
|
|
361
|
+
|
|
362
|
+
const LocaleSwitcher = () => {
|
|
363
|
+
const { setLocale } = useLocale();
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<button onClick={() => setLocale(Locales.English)}>
|
|
367
|
+
Change Language to English
|
|
368
|
+
</button>
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
```jsx fileName="src/components/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
374
|
+
const { Locales } = require("intlayer");
|
|
375
|
+
const { useLocale } = require("react-intlayer");
|
|
376
|
+
|
|
377
|
+
const LocaleSwitcher = () => {
|
|
378
|
+
const { setLocale } = useLocale();
|
|
379
|
+
|
|
380
|
+
return (
|
|
381
|
+
<button onClick={() => setLocale(Locales.English)}>
|
|
382
|
+
Change Language to English
|
|
383
|
+
</button>
|
|
384
|
+
);
|
|
385
|
+
};
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
> To Learn more about the `useLocale` hook, refer to the [documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en/packages/react-intlayer/useLocale.md).
|
|
389
|
+
|
|
390
|
+
### (Optional) Step 7: Add localized Routing to your application
|
|
391
|
+
|
|
392
|
+
The purpose of this step is to make unique routes for each language. This is useful for SEO and SEO-friendly URLs.
|
|
393
|
+
Example:
|
|
394
|
+
|
|
395
|
+
```plaintext
|
|
396
|
+
- https://example.com/about
|
|
397
|
+
- https://example.com/es/about
|
|
398
|
+
- https://example.com/fr/about
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
> By default, the routes are not prefixed for the default locale. If you want to prefix the default locale, you can set the `middleware.prefixDefault` option to `true` in your configuration. See the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en/configuration.md) for more information.
|
|
402
|
+
|
|
403
|
+
To add localized routing to your application, you can create a `LocaleRouter` component that wraps your application's routes and handles locale-based routing. Here is an example using [React Router](https://reactrouter.com/home):
|
|
404
|
+
|
|
405
|
+
```tsx fileName="src/components/LocaleRouter.tsx" codeFormat="typescript"
|
|
406
|
+
// Importing necessary dependencies and functions
|
|
407
|
+
import { type Locales, configuration, getPathWithoutLocale } from "intlayer"; // Utility functions and types from 'intlayer'
|
|
408
|
+
// Utility functions and types from 'intlayer'
|
|
409
|
+
import type { FC, PropsWithChildren } from "react"; // React types for functional components and props
|
|
410
|
+
import { IntlayerProvider } from "react-intlayer"; // Provider for internationalization context
|
|
411
|
+
import {
|
|
412
|
+
BrowserRouter,
|
|
413
|
+
Routes,
|
|
414
|
+
Route,
|
|
415
|
+
Navigate,
|
|
416
|
+
useLocation,
|
|
417
|
+
} from "react-router-dom"; // Router components for managing navigation
|
|
418
|
+
|
|
419
|
+
// Destructuring configuration from Intlayer
|
|
420
|
+
const { internationalization, middleware } = configuration;
|
|
421
|
+
const { locales, defaultLocale } = internationalization;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* A component that handles localization and wraps children with the appropriate locale context.
|
|
425
|
+
* It manages URL-based locale detection and validation.
|
|
426
|
+
*/
|
|
427
|
+
const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
428
|
+
children,
|
|
429
|
+
locale,
|
|
430
|
+
}) => {
|
|
431
|
+
const { pathname, search } = useLocation(); // Get the current URL path
|
|
432
|
+
|
|
433
|
+
// Determine the current locale, falling back to the default if not provided
|
|
434
|
+
const currentLocale = locale ?? defaultLocale;
|
|
435
|
+
|
|
436
|
+
// Remove the locale prefix from the path to construct a base path
|
|
437
|
+
const pathWithoutLocale = getPathWithoutLocale(
|
|
438
|
+
pathname // Current URL path
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* If middleware.prefixDefault is true, the default locale should always be prefixed.
|
|
443
|
+
*/
|
|
444
|
+
if (middleware.prefixDefault) {
|
|
445
|
+
// Validate the locale
|
|
446
|
+
if (!locale || !locales.includes(locale)) {
|
|
447
|
+
// Redirect to the default locale with the updated path
|
|
448
|
+
return (
|
|
449
|
+
<Navigate
|
|
450
|
+
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
451
|
+
replace // Replace the current history entry with the new one
|
|
452
|
+
/>
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// Wrap children with the IntlayerProvider and set the current locale
|
|
457
|
+
return (
|
|
458
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
459
|
+
);
|
|
460
|
+
} else {
|
|
461
|
+
/**
|
|
462
|
+
* When middleware.prefixDefault is false, the default locale is not prefixed.
|
|
463
|
+
* Ensure that the current locale is valid and not the default locale.
|
|
464
|
+
*/
|
|
465
|
+
if (
|
|
466
|
+
currentLocale.toString() !== defaultLocale.toString() &&
|
|
467
|
+
!locales
|
|
468
|
+
.filter(
|
|
469
|
+
(locale) => locale.toString() !== defaultLocale.toString() // Exclude the default locale
|
|
470
|
+
)
|
|
471
|
+
.includes(currentLocale) // Check if the current locale is in the list of valid locales
|
|
472
|
+
) {
|
|
473
|
+
// Redirect to the path without locale prefix
|
|
474
|
+
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Wrap children with the IntlayerProvider and set the current locale
|
|
478
|
+
return (
|
|
479
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* A router component that sets up locale-specific routes.
|
|
486
|
+
* It uses React Router to manage navigation and render localized components.
|
|
487
|
+
*/
|
|
488
|
+
export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
489
|
+
<BrowserRouter>
|
|
490
|
+
<Routes>
|
|
491
|
+
{locales
|
|
492
|
+
.filter(
|
|
493
|
+
(locale) => middleware.prefixDefault || locale !== defaultLocale
|
|
494
|
+
)
|
|
495
|
+
.map((locale) => (
|
|
496
|
+
<Route
|
|
497
|
+
// Route pattern to capture the locale (e.g., /en/, /fr/) and match all subsequent paths
|
|
498
|
+
path={`/${locale}/*`}
|
|
499
|
+
key={locale}
|
|
500
|
+
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Wraps children with locale management
|
|
501
|
+
/>
|
|
502
|
+
))}
|
|
503
|
+
|
|
504
|
+
{
|
|
505
|
+
// If prefixing the default locale is disabled, render the children directly at the root path
|
|
506
|
+
!middleware.prefixDefault && (
|
|
507
|
+
<Route
|
|
508
|
+
path="*"
|
|
509
|
+
element={
|
|
510
|
+
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
511
|
+
} // Wraps children with locale management
|
|
512
|
+
/>
|
|
513
|
+
)
|
|
514
|
+
}
|
|
515
|
+
</Routes>
|
|
516
|
+
</BrowserRouter>
|
|
517
|
+
);
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
```jsx fileName="src/components/LocaleRouter.mjx" codeFormat="esm"
|
|
521
|
+
// Importing necessary dependencies and functions
|
|
522
|
+
import { configuration, getPathWithoutLocale } from "intlayer"; // Utility functions and types from 'intlayer'
|
|
523
|
+
// Utility functions and types from 'intlayer'
|
|
524
|
+
import { IntlayerProvider } from "react-intlayer"; // Provider for internationalization context
|
|
525
|
+
import {
|
|
526
|
+
BrowserRouter,
|
|
527
|
+
Routes,
|
|
528
|
+
Route,
|
|
529
|
+
Navigate,
|
|
530
|
+
useLocation,
|
|
531
|
+
} from "react-router-dom"; // Router components for managing navigation
|
|
532
|
+
|
|
533
|
+
// Destructuring configuration from Intlayer
|
|
534
|
+
const { internationalization, middleware } = configuration;
|
|
535
|
+
const { locales, defaultLocale } = internationalization;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* A component that handles localization and wraps children with the appropriate locale context.
|
|
539
|
+
* It manages URL-based locale detection and validation.
|
|
540
|
+
*/
|
|
541
|
+
const AppLocalized = ({ children, locale }) => {
|
|
542
|
+
const { pathname, search } = useLocation(); // Get the current URL path
|
|
543
|
+
|
|
544
|
+
// Determine the current locale, falling back to the default if not provided
|
|
545
|
+
const currentLocale = locale ?? defaultLocale;
|
|
546
|
+
|
|
547
|
+
// Remove the locale prefix from the path to construct a base path
|
|
548
|
+
const pathWithoutLocale = getPathWithoutLocale(
|
|
549
|
+
pathname // Current URL path
|
|
550
|
+
);
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* If middleware.prefixDefault is true, the default locale should always be prefixed.
|
|
554
|
+
*/
|
|
555
|
+
if (middleware.prefixDefault) {
|
|
556
|
+
// Validate the locale
|
|
557
|
+
if (!locale || !locales.includes(locale)) {
|
|
558
|
+
// Redirect to the default locale with the updated path
|
|
559
|
+
return (
|
|
560
|
+
<Navigate
|
|
561
|
+
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
562
|
+
replace // Replace the current history entry with the new one
|
|
563
|
+
/>
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// Wrap children with the IntlayerProvider and set the current locale
|
|
568
|
+
return (
|
|
569
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
570
|
+
);
|
|
571
|
+
} else {
|
|
572
|
+
/**
|
|
573
|
+
* When middleware.prefixDefault is false, the default locale is not prefixed.
|
|
574
|
+
* Ensure that the current locale is valid and not the default locale.
|
|
575
|
+
*/
|
|
576
|
+
if (
|
|
577
|
+
currentLocale.toString() !== defaultLocale.toString() &&
|
|
578
|
+
!locales
|
|
579
|
+
.filter(
|
|
580
|
+
(locale) => locale.toString() !== defaultLocale.toString() // Exclude the default locale
|
|
581
|
+
)
|
|
582
|
+
.includes(currentLocale) // Check if the current locale is in the list of valid locales
|
|
583
|
+
) {
|
|
584
|
+
// Redirect to the path without locale prefix
|
|
585
|
+
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// Wrap children with the IntlayerProvider and set the current locale
|
|
589
|
+
return (
|
|
590
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* A router component that sets up locale-specific routes.
|
|
597
|
+
* It uses React Router to manage navigation and render localized components.
|
|
598
|
+
*/
|
|
599
|
+
export const LocaleRouter = ({ children }) => (
|
|
600
|
+
<BrowserRouter>
|
|
601
|
+
<Routes>
|
|
602
|
+
{locales
|
|
603
|
+
.filter(
|
|
604
|
+
(locale) => middleware.prefixDefault || locale !== defaultLocale
|
|
605
|
+
)
|
|
606
|
+
.map((locale) => (
|
|
607
|
+
<Route
|
|
608
|
+
// Route pattern to capture the locale (e.g., /en/, /fr/) and match all subsequent paths
|
|
609
|
+
path={`/${locale}/*`}
|
|
610
|
+
key={locale}
|
|
611
|
+
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Wraps children with locale management
|
|
612
|
+
/>
|
|
613
|
+
))}
|
|
614
|
+
|
|
615
|
+
{
|
|
616
|
+
// If prefixing the default locale is disabled, render the children directly at the root path
|
|
617
|
+
!middleware.prefixDefault && (
|
|
618
|
+
<Route
|
|
619
|
+
path="*"
|
|
620
|
+
element={
|
|
621
|
+
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
622
|
+
} // Wraps children with locale management
|
|
623
|
+
/>
|
|
624
|
+
)
|
|
625
|
+
}
|
|
626
|
+
</Routes>
|
|
627
|
+
</BrowserRouter>
|
|
628
|
+
);
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
```jsx fileName="src/components/LocaleRouter.cjx" codeFormat="commonjs"
|
|
632
|
+
// Importing necessary dependencies and functions
|
|
633
|
+
const { configuration, getPathWithoutLocale } = require("intlayer"); // Utility functions and types from 'intlayer'
|
|
634
|
+
const { IntlayerProvider, useLocale } = require("react-intlayer"); // Provider for internationalization context
|
|
635
|
+
const {
|
|
636
|
+
BrowserRouter,
|
|
637
|
+
Routes,
|
|
638
|
+
Route,
|
|
639
|
+
Navigate,
|
|
640
|
+
useLocation,
|
|
641
|
+
} = require("react-router-dom"); // Router components for managing navigation
|
|
642
|
+
|
|
643
|
+
// Destructuring configuration from Intlayer
|
|
644
|
+
const { internationalization, middleware } = configuration;
|
|
645
|
+
const { locales, defaultLocale } = internationalization;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* A component that handles localization and wraps children with the appropriate locale context.
|
|
649
|
+
* It manages URL-based locale detection and validation.
|
|
650
|
+
*/
|
|
651
|
+
const AppLocalized = ({ children, locale }) => {
|
|
652
|
+
const { pathname, search } = useLocation(); // Get the current URL path
|
|
653
|
+
|
|
654
|
+
// Determine the current locale, falling back to the default if not provided
|
|
655
|
+
const currentLocale = locale ?? defaultLocale;
|
|
656
|
+
|
|
657
|
+
// Remove the locale prefix from the path to construct a base path
|
|
658
|
+
const pathWithoutLocale = getPathWithoutLocale(
|
|
659
|
+
pathname // Current URL path
|
|
660
|
+
);
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* If middleware.prefixDefault is true, the default locale should always be prefixed.
|
|
664
|
+
*/
|
|
665
|
+
if (middleware.prefixDefault) {
|
|
666
|
+
// Validate the locale
|
|
667
|
+
if (!locale || !locales.includes(locale)) {
|
|
668
|
+
// Redirect to the default locale with the updated path
|
|
669
|
+
return (
|
|
670
|
+
<Navigate
|
|
671
|
+
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
672
|
+
replace // Replace the current history entry with the new one
|
|
673
|
+
/>
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// Wrap children with the IntlayerProvider and set the current locale
|
|
678
|
+
return (
|
|
679
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
680
|
+
);
|
|
681
|
+
} else {
|
|
682
|
+
/**
|
|
683
|
+
* When middleware.prefixDefault is false, the default locale is not prefixed.
|
|
684
|
+
* Ensure that the current locale is valid and not the default locale.
|
|
685
|
+
*/
|
|
686
|
+
if (
|
|
687
|
+
currentLocale.toString() !== defaultLocale.toString() &&
|
|
688
|
+
!locales
|
|
689
|
+
.filter(
|
|
690
|
+
(locale) => locale.toString() !== defaultLocale.toString() // Exclude the default locale
|
|
691
|
+
)
|
|
692
|
+
.includes(currentLocale) // Check if the current locale is in the list of valid locales
|
|
693
|
+
) {
|
|
694
|
+
// Redirect to the path without locale prefix
|
|
695
|
+
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// Wrap children with the IntlayerProvider and set the current locale
|
|
699
|
+
return (
|
|
700
|
+
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* A router component that sets up locale-specific routes.
|
|
707
|
+
* It uses React Router to manage navigation and render localized components.
|
|
708
|
+
*/
|
|
709
|
+
const LocaleRouter = ({ children }) => (
|
|
710
|
+
<BrowserRouter>
|
|
711
|
+
<Routes>
|
|
712
|
+
{locales
|
|
713
|
+
.filter(
|
|
714
|
+
(locale) => middleware.prefixDefault || locale !== defaultLocale
|
|
715
|
+
)
|
|
716
|
+
.map((locale) => (
|
|
717
|
+
<Route
|
|
718
|
+
// Route pattern to capture the locale (e.g., /en/, /fr/) and match all subsequent paths
|
|
719
|
+
path={`/${locale}/*`}
|
|
720
|
+
key={locale}
|
|
721
|
+
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Wraps children with locale management
|
|
722
|
+
/>
|
|
723
|
+
))}
|
|
724
|
+
|
|
725
|
+
{
|
|
726
|
+
// If prefixing the default locale is disabled, render the children directly at the root path
|
|
727
|
+
!middleware.prefixDefault && (
|
|
728
|
+
<Route
|
|
729
|
+
path="*"
|
|
730
|
+
element={
|
|
731
|
+
<AppLocalized locale={defaultLocale}>{children}</AppLocalized>
|
|
732
|
+
} // Wraps children with locale management
|
|
733
|
+
/>
|
|
734
|
+
)
|
|
735
|
+
}
|
|
736
|
+
</Routes>
|
|
737
|
+
</BrowserRouter>
|
|
738
|
+
);
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
Then, you can use the `LocaleRouter` component in your application:
|
|
742
|
+
|
|
743
|
+
```tsx fileName="src/App.tsx" codeFormat="typescript"
|
|
744
|
+
import { LocaleRouter } from "./components/LocaleRouter";
|
|
745
|
+
import type { FC } from "react";
|
|
746
|
+
|
|
747
|
+
// ... Your AppContent component
|
|
748
|
+
|
|
749
|
+
const App: FC = () => (
|
|
750
|
+
<LocaleRouter>
|
|
751
|
+
<AppContent />
|
|
752
|
+
</LocaleRouter>
|
|
753
|
+
);
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
```jsx fileName="src/App.mjx" codeFormat="esm"
|
|
757
|
+
import { LocaleRouter } from "./components/LocaleRouter";
|
|
758
|
+
|
|
759
|
+
// ... Your AppContent component
|
|
760
|
+
|
|
761
|
+
const App = () => (
|
|
762
|
+
<LocaleRouter>
|
|
763
|
+
<AppContent />
|
|
764
|
+
</LocaleRouter>
|
|
765
|
+
);
|
|
766
|
+
```
|
|
767
|
+
|
|
768
|
+
```jsx fileName="src/App.cjx" codeFormat="commonjs"
|
|
769
|
+
const { LocaleRouter } = require("./components/LocaleRouter");
|
|
770
|
+
|
|
771
|
+
// ... Your AppContent component
|
|
772
|
+
|
|
773
|
+
const App = () => (
|
|
774
|
+
<LocaleRouter>
|
|
775
|
+
<AppContent />
|
|
776
|
+
</LocaleRouter>
|
|
777
|
+
);
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
### (Optional) Step 8: Change the URL when the locale changes
|
|
781
|
+
|
|
782
|
+
To change the URL when the locale changes, you can use the `onLocaleChange` prop provided by the `useLocale` hook. In parallel, you can use the `useLocation` and `useNavigate` hooks from `react-router-dom` to update the URL path.
|
|
783
|
+
|
|
784
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
785
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
786
|
+
import {
|
|
787
|
+
Locales,
|
|
788
|
+
getHTMLTextDir,
|
|
789
|
+
getLocaleName,
|
|
790
|
+
getLocalizedUrl,
|
|
791
|
+
} from "intlayer";
|
|
792
|
+
import { useLocale } from "react-intlayer";
|
|
793
|
+
import { type FC } from "react";
|
|
794
|
+
|
|
795
|
+
const LocaleSwitcher: FC = () => {
|
|
796
|
+
const { pathname, search } = useLocation(); // Get the current URL path. Example: /fr/about?foo=bar
|
|
797
|
+
const navigate = useNavigate();
|
|
798
|
+
|
|
799
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
800
|
+
onLocaleChange: (locale) => {
|
|
801
|
+
// Construct the URL with the updated locale
|
|
802
|
+
// Example: /es/about?foo=bar
|
|
803
|
+
const pathWithLocale = getLocalizedUrl(`${pathname}${search}`, locale);
|
|
804
|
+
|
|
805
|
+
// Update the URL path
|
|
806
|
+
navigate(pathWithLocale);
|
|
807
|
+
},
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
return (
|
|
811
|
+
<div>
|
|
812
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
813
|
+
<div id="localePopover" popover="auto">
|
|
814
|
+
{availableLocales.map((localeItem) => (
|
|
815
|
+
<a
|
|
816
|
+
href={getLocalizedUrl(location.pathname, localeItem)}
|
|
817
|
+
hrefLang={localeItem}
|
|
818
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
819
|
+
onClick={(e) => {
|
|
820
|
+
e.preventDefault();
|
|
821
|
+
setLocale(localeItem);
|
|
822
|
+
}}
|
|
823
|
+
key={localeItem}
|
|
824
|
+
>
|
|
825
|
+
<span>
|
|
826
|
+
{/* Locale - e.g. FR */}
|
|
827
|
+
{localeItem}
|
|
828
|
+
</span>
|
|
829
|
+
<span>
|
|
830
|
+
{/* Language in its own Locale - e.g. Français */}
|
|
831
|
+
{getLocaleName(localeItem, locale)}
|
|
832
|
+
</span>
|
|
833
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
834
|
+
{/* Language in current Locale - e.g. Francés with current locale set to Locales.SPANISH */}
|
|
835
|
+
{getLocaleName(localeItem)}
|
|
836
|
+
</span>
|
|
837
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
838
|
+
{/* Language in English - e.g. French */}
|
|
839
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
840
|
+
</span>
|
|
841
|
+
</a>
|
|
842
|
+
))}
|
|
843
|
+
</div>
|
|
844
|
+
</div>
|
|
845
|
+
);
|
|
846
|
+
};
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
```jsx fileName="src/components/LocaleSwitcher.msx" codeFormat="esm"
|
|
850
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
851
|
+
import {
|
|
852
|
+
Locales,
|
|
853
|
+
getHTMLTextDir,
|
|
854
|
+
getLocaleName,
|
|
855
|
+
getLocalizedUrl,
|
|
856
|
+
} from "intlayer";
|
|
857
|
+
import { useLocale } from "react-intlayer";
|
|
858
|
+
|
|
859
|
+
const LocaleSwitcher = () => {
|
|
860
|
+
const { pathname, search } = useLocation(); // Get the current URL path. Example: /fr/about?foo=bar
|
|
861
|
+
const navigate = useNavigate();
|
|
862
|
+
|
|
863
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
864
|
+
onLocaleChange: (locale) => {
|
|
865
|
+
// Construct the URL with the updated locale
|
|
866
|
+
// Example: /es/about?foo=bar
|
|
867
|
+
const pathWithLocale = getLocalizedUrl(`${pathname}${search}`, locale);
|
|
868
|
+
|
|
869
|
+
// Update the URL path
|
|
870
|
+
navigate(pathWithLocale);
|
|
871
|
+
},
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
return (
|
|
875
|
+
<div>
|
|
876
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
877
|
+
<div id="localePopover" popover="auto">
|
|
878
|
+
{availableLocales.map((localeItem) => (
|
|
879
|
+
<a
|
|
880
|
+
href={getLocalizedUrl(location.pathname, localeItem)}
|
|
881
|
+
hrefLang={localeItem}
|
|
882
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
883
|
+
onClick={(e) => {
|
|
884
|
+
e.preventDefault();
|
|
885
|
+
setLocale(localeItem);
|
|
886
|
+
}}
|
|
887
|
+
key={localeItem}
|
|
888
|
+
>
|
|
889
|
+
<span>
|
|
890
|
+
{/* Locale - e.g. FR */}
|
|
891
|
+
{localeItem}
|
|
892
|
+
</span>
|
|
893
|
+
<span>
|
|
894
|
+
{/* Language in its own Locale - e.g. Français */}
|
|
895
|
+
{getLocaleName(localeItem, locale)}
|
|
896
|
+
</span>
|
|
897
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
898
|
+
{/* Language in current Locale - e.g. Francés with current locale set to Locales.SPANISH */}
|
|
899
|
+
{getLocaleName(localeItem)}
|
|
900
|
+
</span>
|
|
901
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
902
|
+
{/* Language in English - e.g. French */}
|
|
903
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
904
|
+
</span>
|
|
905
|
+
</a>
|
|
906
|
+
))}
|
|
907
|
+
</div>
|
|
908
|
+
</div>
|
|
909
|
+
);
|
|
910
|
+
};
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
```jsx fileName="src/components/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
914
|
+
const { useLocation, useNavigate } = require("react-router-dom");
|
|
915
|
+
const {
|
|
916
|
+
Locales,
|
|
917
|
+
getHTMLTextDir,
|
|
918
|
+
getLocaleName,
|
|
919
|
+
getLocalizedUrl,
|
|
920
|
+
} = require("intlayer");
|
|
921
|
+
const { useLocale } = require("react-intlayer");
|
|
922
|
+
|
|
923
|
+
const LocaleSwitcher = () => {
|
|
924
|
+
const { pathname, search } = useLocation(); // Get the current URL path. Example: /fr/about?foo=bar
|
|
925
|
+
const navigate = useNavigate();
|
|
926
|
+
|
|
927
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
928
|
+
onLocaleChange: (locale) => {
|
|
929
|
+
// Construct the URL with the updated locale
|
|
930
|
+
// Example: /es/about?foo=bar
|
|
931
|
+
const pathWithLocale = getLocalizedUrl(`${pathname}${search}`, locale);
|
|
932
|
+
|
|
933
|
+
// Update the URL path
|
|
934
|
+
navigate(pathWithLocale);
|
|
935
|
+
},
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
return (
|
|
939
|
+
<div>
|
|
940
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
941
|
+
<div id="localePopover" popover="auto">
|
|
942
|
+
{availableLocales.map((localeItem) => (
|
|
943
|
+
<a
|
|
944
|
+
href={getLocalizedUrl(location.pathname, localeItem)}
|
|
945
|
+
hrefLang={localeItem}
|
|
946
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
947
|
+
onClick={(e) => {
|
|
948
|
+
e.preventDefault();
|
|
949
|
+
setLocale(localeItem);
|
|
950
|
+
}}
|
|
951
|
+
key={localeItem}
|
|
952
|
+
>
|
|
953
|
+
<span>
|
|
954
|
+
{/* Locale - e.g. FR */}
|
|
955
|
+
{localeItem}
|
|
956
|
+
</span>
|
|
957
|
+
<span>
|
|
958
|
+
{/* Language in its own Locale - e.g. Français */}
|
|
959
|
+
{getLocaleName(localeItem, locale)}
|
|
960
|
+
</span>
|
|
961
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
962
|
+
{/* Language in current Locale - e.g. Francés with current locale set to Locales.SPANISH */}
|
|
963
|
+
{getLocaleName(localeItem)}
|
|
964
|
+
</span>
|
|
965
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
966
|
+
{/* Language in English - e.g. French */}
|
|
967
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
968
|
+
</span>
|
|
969
|
+
</a>
|
|
970
|
+
))}
|
|
971
|
+
</div>
|
|
972
|
+
</div>
|
|
973
|
+
);
|
|
974
|
+
};
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
> Documentation references:
|
|
978
|
+
|
|
979
|
+
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en/packages/react-intlayer/useLocale.md)
|
|
980
|
+
|
|
981
|
+
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en/packages/intlayer/getLocaleName.md)
|
|
982
|
+
|
|
983
|
+
> - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en/packages/intlayer/getLocalizedUrl.md)
|
|
984
|
+
|
|
985
|
+
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en/packages/intlayer/getHTMLTextDir.md)
|
|
986
|
+
|
|
987
|
+
> - [`hrefLang` attribute](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
|
|
988
|
+
|
|
989
|
+
> - [`lang` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
|
|
990
|
+
|
|
991
|
+
> - [`dir` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
|
|
992
|
+
|
|
993
|
+
> - [`aria-current` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
|
|
994
|
+
|
|
995
|
+
### (Optional) Step 9: Switch the HTML Language and Direction Attributes
|
|
996
|
+
|
|
997
|
+
When your application supports multiple languages, it's crucial to update the `<html>` tag's `lang` and `dir` attributes to match the current locale. Doing so ensures:
|
|
998
|
+
|
|
999
|
+
- **Accessibility**: Screen readers and assistive technologies rely on the correct `lang` attribute to pronounce and interpret content accurately.
|
|
1000
|
+
- **Text Rendering**: The `dir` (direction) attribute ensures that text is rendered in the proper order (e.g., left-to-right for English, right-to-left for Arabic or Hebrew), which is essential for readability.
|
|
1001
|
+
- **SEO**: Search engines use the `lang` attribute to determine the language of your page, helping to serve the right localized content in search results.
|
|
1002
|
+
|
|
1003
|
+
By updating these attributes dynamically when the locale changes, you guarantee a consistent and accessible experience for users across all supported languages.
|
|
1004
|
+
|
|
1005
|
+
#### Implementing the Hook
|
|
1006
|
+
|
|
1007
|
+
Create a custom hook to manage the HTML attributes. The hook listens for locale changes and updates the attributes accordingly:
|
|
1008
|
+
|
|
1009
|
+
```tsx fileName="src/hooks/useI18nHTMLAttributes.tsx" codeFormat="typescript"
|
|
1010
|
+
import { useEffect } from "react";
|
|
1011
|
+
import { useLocale } from "react-intlayer";
|
|
1012
|
+
import { getHTMLTextDir } from "intlayer";
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Updates the HTML <html> element's `lang` and `dir` attributes based on the current locale.
|
|
1016
|
+
* - `lang`: Informs browsers and search engines of the page's language.
|
|
1017
|
+
* - `dir`: Ensures the correct reading order (e.g., 'ltr' for English, 'rtl' for Arabic).
|
|
1018
|
+
*
|
|
1019
|
+
* This dynamic update is essential for proper text rendering, accessibility, and SEO.
|
|
1020
|
+
*/
|
|
1021
|
+
export const useI18nHTMLAttributes = () => {
|
|
1022
|
+
const { locale } = useLocale();
|
|
1023
|
+
|
|
1024
|
+
useEffect(() => {
|
|
1025
|
+
// Update the language attribute to the current locale.
|
|
1026
|
+
document.documentElement.lang = locale;
|
|
1027
|
+
|
|
1028
|
+
// Set the text direction based on the current locale.
|
|
1029
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
1030
|
+
}, [locale]);
|
|
1031
|
+
};
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
```jsx fileName="src/hooks/useI18nHTMLAttributes.msx" codeFormat="esm"
|
|
1035
|
+
import { useEffect } from "react";
|
|
1036
|
+
import { useLocale } from "react-intlayer";
|
|
1037
|
+
import { getHTMLTextDir } from "intlayer";
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* Updates the HTML <html> element's `lang` and `dir` attributes based on the current locale.
|
|
1041
|
+
* - `lang`: Informs browsers and search engines of the page's language.
|
|
1042
|
+
* - `dir`: Ensures the correct reading order (e.g., 'ltr' for English, 'rtl' for Arabic).
|
|
1043
|
+
*
|
|
1044
|
+
* This dynamic update is essential for proper text rendering, accessibility, and SEO.
|
|
1045
|
+
*/
|
|
1046
|
+
export const useI18nHTMLAttributes = () => {
|
|
1047
|
+
const { locale } = useLocale();
|
|
1048
|
+
|
|
1049
|
+
useEffect(() => {
|
|
1050
|
+
// Update the language attribute to the current locale.
|
|
1051
|
+
document.documentElement.lang = locale;
|
|
1052
|
+
|
|
1053
|
+
// Set the text direction based on the current locale.
|
|
1054
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
1055
|
+
}, [locale]);
|
|
1056
|
+
};
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
```jsx fileName="src/hooks/useI18nHTMLAttributes.csx" codeFormat="commonjs"
|
|
1060
|
+
const { useEffect } = require("react");
|
|
1061
|
+
const { useLocale } = require("react-intlayer");
|
|
1062
|
+
const { getHTMLTextDir } = require("intlayer");
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Updates the HTML <html> element's `lang` and `dir` attributes based on the current locale.
|
|
1066
|
+
* - `lang`: Informs browsers and search engines of the page's language.
|
|
1067
|
+
* - `dir`: Ensures the correct reading order (e.g., 'ltr' for English, 'rtl' for Arabic).
|
|
1068
|
+
*
|
|
1069
|
+
* This dynamic update is essential for proper text rendering, accessibility, and SEO.
|
|
1070
|
+
*/
|
|
1071
|
+
const useI18nHTMLAttributes = () => {
|
|
1072
|
+
const { locale } = useLocale();
|
|
1073
|
+
|
|
1074
|
+
useEffect(() => {
|
|
1075
|
+
// Update the language attribute to the current locale.
|
|
1076
|
+
document.documentElement.lang = locale;
|
|
1077
|
+
|
|
1078
|
+
// Set the text direction based on the current locale.
|
|
1079
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
1080
|
+
}, [locale]);
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
module.exports = { useI18nHTMLAttributes };
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
#### Using the Hook in Your Application
|
|
1087
|
+
|
|
1088
|
+
Integrate the hook into your main component so that the HTML attributes update whenever the locale changes:
|
|
1089
|
+
|
|
1090
|
+
```tsx fileName="src/App.tsx" codeFormat="typescript"
|
|
1091
|
+
import type { FC } from "react";
|
|
1092
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
1093
|
+
import { useI18nHTMLAttributes } from "./hooks/useI18nHTMLAttributes";
|
|
1094
|
+
import "./App.css";
|
|
1095
|
+
|
|
1096
|
+
const AppContent: FC = () => {
|
|
1097
|
+
// Apply the hook to update the <html> tag's lang and dir attributes based on the locale.
|
|
1098
|
+
useI18nHTMLAttributes();
|
|
1099
|
+
|
|
1100
|
+
// ... Rest of your component
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
const App: FC = () => (
|
|
1104
|
+
<IntlayerProvider>
|
|
1105
|
+
<AppContent />
|
|
1106
|
+
</IntlayerProvider>
|
|
1107
|
+
);
|
|
1108
|
+
|
|
1109
|
+
export default App;
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
```jsx fileName="src/App.msx" codeFormat="esm"
|
|
1113
|
+
import { IntlayerProvider, useIntlayer } from "react-intlayer";
|
|
1114
|
+
import { useI18nHTMLAttributes } from "./hooks/useI18nHTMLAttributes";
|
|
1115
|
+
import "./App.css";
|
|
1116
|
+
|
|
1117
|
+
const AppContent = () => {
|
|
1118
|
+
// Apply the hook to update the <html> tag's lang and dir attributes based on the locale.
|
|
1119
|
+
useI18nHTMLAttributes();
|
|
1120
|
+
|
|
1121
|
+
// ... Rest of your component
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1124
|
+
const App = () => (
|
|
1125
|
+
<IntlayerProvider>
|
|
1126
|
+
<AppContent />
|
|
1127
|
+
</IntlayerProvider>
|
|
1128
|
+
);
|
|
1129
|
+
|
|
1130
|
+
export default App;
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
```jsx fileName="src/App.csx" codeFormat="commonjs"
|
|
1134
|
+
const { FC } = require("react");
|
|
1135
|
+
const { IntlayerProvider, useIntlayer } = require("react-intlayer");
|
|
1136
|
+
const { useI18nHTMLAttributes } = require("./hooks/useI18nHTMLAttributes");
|
|
1137
|
+
require("./App.css");
|
|
1138
|
+
|
|
1139
|
+
const AppContent = () => {
|
|
1140
|
+
// Apply the hook to update the <html> tag's lang and dir attributes based on the locale.
|
|
1141
|
+
useI18nHTMLAttributes();
|
|
1142
|
+
|
|
1143
|
+
// ... Rest of your component
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
const App = () => (
|
|
1147
|
+
<IntlayerProvider>
|
|
1148
|
+
<AppContent />
|
|
1149
|
+
</IntlayerProvider>
|
|
1150
|
+
);
|
|
1151
|
+
|
|
1152
|
+
module.exports = App;
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1155
|
+
By applying these changes, your application will:
|
|
1156
|
+
|
|
1157
|
+
- Ensure the **language** (`lang`) attribute correctly reflects the current locale, which is important for SEO and browser behavior.
|
|
1158
|
+
- Adjust the **text direction** (`dir`) according to the locale, enhancing readability and usability for languages with different reading orders.
|
|
1159
|
+
- Provide a more **accessible** experience, as assistive technologies depend on these attributes to function optimally.
|
|
1160
|
+
|
|
1161
|
+
### Configure TypeScript
|
|
1162
|
+
|
|
1163
|
+
Intlayer use module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
1164
|
+
|
|
1165
|
+

|
|
1166
|
+
|
|
1167
|
+

|
|
1168
|
+
|
|
1169
|
+
Ensure your TypeScript configuration includes the autogenerated types.
|
|
1170
|
+
|
|
1171
|
+
```json5 fileName="tsconfig.json"
|
|
1172
|
+
{
|
|
1173
|
+
// ... Your existing TypeScript configurations
|
|
1174
|
+
"include": [
|
|
1175
|
+
// ... Your existing TypeScript configurations
|
|
1176
|
+
".intlayer/**/*.ts", // Include the auto-generated types
|
|
1177
|
+
],
|
|
1178
|
+
}
|
|
1179
|
+
```
|
|
1180
|
+
|
|
1181
|
+
### Git Configuration
|
|
1182
|
+
|
|
1183
|
+
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|
|
1184
|
+
|
|
1185
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
1186
|
+
|
|
1187
|
+
```plaintext fileName=".gitignore"
|
|
1188
|
+
# Ignore the files generated by Intlayer
|
|
1189
|
+
.intlayer
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
### VS Code Extension
|
|
1193
|
+
|
|
1194
|
+
To improve your development experience with Intlayer, you can install the official **Intlayer VS Code Extension**.
|
|
1195
|
+
|
|
1196
|
+
[Install from the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1197
|
+
|
|
1198
|
+
This extension provides:
|
|
1199
|
+
|
|
1200
|
+
- **Autocompletion** for translation keys.
|
|
1201
|
+
- **Real-time error detection** for missing translations.
|
|
1202
|
+
- **Inline previews** of translated content.
|
|
1203
|
+
- **Quick actions** to easily create and update translations.
|
|
1204
|
+
|
|
1205
|
+
For more details on how to use the extension, refer to the [Intlayer VS Code Extension documentation](https://intlayer.org/doc/vs-code-extension).
|
|
1206
|
+
|
|
1207
|
+
### Go Further
|
|
1208
|
+
|
|
1209
|
+
To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_visual_editor.md) or externalize your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/en/intlayer_CMS.md).
|