@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,1267 @@
|
|
|
1
|
+
# Getting Started internationalising (i18n) with Intlayer and Next.js 14 with App Router
|
|
2
|
+
|
|
3
|
+
See [Application Template](https://github.com/aymericzip/intlayer-next-14-template) on GitHub.
|
|
4
|
+
|
|
5
|
+
## What is Intlayer?
|
|
6
|
+
|
|
7
|
+
**Intlayer** is an innovative, open-source internationalisation (i18n) library designed to simplify multilingual support in modern web applications. Intlayer seamlessly integrates with the latest **Next.js 14** framework, including its powerful **App Router**. It is optimised to work with **Server Components** for efficient rendering and is fully compatible with [**Turbopack**](https://nextjs.org/docs/architecture/turbopack) (from Next.js >= 15).
|
|
8
|
+
|
|
9
|
+
With Intlayer, you can:
|
|
10
|
+
|
|
11
|
+
- **Easily manage translations** using declarative dictionaries at the component level.
|
|
12
|
+
- **Dynamically localise metadata**, routes, and content.
|
|
13
|
+
- **Access translations in both client-side and server-side components**.
|
|
14
|
+
- **Ensure TypeScript support** with autogenerated types, improving autocompletion and error detection.
|
|
15
|
+
- **Benefit from advanced features**, like dynamic locale detection and switching.
|
|
16
|
+
|
|
17
|
+
> Intlayer is compatible with Next.js 12, 13, 14, and 15. If you are using Next.js Page Router, you can refer to this [guide](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_with_nextjs_page_router.md). For Next.js 15 with or without turbopack, refer to this [guide](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_with_nextjs_15.md).
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step-by-Step Guide to Set Up Intlayer in a Next.js Application
|
|
22
|
+
|
|
23
|
+
### Step 1: Install Dependencies
|
|
24
|
+
|
|
25
|
+
Install the necessary packages using npm:
|
|
26
|
+
|
|
27
|
+
```bash packageManager="npm"
|
|
28
|
+
npm install intlayer next-intlayer
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash packageManager="pnpm"
|
|
32
|
+
pnpm add intlayer next-intlayer
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```bash packageManager="yarn"
|
|
36
|
+
yarn add intlayer next-intlayer
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **intlayer**
|
|
40
|
+
|
|
41
|
+
The core package that provides internationalisation tools for configuration management, translation, [content declaration](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/dictionary/get_started.md), transpilation, and [CLI commands](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_cli.md).
|
|
42
|
+
|
|
43
|
+
- **next-intlayer**
|
|
44
|
+
|
|
45
|
+
The package that integrates Intlayer with Next.js. It provides context providers and hooks for Next.js internationalisation. Additionally, it includes the Next.js plugin for integrating Intlayer with [Webpack](https://webpack.js.org/) or [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack), as well as middleware for detecting the user's preferred locale, managing cookies, and handling URL redirection.
|
|
46
|
+
|
|
47
|
+
### Step 2: Configure Your Project
|
|
48
|
+
|
|
49
|
+
Create a config file to configure the languages of your application:
|
|
50
|
+
|
|
51
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
52
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
53
|
+
|
|
54
|
+
const config: IntlayerConfig = {
|
|
55
|
+
internationalisation: {
|
|
56
|
+
locales: [
|
|
57
|
+
Locales.ENGLISH,
|
|
58
|
+
Locales.FRENCH,
|
|
59
|
+
Locales.SPANISH,
|
|
60
|
+
// Your other locales
|
|
61
|
+
],
|
|
62
|
+
defaultLocale: Locales.ENGLISH,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default config;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
70
|
+
import { Locales } from "intlayer";
|
|
71
|
+
|
|
72
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
73
|
+
const config = {
|
|
74
|
+
internationalisation: {
|
|
75
|
+
locales: [
|
|
76
|
+
Locales.ENGLISH,
|
|
77
|
+
Locales.FRENCH,
|
|
78
|
+
Locales.SPANISH,
|
|
79
|
+
// Your other locales
|
|
80
|
+
],
|
|
81
|
+
defaultLocale: Locales.ENGLISH,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default config;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
89
|
+
const { Locales } = require("intlayer");
|
|
90
|
+
|
|
91
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
92
|
+
const config = {
|
|
93
|
+
internationalisation: {
|
|
94
|
+
locales: [
|
|
95
|
+
Locales.ENGLISH,
|
|
96
|
+
Locales.FRENCH,
|
|
97
|
+
Locales.SPANISH,
|
|
98
|
+
// Your other locales
|
|
99
|
+
],
|
|
100
|
+
defaultLocale: Locales.ENGLISH,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
module.exports = config;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
> Through this configuration file, you can set up localised URLs, middleware redirection, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/configuration.md).
|
|
108
|
+
|
|
109
|
+
### Step 3: Integrate Intlayer in Your Next.js Configuration
|
|
110
|
+
|
|
111
|
+
Configure your Next.js setup to use Intlayer:
|
|
112
|
+
|
|
113
|
+
```typescript fileName="next.config.mjs"
|
|
114
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
115
|
+
|
|
116
|
+
/** @type {import('next').NextConfig} */
|
|
117
|
+
const nextConfig = {};
|
|
118
|
+
|
|
119
|
+
export default withIntlayer(nextConfig);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
> The `withIntlayer()` Next.js plugin is used to integrate Intlayer with Next.js. It ensures the building of content declaration files and monitors them in development mode. It defines Intlayer environment variables within the [Webpack](https://webpack.js.org/) or [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack) environments. Additionally, it provides aliases to optimise performance and ensures compatibility with server components.
|
|
123
|
+
|
|
124
|
+
### Step 4: Configure Middleware for Locale Detection
|
|
125
|
+
|
|
126
|
+
Set up middleware to detect the user's preferred locale:
|
|
127
|
+
|
|
128
|
+
```typescript fileName="src/middleware.ts" codeFormat="typescript"
|
|
129
|
+
export { intlayerMiddleware as middleware } from "next-intlayer/middleware";
|
|
130
|
+
|
|
131
|
+
export const config = {
|
|
132
|
+
matcher:
|
|
133
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
134
|
+
};
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```javascript fileName="src/middleware.mjs" codeFormat="esm"
|
|
138
|
+
export { intlayerMiddleware as middleware } from "next-intlayer/middleware";
|
|
139
|
+
|
|
140
|
+
export const config = {
|
|
141
|
+
matcher:
|
|
142
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
143
|
+
};
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```javascript fileName="src/middleware.cjs" codeFormat="commonjs"
|
|
147
|
+
const { intlayerMiddleware } = require("next-intlayer/middleware");
|
|
148
|
+
|
|
149
|
+
const config = {
|
|
150
|
+
matcher:
|
|
151
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
module.exports = { middleware: intlayerMiddleware, config };
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> The `intlayerMiddleware` is used to detect the user's preferred locale and redirect them to the appropriate URL as specified in the [configuration](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/configuration.md). Additionally, it enables saving the user's preferred locale in a cookie.
|
|
158
|
+
|
|
159
|
+
> Adapt the `matcher` parameter to match the routes of your application. For more details, refer to the [Next.js documentation on configuring the matcher](https://nextjs.org/docs/app/building-your-application/routing/middleware).
|
|
160
|
+
|
|
161
|
+
### Step 5: Define Dynamic Locale Routes
|
|
162
|
+
|
|
163
|
+
Remove everything from `RootLayout` and replace it with the following code:
|
|
164
|
+
|
|
165
|
+
```tsx fileName="src/app/layout.tsx" codeFormat="typescript"
|
|
166
|
+
import type { PropsWithChildren, FC } from "react";
|
|
167
|
+
import "./globals.css";
|
|
168
|
+
|
|
169
|
+
const RootLayout: FC<PropsWithChildren> = ({ children }) => children;
|
|
170
|
+
|
|
171
|
+
export default RootLayout;
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
```jsx fileName="src/app/layout.mjx" codeFormat="esm"
|
|
175
|
+
import "./globals.css";
|
|
176
|
+
|
|
177
|
+
const RootLayout = ({ children }) => children;
|
|
178
|
+
|
|
179
|
+
export default RootLayout;
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
```jsx fileName="src/app/layout.csx" codeFormat="commonjs"
|
|
183
|
+
require("./globals.css");
|
|
184
|
+
|
|
185
|
+
const RootLayout = ({ children }) => children;
|
|
186
|
+
|
|
187
|
+
module.exports = {
|
|
188
|
+
default: RootLayout,
|
|
189
|
+
generateStaticParams,
|
|
190
|
+
};
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
> Keeping the `RootLayout` component empty allows to set the [`lang`](https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/lang) and [`dir`](https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/dir) attributes to the `<html>` tag.
|
|
194
|
+
|
|
195
|
+
To implement dynamic routing, provide the path for the locale by adding a new layout in your `[locale]` directory:
|
|
196
|
+
|
|
197
|
+
```tsx fileName="src/app/[locale]/layout.tsx" codeFormat="typescript"
|
|
198
|
+
import type { Next14LayoutIntlayer } from "next-intlayer";
|
|
199
|
+
import { Inter } from "next/font/google";
|
|
200
|
+
import { getHTMLTextDir } from "intlayer";
|
|
201
|
+
|
|
202
|
+
const inter = Inter({ subsets: ["latin"] });
|
|
203
|
+
|
|
204
|
+
const LocaleLayout: Next14LayoutIntlayer = ({
|
|
205
|
+
children,
|
|
206
|
+
params: { locale },
|
|
207
|
+
}) => (
|
|
208
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
209
|
+
<body className={inter.className}>{children}</body>
|
|
210
|
+
</html>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
export default LocaleLayout;
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```jsx fileName="src/app/[locale]/layout.mjx" codeFormat="esm"
|
|
217
|
+
import { Inter } from "next/font/google";
|
|
218
|
+
import { getHTMLTextDir } from "intlayer";
|
|
219
|
+
|
|
220
|
+
const inter = Inter({ subsets: ["latin"] });
|
|
221
|
+
|
|
222
|
+
const LocaleLayout = ({ children, params: { locale } }) => (
|
|
223
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
224
|
+
<body className={inter.className}>{children}</body>
|
|
225
|
+
</html>
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
export default LocaleLayout;
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
```jsx fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
|
|
232
|
+
const { Inter } = require("next/font/google");
|
|
233
|
+
const { getHTMLTextDir } = require("intlayer");
|
|
234
|
+
|
|
235
|
+
const inter = Inter({ subsets: ["latin"] });
|
|
236
|
+
|
|
237
|
+
const LocaleLayout = ({ children, params: { locale } }) => (
|
|
238
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
239
|
+
<body className={inter.className}>{children}</body>
|
|
240
|
+
</html>
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
module.exports = LocaleLayout;
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
> The `[locale]` path segment is used to define the locale. Example: `/en-GB/about` will refer to `en-GB` and `/fr/about` to `fr`.
|
|
247
|
+
|
|
248
|
+
Then, implement the `generateStaticParams` function in your application Layout.
|
|
249
|
+
|
|
250
|
+
```tsx {1} fileName="src/app/[locale]/layout.tsx" codeFormat="typescript"
|
|
251
|
+
export { generateStaticParams } from "next-intlayer"; // Line to insert
|
|
252
|
+
|
|
253
|
+
const LocaleLayout: Next14LayoutIntlayer = ({
|
|
254
|
+
children,
|
|
255
|
+
params: { locale },
|
|
256
|
+
}) => {
|
|
257
|
+
/*... Rest of the code*/
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export default LocaleLayout;
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```jsx {1} fileName="src/app/[locale]/layout.mjx" codeFormat="esm"
|
|
264
|
+
export { generateStaticParams } from "next-intlayer"; // Line to insert
|
|
265
|
+
|
|
266
|
+
const LocaleLayout = ({ children, params: { locale } }) => {
|
|
267
|
+
/*... Rest of the code*/
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
export default LocaleLayout;
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
```jsx {1,7} fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
|
|
274
|
+
const { generateStaticParams } = require("next-intlayer"); // Line to insert
|
|
275
|
+
|
|
276
|
+
const LocaleLayout = ({ children, params: { locale } }) => {
|
|
277
|
+
/*... Rest of the code*/
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
module.exports = LocaleLayout;
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
> `generateStaticParams` ensures that your application pre-builds the necessary pages for all locales, reducing runtime computation and improving the user experience. For more details, refer to the [Next.js documentation on generateStaticParams](https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic-rendering#generate-static-params).
|
|
284
|
+
|
|
285
|
+
### Step 6: Declare Your Content
|
|
286
|
+
|
|
287
|
+
Create and manage your content declarations to store translations:
|
|
288
|
+
|
|
289
|
+
```typescript fileName="src/app/[locale]/page.content.ts" contentDeclarationFormat="typescript"
|
|
290
|
+
import { t, type Dictionary } from "intlayer";
|
|
291
|
+
|
|
292
|
+
const pageContent = {
|
|
293
|
+
key: "page",
|
|
294
|
+
content: {
|
|
295
|
+
getStarted: {
|
|
296
|
+
main: t({
|
|
297
|
+
en: "Get started by editing",
|
|
298
|
+
fr: "Commencez par éditer",
|
|
299
|
+
es: "Comience por editar",
|
|
300
|
+
}),
|
|
301
|
+
pageLink: "src/app/page.tsx",
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
} satisfies Dictionary;
|
|
305
|
+
|
|
306
|
+
export default pageContent;
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
```javascript fileName="src/app/[locale]/page.content.mjs" contentDeclarationFormat="esm"
|
|
310
|
+
import { t } from "intlayer";
|
|
311
|
+
|
|
312
|
+
/** @type {import('intlayer').Dictionary} */
|
|
313
|
+
const pageContent = {
|
|
314
|
+
key: "page",
|
|
315
|
+
content: {
|
|
316
|
+
getStarted: {
|
|
317
|
+
main: t({
|
|
318
|
+
en: "Get started by editing",
|
|
319
|
+
fr: "Commencez par éditer",
|
|
320
|
+
es: "Comience por editar",
|
|
321
|
+
}),
|
|
322
|
+
pageLink: "src/app/page.tsx",
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export default pageContent;
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
```javascript fileName="src/app/[locale]/page.content.cjs" contentDeclarationFormat="commonjs"
|
|
331
|
+
const { t } = require("intlayer");
|
|
332
|
+
|
|
333
|
+
/** @type {import('intlayer').Dictionary} */
|
|
334
|
+
const pageContent = {
|
|
335
|
+
key: "page",
|
|
336
|
+
content: {
|
|
337
|
+
getStarted: {
|
|
338
|
+
main: t({
|
|
339
|
+
en: "Get started by editing",
|
|
340
|
+
fr: "Commencez par éditer",
|
|
341
|
+
es: "Comience por editar",
|
|
342
|
+
}),
|
|
343
|
+
pageLink: "src/app/page.tsx",
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
module.exports = pageContent;
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
```json fileName="src/app/[locale]/page.content.json" contentDeclarationFormat="json"
|
|
352
|
+
{
|
|
353
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
354
|
+
"key": "page",
|
|
355
|
+
"content": {
|
|
356
|
+
"getStarted": {
|
|
357
|
+
"nodeType": "translation",
|
|
358
|
+
"translation": {
|
|
359
|
+
"en": "Get started by editing",
|
|
360
|
+
"fr": "Commencez par éditer",
|
|
361
|
+
"es": "Comience por editar"
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"pageLink": {
|
|
365
|
+
"nodeType": "translation",
|
|
366
|
+
"translation": {
|
|
367
|
+
"en": "src/app/page.tsx",
|
|
368
|
+
"fr": "src/app/page.tsx",
|
|
369
|
+
"es": "src/app/page.tsx"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
> 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}`).
|
|
377
|
+
|
|
378
|
+
> For more details, refer to the [content declaration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/dictionary/get_started.md).
|
|
379
|
+
|
|
380
|
+
### Step 7: Utilise Content in Your Code
|
|
381
|
+
|
|
382
|
+
Access your content dictionaries throughout your application:
|
|
383
|
+
|
|
384
|
+
```tsx fileName="src/app/[locale]/page.tsx" codeFormat="typescript"
|
|
385
|
+
import { ClientComponentExample } from "@components/ClientComponentExample";
|
|
386
|
+
import { ServerComponentExample } from "@components/ServerComponentExample";
|
|
387
|
+
import { type Next14PageIntlayer, IntlayerClientProvider } from "next-intlayer";
|
|
388
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
389
|
+
|
|
390
|
+
const Page: Next14PageIntlayer = ({ params: { locale } }) => {
|
|
391
|
+
const content = useIntlayer("page", locale);
|
|
392
|
+
|
|
393
|
+
return (
|
|
394
|
+
<>
|
|
395
|
+
<p>
|
|
396
|
+
{content.getStarted.main}
|
|
397
|
+
<code>{content.getStarted.pageLink}</code>
|
|
398
|
+
</p>
|
|
399
|
+
|
|
400
|
+
<IntlayerServerProvider locale={locale}>
|
|
401
|
+
<IntlayerClientProvider locale={locale}>
|
|
402
|
+
<ServerComponentExample />
|
|
403
|
+
<ClientComponentExample />
|
|
404
|
+
</IntlayerClientProvider>
|
|
405
|
+
</IntlayerServerProvider>
|
|
406
|
+
</>
|
|
407
|
+
);
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
export default Page;
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
```jsx fileName="src/app/[locale]/page.mjx" codeFormat="esm"
|
|
414
|
+
import { ClientComponentExample } from "@components/ClientComponentExample";
|
|
415
|
+
import { ServerComponentExample } from "@components/ServerComponentExample";
|
|
416
|
+
import { IntlayerClientProvider } from "next-intlayer";
|
|
417
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
418
|
+
|
|
419
|
+
const Page = ({ params: { locale } }) => {
|
|
420
|
+
const content = useIntlayer("page", locale);
|
|
421
|
+
|
|
422
|
+
return (
|
|
423
|
+
<>
|
|
424
|
+
<p>
|
|
425
|
+
{content.getStarted.main}
|
|
426
|
+
<code>{content.getStarted.pageLink}</code>
|
|
427
|
+
</p>
|
|
428
|
+
|
|
429
|
+
<IntlayerClientProvider locale={locale}>
|
|
430
|
+
<IntlayerServerProvider locale={locale}>
|
|
431
|
+
<ClientComponentExample />
|
|
432
|
+
<ServerComponentExample />
|
|
433
|
+
</IntlayerServerProvider>
|
|
434
|
+
</IntlayerClientProvider>
|
|
435
|
+
</>
|
|
436
|
+
);
|
|
437
|
+
};
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
```jsx fileName="src/app/[locale]/page.csx" codeFormat="commonjs"
|
|
441
|
+
const { IntlayerClientProvider } = require("next-intlayer");
|
|
442
|
+
const { IntlayerServerProvider, useIntlayer } = require("next-intlayer/server");
|
|
443
|
+
|
|
444
|
+
const Page = ({ params: { locale } }) => {
|
|
445
|
+
const content = useIntlayer("page", locale);
|
|
446
|
+
|
|
447
|
+
return (
|
|
448
|
+
<>
|
|
449
|
+
<p>
|
|
450
|
+
{content.getStarted.main}
|
|
451
|
+
<code>{content.getStarted.pageLink}</code>
|
|
452
|
+
</p>
|
|
453
|
+
|
|
454
|
+
<IntlayerClientProvider locale={locale}>
|
|
455
|
+
<IntlayerServerProvider locale={locale}>
|
|
456
|
+
<ClientComponentExample />
|
|
457
|
+
<ServerComponentExample />
|
|
458
|
+
</IntlayerServerProvider>
|
|
459
|
+
</IntlayerClientProvider>
|
|
460
|
+
</>
|
|
461
|
+
);
|
|
462
|
+
};
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
- **`IntlayerClientProvider`** is used to provide the locale to client-side components. It can be placed in any parent component, including the layout. However, placing it in a layout is recommended because Next.js shares layout code across pages, making it more efficient. By using `IntlayerClientProvider` in the layout, you avoid reinitialising it for every page, improving performance and maintaining a consistent localisation context throughout your application.
|
|
466
|
+
- **`IntlayerServerProvider`** is used to provide the locale to the server children. It cannot be set set in the layout.
|
|
467
|
+
|
|
468
|
+
> Layout and page cannot share a common server context because the server context system is based on a per-request data store (via [React’s cache](https://react.dev/reference/react/cache) mechanism), causing each “context” to be re-created for different segments of the application. Placing the provider in a shared layout would break this isolation, preventing the correct propagation of the server context values to your server components.
|
|
469
|
+
|
|
470
|
+
```tsx {4,7} fileName="src/components/ClientComponentExample.tsx" codeFormat="typescript"
|
|
471
|
+
"use client";
|
|
472
|
+
|
|
473
|
+
import type { FC } from "react";
|
|
474
|
+
import { useIntlayer } from "next-intlayer";
|
|
475
|
+
|
|
476
|
+
const ClientComponentExample: FC = () => {
|
|
477
|
+
const content = useIntlayer("client-component-example"); // Create related content declaration
|
|
478
|
+
|
|
479
|
+
return (
|
|
480
|
+
<div>
|
|
481
|
+
<h2>{content.title}</h2>
|
|
482
|
+
<p>{content.content}</p>
|
|
483
|
+
</div>
|
|
484
|
+
);
|
|
485
|
+
};
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
```jsx {3,6} fileName="src/components/ClientComponentExample.mjx" codeFormat="esm"
|
|
489
|
+
"use client";
|
|
490
|
+
|
|
491
|
+
import { useIntlayer } from "next-intlayer";
|
|
492
|
+
|
|
493
|
+
const ClientComponentExample = () => {
|
|
494
|
+
const content = useIntlayer("client-component-example"); // Create related content declaration
|
|
495
|
+
|
|
496
|
+
return (
|
|
497
|
+
<div>
|
|
498
|
+
<h2>{content.title}</h2>
|
|
499
|
+
<p>{content.content}</p>
|
|
500
|
+
</div>
|
|
501
|
+
);
|
|
502
|
+
};
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
```jsx {3,6} fileName="src/components/ClientComponentExample.csx" codeFormat="commonjs"
|
|
506
|
+
"use client";
|
|
507
|
+
|
|
508
|
+
const { useIntlayer } = require("next-intlayer");
|
|
509
|
+
|
|
510
|
+
const ClientComponentExample = () => {
|
|
511
|
+
const content = useIntlayer("client-component-example"); // Create related content declaration
|
|
512
|
+
|
|
513
|
+
return (
|
|
514
|
+
<div>
|
|
515
|
+
<h2>{content.title}</h2>
|
|
516
|
+
<p>{content.content}</p>
|
|
517
|
+
</div>
|
|
518
|
+
);
|
|
519
|
+
};
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
```tsx {2} fileName="src/components/ServerComponentExample.tsx" codeFormat="typescript"
|
|
523
|
+
import type { FC } from "react";
|
|
524
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
525
|
+
|
|
526
|
+
const ServerComponentExample: FC = () => {
|
|
527
|
+
const content = useIntlayer("server-component-example"); // Create related content declaration
|
|
528
|
+
|
|
529
|
+
return (
|
|
530
|
+
<div>
|
|
531
|
+
<h2>{content.title}</h2>
|
|
532
|
+
<p>{content.content}</p>
|
|
533
|
+
</div>
|
|
534
|
+
);
|
|
535
|
+
};
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
```jsx {1} fileName="src/components/ServerComponentExample.mjx" codeFormat="esm"
|
|
539
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
540
|
+
|
|
541
|
+
const ServerComponentExample = () => {
|
|
542
|
+
const content = useIntlayer("server-component-example"); // Create related content declaration
|
|
543
|
+
|
|
544
|
+
return (
|
|
545
|
+
<div>
|
|
546
|
+
<h2>{content.title}</h2>
|
|
547
|
+
<p>{content.content}</p>
|
|
548
|
+
</div>
|
|
549
|
+
);
|
|
550
|
+
};
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
```jsx {1} fileName="src/components/ServerComponentExample.csx" codeFormat="commonjs"
|
|
554
|
+
const { useIntlayer } = require("next-intlayer/server");
|
|
555
|
+
|
|
556
|
+
const ServerComponentExample = () => {
|
|
557
|
+
const content = useIntlayer("server-component-example"); // Create related content declaration
|
|
558
|
+
|
|
559
|
+
return (
|
|
560
|
+
<div>
|
|
561
|
+
<h2>{content.title}</h2>
|
|
562
|
+
<p>{content.content}</p>
|
|
563
|
+
</div>
|
|
564
|
+
);
|
|
565
|
+
};
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
> 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:
|
|
569
|
+
|
|
570
|
+
> ```jsx
|
|
571
|
+
>
|
|
572
|
+
> ```
|
|
573
|
+
|
|
574
|
+
> <img src={content.image.src.value} alt={content.image.value} />
|
|
575
|
+
|
|
576
|
+
> ```
|
|
577
|
+
>
|
|
578
|
+
> ```
|
|
579
|
+
|
|
580
|
+
> To Learn more about the `useIntlayer` hook, refer to the [documentation](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/packages/next-intlayer/useIntlayer.md).
|
|
581
|
+
|
|
582
|
+
### (Optional) Step 8: Internationalisation of your metadata
|
|
583
|
+
|
|
584
|
+
In the case you want to internationalise your metadata, such as the title of your page, you can use the `generateMetadata` function provided by Next.js. Inside the function use the `getTranslation` function to translate your metadata.
|
|
585
|
+
|
|
586
|
+
````typescript fileName="src/app/[locale]/layout.tsx or src/app/[locale]/page.tsx" codeFormat="typescript"
|
|
587
|
+
import {
|
|
588
|
+
type IConfigLocales,
|
|
589
|
+
getTranslation,
|
|
590
|
+
getMultilingualUrls,
|
|
591
|
+
} from "intlayer";
|
|
592
|
+
import type { Metadata } from "next";
|
|
593
|
+
import type { LocalParams } from "next-intlayer";
|
|
594
|
+
|
|
595
|
+
export const generateMetadata = ({
|
|
596
|
+
params: { locale },
|
|
597
|
+
}: LocalParams): Metadata => {
|
|
598
|
+
const t = <T>(content: IConfigLocales<T>) => getTranslation(content, locale);
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Generates an object containing all url for each locale.
|
|
602
|
+
*
|
|
603
|
+
* Example:
|
|
604
|
+
* ```ts
|
|
605
|
+
* getMultilingualUrls('/about');
|
|
606
|
+
*
|
|
607
|
+
* // Returns
|
|
608
|
+
* // {
|
|
609
|
+
* // en: '/about',
|
|
610
|
+
* // fr: '/fr/about',
|
|
611
|
+
* // es: '/es/about',
|
|
612
|
+
* // }
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
const multilingualUrls = getMultilingualUrls("/");
|
|
616
|
+
|
|
617
|
+
return {
|
|
618
|
+
title: t<string>({
|
|
619
|
+
en: "My title",
|
|
620
|
+
fr: "Mon titre",
|
|
621
|
+
es: "Mi título",
|
|
622
|
+
}),
|
|
623
|
+
description: t({
|
|
624
|
+
en: "My description",
|
|
625
|
+
fr: "Ma description",
|
|
626
|
+
es: "Mi descripción",
|
|
627
|
+
}),
|
|
628
|
+
alternates: {
|
|
629
|
+
canonical: multilingualUrls[locale as keyof typeof multilingualUrls],
|
|
630
|
+
languages: { ...multilingualUrls, "x-default": "/" },
|
|
631
|
+
},
|
|
632
|
+
openGraph: {
|
|
633
|
+
url: multilingualUrls[locale],
|
|
634
|
+
},
|
|
635
|
+
};
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
// ... Rest of the code
|
|
639
|
+
````
|
|
640
|
+
|
|
641
|
+
````javascript fileName="src/app/[locale]/layout.msx or src/app/[locale]/page.msx" codeFormat="javascript"
|
|
642
|
+
import { getTranslation, getMultilingualUrls } from "intlayer";
|
|
643
|
+
|
|
644
|
+
export const generateMetadata = ({ params: { locale } }) => {
|
|
645
|
+
const t = (content) => getTranslation(content, locale);
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Generates an object containing all url for each locale.
|
|
649
|
+
*
|
|
650
|
+
* Example:
|
|
651
|
+
* ```ts
|
|
652
|
+
* getMultilingualUrls('/about');
|
|
653
|
+
*
|
|
654
|
+
* // Returns
|
|
655
|
+
* // {
|
|
656
|
+
* // en: '/about',
|
|
657
|
+
* // fr: '/fr/about',
|
|
658
|
+
* // es: '/es/about',
|
|
659
|
+
* // }
|
|
660
|
+
* ```
|
|
661
|
+
*/
|
|
662
|
+
const multilingualUrls = getMultilingualUrls("/");
|
|
663
|
+
|
|
664
|
+
return {
|
|
665
|
+
title: t({
|
|
666
|
+
en: "My title",
|
|
667
|
+
fr: "Mon titre",
|
|
668
|
+
es: "Mi título",
|
|
669
|
+
}),
|
|
670
|
+
description: t({
|
|
671
|
+
en: "My description",
|
|
672
|
+
fr: "Ma description",
|
|
673
|
+
es: "Mi descripción",
|
|
674
|
+
}),
|
|
675
|
+
alternates: {
|
|
676
|
+
canonical: multilingualUrls[locale],
|
|
677
|
+
languages: { ...multilingualUrls, "x-default": "/" },
|
|
678
|
+
},
|
|
679
|
+
openGraph: {
|
|
680
|
+
url: multilingualUrls[locale],
|
|
681
|
+
},
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// ... Rest of the code
|
|
686
|
+
````
|
|
687
|
+
|
|
688
|
+
````javascript fileName="src/app/[locale]/layout.cjs or src/app/[locale]/page.cjs" codeFormat="javascript"
|
|
689
|
+
const { getTranslation, getMultilingualUrls } = require("intlayer");
|
|
690
|
+
|
|
691
|
+
module.exports.generateMetadata = ({ params: { locale } }) => {
|
|
692
|
+
const t = (content) => getTranslation(content, locale);
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Generates an object containing all url for each locale.
|
|
696
|
+
*
|
|
697
|
+
* Example:
|
|
698
|
+
* ```ts
|
|
699
|
+
* getMultilingualUrls('/about');
|
|
700
|
+
*
|
|
701
|
+
* // Returns
|
|
702
|
+
* // {
|
|
703
|
+
* // en: '/about',
|
|
704
|
+
* // fr: '/fr/about',
|
|
705
|
+
* // es: '/es/about',
|
|
706
|
+
* // }
|
|
707
|
+
* ```
|
|
708
|
+
*/
|
|
709
|
+
const multilingualUrls = getMultilingualUrls("/");
|
|
710
|
+
|
|
711
|
+
return {
|
|
712
|
+
title: t({
|
|
713
|
+
en: "My title",
|
|
714
|
+
fr: "Mon titre",
|
|
715
|
+
es: "Mi título",
|
|
716
|
+
}),
|
|
717
|
+
description: t({
|
|
718
|
+
en: "My description",
|
|
719
|
+
fr: "Ma description",
|
|
720
|
+
es: "Mi descripción",
|
|
721
|
+
}),
|
|
722
|
+
alternates: {
|
|
723
|
+
canonical: multilingualUrls[locale],
|
|
724
|
+
languages: { ...multilingualUrls, "x-default": "/" },
|
|
725
|
+
},
|
|
726
|
+
openGraph: {
|
|
727
|
+
url: multilingualUrls[locale],
|
|
728
|
+
},
|
|
729
|
+
};
|
|
730
|
+
};
|
|
731
|
+
|
|
732
|
+
// ... Rest of the code
|
|
733
|
+
````
|
|
734
|
+
|
|
735
|
+
> Lean more about the metadata optimisation [on the official Next.js documentation](https://nextjs.org/docs/app/building-your-application/optimizing/metadata).
|
|
736
|
+
|
|
737
|
+
### (Optional) Step 9: Internationalisation of your sitemap.xml and robots.txt
|
|
738
|
+
|
|
739
|
+
To internationalise your `sitemap.xml` and `robots.txt`, you can use the `getMultilingualUrls` function provided by Intlayer. This function allows you to generate multilingual URLs for your sitemap.
|
|
740
|
+
|
|
741
|
+
```tsx fileName="src/app/sitemap.ts" codeFormat="typescript"
|
|
742
|
+
import { getMultilingualUrls } from "intlayer";
|
|
743
|
+
import type { MetadataRoute } from "next";
|
|
744
|
+
|
|
745
|
+
const sitemap = (): MetadataRoute.Sitemap => [
|
|
746
|
+
{
|
|
747
|
+
url: "https://example.com",
|
|
748
|
+
alternates: {
|
|
749
|
+
languages: getMultilingualUrls("https://example.com"),
|
|
750
|
+
},
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
url: "https://example.com/login",
|
|
754
|
+
alternates: {
|
|
755
|
+
languages: getMultilingualUrls("https://example.com/login"),
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
url: "https://example.com/register",
|
|
760
|
+
alternates: {
|
|
761
|
+
languages: getMultilingualUrls("https://example.com/register"),
|
|
762
|
+
},
|
|
763
|
+
},
|
|
764
|
+
];
|
|
765
|
+
|
|
766
|
+
export default sitemap;
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
```jsx fileName="src/app/sitemap.mjx" codeFormat="esm"
|
|
770
|
+
import { getMultilingualUrls } from "intlayer";
|
|
771
|
+
|
|
772
|
+
const sitemap = () => [
|
|
773
|
+
{
|
|
774
|
+
url: "https://example.com",
|
|
775
|
+
alternates: {
|
|
776
|
+
languages: getMultilingualUrls("https://example.com"),
|
|
777
|
+
},
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
url: "https://example.com/login",
|
|
781
|
+
alternates: {
|
|
782
|
+
languages: getMultilingualUrls("https://example.com/login"),
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
url: "https://example.com/register",
|
|
787
|
+
alternates: {
|
|
788
|
+
languages: getMultilingualUrls("https://example.com/register"),
|
|
789
|
+
},
|
|
790
|
+
},
|
|
791
|
+
];
|
|
792
|
+
|
|
793
|
+
export default sitemap;
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
```jsx fileName="src/app/sitemap.csx" codeFormat="commonjs"
|
|
797
|
+
const { getMultilingualUrls } = require("intlayer");
|
|
798
|
+
|
|
799
|
+
const sitemap = () => [
|
|
800
|
+
{
|
|
801
|
+
url: "https://example.com",
|
|
802
|
+
alternates: {
|
|
803
|
+
languages: getMultilingualUrls("https://example.com"),
|
|
804
|
+
},
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
url: "https://example.com/login",
|
|
808
|
+
alternates: {
|
|
809
|
+
languages: getMultilingualUrls("https://example.com/login"),
|
|
810
|
+
},
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
url: "https://example.com/register",
|
|
814
|
+
alternates: {
|
|
815
|
+
languages: getMultilingualUrls("https://example.com/register"),
|
|
816
|
+
},
|
|
817
|
+
},
|
|
818
|
+
];
|
|
819
|
+
|
|
820
|
+
module.exports = sitemap;
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
```tsx fileName="src/app/robots.ts" codeFormat="typescript"
|
|
824
|
+
import type { MetadataRoute } from "next";
|
|
825
|
+
import { getMultilingualUrls } from "intlayer";
|
|
826
|
+
|
|
827
|
+
const getAllMultilingualUrls = (urls: string[]) =>
|
|
828
|
+
urls.flatMap((url) => Object.values(getMultilingualUrls(url)) as string[]);
|
|
829
|
+
|
|
830
|
+
const robots = (): MetadataRoute.Robots => ({
|
|
831
|
+
rules: {
|
|
832
|
+
userAgent: "*",
|
|
833
|
+
allow: ["/"],
|
|
834
|
+
disallow: getAllMultilingualUrls(["/login", "/register"]),
|
|
835
|
+
},
|
|
836
|
+
host: "https://example.com",
|
|
837
|
+
sitemap: `https://example.com/sitemap.xml`,
|
|
838
|
+
});
|
|
839
|
+
|
|
840
|
+
export default robots;
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
```jsx fileName="src/app/robots.mjx" codeFormat="esm"
|
|
844
|
+
import { getMultilingualUrls } from "intlayer";
|
|
845
|
+
|
|
846
|
+
const getAllMultilingualUrls = (urls) =>
|
|
847
|
+
urls.flatMap((url) => Object.values(getMultilingualUrls(url)));
|
|
848
|
+
|
|
849
|
+
const robots = () => ({
|
|
850
|
+
rules: {
|
|
851
|
+
userAgent: "*",
|
|
852
|
+
allow: ["/"],
|
|
853
|
+
disallow: getAllMultilingualUrls(["/login", "/register"]),
|
|
854
|
+
},
|
|
855
|
+
host: "https://example.com",
|
|
856
|
+
sitemap: `https://example.com/sitemap.xml`,
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
export default robots;
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
```jsx fileName="src/app/robots.csx" codeFormat="commonjs"
|
|
863
|
+
const { getMultilingualUrls } = require("intlayer");
|
|
864
|
+
|
|
865
|
+
const getAllMultilingualUrls = (urls) =>
|
|
866
|
+
urls.flatMap((url) => Object.values(getMultilingualUrls(url)));
|
|
867
|
+
|
|
868
|
+
const robots = () => ({
|
|
869
|
+
rules: {
|
|
870
|
+
userAgent: "*",
|
|
871
|
+
allow: ["/"],
|
|
872
|
+
disallow: getAllMultilingualUrls(["/login", "/register"]),
|
|
873
|
+
},
|
|
874
|
+
host: "https://example.com",
|
|
875
|
+
sitemap: `https://example.com/sitemap.xml`,
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
module.exports = robots;
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
> Learn more about the sitemap optimisation [on the official Next.js documentation](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap). Learn more about the robots.txt optimisation [on the official Next.js documentation](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots).
|
|
882
|
+
|
|
883
|
+
### (Optional) Step 10: Change the language of your content
|
|
884
|
+
|
|
885
|
+
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.
|
|
886
|
+
|
|
887
|
+
```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
888
|
+
"use client";
|
|
889
|
+
|
|
890
|
+
import {
|
|
891
|
+
Locales,
|
|
892
|
+
getHTMLTextDir,
|
|
893
|
+
getLocaleName,
|
|
894
|
+
getLocalisedUrl,
|
|
895
|
+
} from "intlayer";
|
|
896
|
+
import { useLocale } from "next-intlayer";
|
|
897
|
+
import { type FC } from "react";
|
|
898
|
+
import Link from "next/link";
|
|
899
|
+
|
|
900
|
+
const LocaleSwitcher: FC = () => {
|
|
901
|
+
const { locale, pathWithoutLocale, availableLocales } = useLocale();
|
|
902
|
+
const { setLocaleCookie } = useLocaleCookie();
|
|
903
|
+
|
|
904
|
+
return (
|
|
905
|
+
<div>
|
|
906
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
907
|
+
<div id="localePopover" popover="auto">
|
|
908
|
+
{availableLocales.map((localeItem) => (
|
|
909
|
+
<Link
|
|
910
|
+
href={getLocalisedUrl(pathWithoutLocale, localeItem)}
|
|
911
|
+
hrefLang={localeItem}
|
|
912
|
+
key={localeItem}
|
|
913
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
914
|
+
onClick={(e) => {
|
|
915
|
+
e.preventDefault();
|
|
916
|
+
setLocale(localeItem);
|
|
917
|
+
}}
|
|
918
|
+
>
|
|
919
|
+
<span>
|
|
920
|
+
{/* Locale - e.g. FR */}
|
|
921
|
+
{localeItem}
|
|
922
|
+
</span>
|
|
923
|
+
<span>
|
|
924
|
+
{/* Language in its own Locale - e.g. Français */}
|
|
925
|
+
{getLocaleName(localeItem, locale)}
|
|
926
|
+
</span>
|
|
927
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
928
|
+
{/* Language in current Locale - e.g. Francés with current locale set to Locales.SPANISH */}
|
|
929
|
+
{getLocaleName(localeItem)}
|
|
930
|
+
</span>
|
|
931
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
932
|
+
{/* Language in English - e.g. French */}
|
|
933
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
934
|
+
</span>
|
|
935
|
+
</Link>
|
|
936
|
+
))}
|
|
937
|
+
</div>
|
|
938
|
+
</div>
|
|
939
|
+
);
|
|
940
|
+
};
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
```jsx fileName="src/components/LocaleSwitcher.msx" codeFormat="esm"
|
|
944
|
+
"use client";
|
|
945
|
+
|
|
946
|
+
import {
|
|
947
|
+
Locales,
|
|
948
|
+
getHTMLTextDir,
|
|
949
|
+
getLocaleName,
|
|
950
|
+
getLocalisedUrl,
|
|
951
|
+
} from "intlayer";
|
|
952
|
+
import { useLocale } from "next-intlayer";
|
|
953
|
+
import Link from "next/link";
|
|
954
|
+
|
|
955
|
+
const LocaleSwitcher = () => {
|
|
956
|
+
const { locale, pathWithoutLocale, availableLocales } = useLocale();
|
|
957
|
+
const { setLocaleCookie } = useLocaleCookie();
|
|
958
|
+
|
|
959
|
+
return (
|
|
960
|
+
<div>
|
|
961
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
962
|
+
<div id="localePopover" popover="auto">
|
|
963
|
+
{availableLocales.map((localeItem) => (
|
|
964
|
+
<Link
|
|
965
|
+
href={getLocalisedUrl(pathWithoutLocale, localeItem)}
|
|
966
|
+
hrefLang={localeItem}
|
|
967
|
+
key={localeItem}
|
|
968
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
969
|
+
onClick={(e) => {
|
|
970
|
+
e.preventDefault();
|
|
971
|
+
setLocale(localeItem);
|
|
972
|
+
}}
|
|
973
|
+
>
|
|
974
|
+
<span>
|
|
975
|
+
{/* Locale - e.g. FR */}
|
|
976
|
+
{localeItem}
|
|
977
|
+
</span>
|
|
978
|
+
<span>
|
|
979
|
+
{/* Language in its own Locale - e.g. Français */}
|
|
980
|
+
{getLocaleName(localeItem, locale)}
|
|
981
|
+
</span>
|
|
982
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
983
|
+
{/* Language in current Locale - e.g. Francés with current locale set to Locales.SPANISH */}
|
|
984
|
+
{getLocaleName(localeItem)}
|
|
985
|
+
</span>
|
|
986
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
987
|
+
{/* Language in English - e.g. French */}
|
|
988
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
989
|
+
</span>
|
|
990
|
+
</Link>
|
|
991
|
+
))}
|
|
992
|
+
</div>
|
|
993
|
+
</div>
|
|
994
|
+
);
|
|
995
|
+
};
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
```jsx fileName="src/components/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
999
|
+
"use client";
|
|
1000
|
+
|
|
1001
|
+
const {
|
|
1002
|
+
Locales,
|
|
1003
|
+
getHTMLTextDir,
|
|
1004
|
+
getLocaleName,
|
|
1005
|
+
getLocalisedUrl,
|
|
1006
|
+
} = require("intlayer");
|
|
1007
|
+
const { useLocale } = require("next-intlayer");
|
|
1008
|
+
const Link = require("next/link");
|
|
1009
|
+
|
|
1010
|
+
const LocaleSwitcher = () => {
|
|
1011
|
+
const { locale, pathWithoutLocale, availableLocales } = useLocale();
|
|
1012
|
+
const { setLocaleCookie } = useLocaleCookie();
|
|
1013
|
+
|
|
1014
|
+
return (
|
|
1015
|
+
<div>
|
|
1016
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
1017
|
+
<div id="localePopover" popover="auto">
|
|
1018
|
+
{availableLocales.map((localeItem) => (
|
|
1019
|
+
<Link
|
|
1020
|
+
href={getLocalisedUrl(pathWithoutLocale, localeItem)}
|
|
1021
|
+
hrefLang={localeItem}
|
|
1022
|
+
key={localeItem}
|
|
1023
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
1024
|
+
onClick={(e) => {
|
|
1025
|
+
e.preventDefault();
|
|
1026
|
+
setLocale(localeItem);
|
|
1027
|
+
}}
|
|
1028
|
+
>
|
|
1029
|
+
<span>
|
|
1030
|
+
{/* Locale - e.g. FR */}
|
|
1031
|
+
{localeItem}
|
|
1032
|
+
</span>
|
|
1033
|
+
<span>
|
|
1034
|
+
{/* Language in its own Locale - e.g. Français */}
|
|
1035
|
+
{getLocaleName(localeItem, locale)}
|
|
1036
|
+
</span>
|
|
1037
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1038
|
+
{/* Language in current Locale - e.g. Francés with current locale set to Locales.SPANISH */}
|
|
1039
|
+
{getLocaleName(localeItem)}
|
|
1040
|
+
</span>
|
|
1041
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
1042
|
+
{/* Language in English - e.g. French */}
|
|
1043
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
1044
|
+
</span>
|
|
1045
|
+
</Link>
|
|
1046
|
+
))}
|
|
1047
|
+
</div>
|
|
1048
|
+
</div>
|
|
1049
|
+
);
|
|
1050
|
+
};
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
> Documentation references:
|
|
1054
|
+
|
|
1055
|
+
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/packages/next-intlayer/useLocale.md)
|
|
1056
|
+
|
|
1057
|
+
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/packages/intlayer/getLocaleName.md)
|
|
1058
|
+
|
|
1059
|
+
> - [`getLocalisedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/packages/intlayer/getLocalisedUrl.md)
|
|
1060
|
+
|
|
1061
|
+
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/packages/intlayer/getHTMLTextDir.md)
|
|
1062
|
+
|
|
1063
|
+
> - [`hrefLang` attribute](https://developers.google.com/search/docs/specialty/international/localised-versions?hl=fr)
|
|
1064
|
+
|
|
1065
|
+
> - [`lang` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
|
|
1066
|
+
|
|
1067
|
+
> - [`dir` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
|
|
1068
|
+
|
|
1069
|
+
> - [`aria-current` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
|
|
1070
|
+
|
|
1071
|
+
### (Optional) Step 11: Creating a Localised Link Component
|
|
1072
|
+
|
|
1073
|
+
To ensure that your application’s navigation respects the current locale, you can create a custom `Link` component. This component automatically prefixes internal URLs with the current language, so that. For example, when a French-speaking user clicks on a link to the "About" page, they are redirected to `/fr/about` instead of `/about`.
|
|
1074
|
+
|
|
1075
|
+
This behaviour is useful for several reasons:
|
|
1076
|
+
|
|
1077
|
+
- **SEO and User Experience**: Localised URLs help search engines index language-specific pages correctly and provide users with content in their preferred language.
|
|
1078
|
+
- **Consistency**: By using a localised link throughout your application, you guarantee that navigation stays within the current locale, preventing unexpected language switches.
|
|
1079
|
+
- **Maintainability**: Centralising the localisation logic in a single component simplifies the management of URLs, making your codebase easier to maintain and extend as your application grows.
|
|
1080
|
+
|
|
1081
|
+
Below is the implementation of a localised `Link` component in TypeScript:
|
|
1082
|
+
|
|
1083
|
+
```tsx fileName="src/components/Link.tsx" codeFormat="typescript"
|
|
1084
|
+
"use client";
|
|
1085
|
+
|
|
1086
|
+
import { getLocalisedUrl } from "intlayer";
|
|
1087
|
+
import NextLink, { type LinkProps as NextLinkProps } from "next/link";
|
|
1088
|
+
import { useLocale } from "next-intlayer";
|
|
1089
|
+
import { forwardRef, PropsWithChildren, type ForwardedRef } from "react";
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Utility function to check whether a given URL is external.
|
|
1093
|
+
* If the URL starts with http:// or https://, it's considered external.
|
|
1094
|
+
*/
|
|
1095
|
+
export const checkIsExternalLink = (href?: string): boolean =>
|
|
1096
|
+
/^https?:\/\//.test(href ?? "");
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* A custom Link component that adapts the href attribute based on the current locale.
|
|
1100
|
+
* For internal links, it uses `getLocalisedUrl` to prefix the URL with the locale (e.g., /fr/about).
|
|
1101
|
+
* This ensures that navigation stays within the same locale context.
|
|
1102
|
+
*/
|
|
1103
|
+
export const Link = forwardRef<
|
|
1104
|
+
HTMLAnchorElement,
|
|
1105
|
+
PropsWithChildren<NextLinkProps>
|
|
1106
|
+
>(({ href, children, ...props }, ref: ForwardedRef<HTMLAnchorElement>) => {
|
|
1107
|
+
const { locale } = useLocale();
|
|
1108
|
+
const isExternalLink = checkIsExternalLink(href.toString());
|
|
1109
|
+
|
|
1110
|
+
// If the link is internal and a valid href is provided, get the localised URL.
|
|
1111
|
+
const hrefI18n: NextLinkProps["href"] =
|
|
1112
|
+
href && !isExternalLink ? getLocalisedUrl(href.toString(), locale) : href;
|
|
1113
|
+
|
|
1114
|
+
return (
|
|
1115
|
+
<NextLink href={hrefI18n} ref={ref} {...props}>
|
|
1116
|
+
{children}
|
|
1117
|
+
</NextLink>
|
|
1118
|
+
);
|
|
1119
|
+
});
|
|
1120
|
+
|
|
1121
|
+
Link.displayName = "Link";
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
```jsx fileName="src/components/Link.mjx" codeFormat="esm"
|
|
1125
|
+
'use client';
|
|
1126
|
+
|
|
1127
|
+
import { getLocalisedUrl } from 'intlayer';
|
|
1128
|
+
import NextLink, { type LinkProps as NextLinkProps } from 'next/link';
|
|
1129
|
+
import { useLocale } from 'next-intlayer';
|
|
1130
|
+
import { forwardRef, PropsWithChildren, type ForwardedRef } from 'react';
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Utility function to check whether a given URL is external.
|
|
1134
|
+
* If the URL starts with http:// or https://, it's considered external.
|
|
1135
|
+
*/
|
|
1136
|
+
export const checkIsExternalLink = (href) =>
|
|
1137
|
+
/^https?:\/\//.test(href ?? '');
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* A custom Link component that adapts the href attribute based on the current locale.
|
|
1141
|
+
* For internal links, it uses `getLocalisedUrl` to prefix the URL with the locale (e.g., /fr/about).
|
|
1142
|
+
* This ensures that navigation stays within the same locale context.
|
|
1143
|
+
*/
|
|
1144
|
+
export const Link = forwardRef(({ href, children, ...props }, ref) => {
|
|
1145
|
+
const { locale } = useLocale();
|
|
1146
|
+
const isExternalLink = checkIsExternalLink(href.toString());
|
|
1147
|
+
|
|
1148
|
+
// If the link is internal and a valid href is provided, get the localised URL.
|
|
1149
|
+
const hrefI18n =
|
|
1150
|
+
href && !isExternalLink ? getLocalisedUrl(href.toString(), locale) : href;
|
|
1151
|
+
|
|
1152
|
+
return (
|
|
1153
|
+
<NextLink href={hrefI18n} ref={ref} {...props}>
|
|
1154
|
+
{children}
|
|
1155
|
+
</NextLink>
|
|
1156
|
+
);
|
|
1157
|
+
});
|
|
1158
|
+
|
|
1159
|
+
Link.displayName = 'Link';
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
```jsx fileName="src/components/Link.csx" codeFormat="commonjs"
|
|
1163
|
+
'use client';
|
|
1164
|
+
|
|
1165
|
+
const { getLocalisedUrl } = require("intlayer");
|
|
1166
|
+
const NextLink = require("next/link");
|
|
1167
|
+
const { useLocale } = require("next-intlayer");
|
|
1168
|
+
const { forwardRef } = require("react");
|
|
1169
|
+
|
|
1170
|
+
/**
|
|
1171
|
+
* Utility function to check whether a given URL is external.
|
|
1172
|
+
* If the URL starts with http:// or https://, it's considered external.
|
|
1173
|
+
*/
|
|
1174
|
+
const checkIsExternalLink = (href) =>
|
|
1175
|
+
/^https?:\/\//.test(href ?? '');
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
const Link = forwardRef(({ href, children, ...props }, ref) => {
|
|
1179
|
+
const { locale } = useLocale();
|
|
1180
|
+
const isExternalLink = checkIsExternalLink(href.toString());
|
|
1181
|
+
|
|
1182
|
+
// If the link is internal and a valid href is provided, get the localised URL.
|
|
1183
|
+
const hrefI18n: NextLinkProps['href'] =
|
|
1184
|
+
href && !isExternalLink ? getLocalisedUrl(href.toString(), locale) : href;
|
|
1185
|
+
|
|
1186
|
+
return (
|
|
1187
|
+
<NextLink href={hrefI18n} ref={ref} {...props}>
|
|
1188
|
+
{children}
|
|
1189
|
+
</NextLink>
|
|
1190
|
+
);
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
Link.displayName = 'Link';
|
|
1194
|
+
```
|
|
1195
|
+
|
|
1196
|
+
#### How It Works
|
|
1197
|
+
|
|
1198
|
+
- **Detecting External Links**:
|
|
1199
|
+
The helper function `checkIsExternalLink` determines whether a URL is external. External links are left unchanged because they do not need localisation.
|
|
1200
|
+
|
|
1201
|
+
- **Retrieving the Current Locale**:
|
|
1202
|
+
The `useLocale` hook provides the current locale (e.g., `fr` for French).
|
|
1203
|
+
|
|
1204
|
+
- **Localising the URL**:
|
|
1205
|
+
For internal links (i.e., non-external), `getLocalisedUrl` is used to automatically prefix the URL with the current locale. This means that if your user is in French, passing `/about` as the `href` will transform it to `/fr/about`.
|
|
1206
|
+
|
|
1207
|
+
- **Returning the Link**:
|
|
1208
|
+
The component returns an `<a>` element with the localised URL, ensuring that navigation is consistent with the locale.
|
|
1209
|
+
|
|
1210
|
+
By integrating this `Link` component across your application, you maintain a coherent and language-aware user experience while also benefitting from improved SEO and usability.
|
|
1211
|
+
|
|
1212
|
+
### (Optional) Step 12: Optmize your bundle size
|
|
1213
|
+
|
|
1214
|
+
When using `next-intlayer`, dictionaries are included in the bundle for every page by default. To optimize bundle size, Intlayer provides an optional SWC plugin that intelligently replace `useIntlayer` calls using macros. This ensures dictionaries are only included in bundles for pages that actually use them.
|
|
1215
|
+
|
|
1216
|
+
To enable this optimization, install the `@intlayer/swc` package. Once installed, `next-intlayer` will automatically detect and use the plugin:
|
|
1217
|
+
|
|
1218
|
+
```bash packageManager="npm"
|
|
1219
|
+
npm install @intlayer/swc --save-dev
|
|
1220
|
+
```
|
|
1221
|
+
|
|
1222
|
+
```bash packageManager="pnpm"
|
|
1223
|
+
pnpm add @intlayer/swc --save-dev
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
```bash packageManager="yarn"
|
|
1227
|
+
yarn add @intlayer/swc --save-dev
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
> Note: This optimization is only available for Next.js 13 and above.
|
|
1231
|
+
|
|
1232
|
+
> Note: This package is not installed by default because SWC plugins are still experimental on Next.js. It may change in the future.
|
|
1233
|
+
|
|
1234
|
+
### Configure TypeScript
|
|
1235
|
+
|
|
1236
|
+
Intlayer use module augmentation to get benefits of TypeScript and make your codebase stronger.
|
|
1237
|
+
|
|
1238
|
+

|
|
1239
|
+
|
|
1240
|
+

|
|
1241
|
+
|
|
1242
|
+
Ensure your TypeScript configuration includes the autogenerated types.
|
|
1243
|
+
|
|
1244
|
+
```json5 fileName="tsconfig.json"
|
|
1245
|
+
{
|
|
1246
|
+
// ... Your existing TypeScript configurations
|
|
1247
|
+
"include": [
|
|
1248
|
+
// ... Your existing TypeScript configurations
|
|
1249
|
+
".intlayer/**/*.ts", // Include the auto-generated types
|
|
1250
|
+
],
|
|
1251
|
+
}
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
### Git Configuration
|
|
1255
|
+
|
|
1256
|
+
It is recommended to ignore the files generated by Intlayer. This allows you to avoid committing them to your Git repository.
|
|
1257
|
+
|
|
1258
|
+
To do this, you can add the following instructions to your `.gitignore` file:
|
|
1259
|
+
|
|
1260
|
+
```plaintext fileName=".gitignore"
|
|
1261
|
+
# Ignore the files generated by Intlayer
|
|
1262
|
+
.intlayer
|
|
1263
|
+
```
|
|
1264
|
+
|
|
1265
|
+
### Go Further
|
|
1266
|
+
|
|
1267
|
+
To go further, you can implement the [visual editor](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_visual_editor.md) or externalise your content using the [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/en-GB/intlayer_CMS.md).
|