@intlayer/docs 5.5.11 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/intlayer_with_next-intl.md +0 -1
- package/blog/ar/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/ar/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/ar/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/ar/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/ar/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/ar/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/ar/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/ar/what_is_internationalization.md +2 -2
- package/blog/de/intlayer_with_next-intl.md +0 -1
- package/blog/de/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/de/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/de/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/de/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/de/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/de/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/de/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/de/what_is_internationalization.md +2 -2
- package/blog/en/intlayer_with_next-intl.md +0 -1
- package/blog/en/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/en/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/en/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/en/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/en/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/en/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/en/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/en/what_is_internationalization.md +2 -2
- package/blog/en-GB/intlayer_with_next-intl.md +0 -1
- package/blog/en-GB/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/en-GB/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/en-GB/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/en-GB/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/en-GB/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/en-GB/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/en-GB/what_is_internationalization.md +2 -2
- package/blog/es/intlayer_with_next-intl.md +0 -1
- package/blog/es/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/es/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/es/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/es/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/es/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/es/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/es/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/es/what_is_internationalization.md +2 -2
- package/blog/fr/intlayer_with_next-intl.md +0 -1
- package/blog/fr/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/fr/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/fr/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/fr/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/fr/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/fr/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/fr/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/fr/what_is_internationalization.md +2 -2
- package/blog/hi/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/hi/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/hi/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/hi/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/hi/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/hi/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/hi/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/hi/what_is_internationalization.md +2 -2
- package/blog/it/intlayer_with_next-intl.md +0 -1
- package/blog/it/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/it/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/it/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/it/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/it/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/it/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/it/what_is_internationalization.md +2 -2
- package/blog/ja/intlayer_with_next-intl.md +0 -1
- package/blog/ja/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/ja/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/ja/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/ja/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/ja/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/ja/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/ja/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/ja/what_is_internationalization.md +2 -2
- package/blog/ko/intlayer_with_next-intl.md +0 -1
- package/blog/ko/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/ko/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/ko/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/ko/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/ko/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/pt/intlayer_with_next-intl.md +0 -1
- package/blog/pt/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/pt/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/pt/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/pt/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/pt/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/pt/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/pt/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/pt/what_is_internationalization.md +2 -2
- package/blog/ru/intlayer_with_next-intl.md +0 -1
- package/blog/ru/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/ru/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/ru/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/ru/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/ru/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/ru/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/ru/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/ru/what_is_internationalization.md +2 -2
- package/blog/zh/intlayer_with_next-intl.md +0 -1
- package/blog/zh/list_i18n_technologies/CMS/wordpress.md +1 -1
- package/blog/zh/list_i18n_technologies/frameworks/angular.md +1 -1
- package/blog/zh/list_i18n_technologies/frameworks/flutter.md +1 -1
- package/blog/zh/list_i18n_technologies/frameworks/react-native.md +1 -1
- package/blog/zh/list_i18n_technologies/frameworks/react.md +1 -1
- package/blog/zh/list_i18n_technologies/frameworks/svelte.md +1 -1
- package/blog/zh/list_i18n_technologies/frameworks/vue.md +1 -1
- package/blog/zh/what_is_internationalization.md +2 -2
- package/dist/cjs/blog.cjs +2 -2
- package/dist/cjs/blog.cjs.map +1 -1
- package/dist/cjs/common.cjs +17 -6
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/doc.cjs +2 -2
- package/dist/cjs/doc.cjs.map +1 -1
- package/dist/cjs/frequentQuestions.cjs +2 -2
- package/dist/cjs/frequentQuestions.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +1152 -252
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +3778 -1124
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +794 -161
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +32 -31
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/cjs/legal.cjs +2 -2
- package/dist/cjs/legal.cjs.map +1 -1
- package/dist/esm/blog.mjs +2 -2
- package/dist/esm/blog.mjs.map +1 -1
- package/dist/esm/common.mjs +17 -6
- package/dist/esm/common.mjs.map +1 -1
- package/dist/esm/doc.mjs +2 -2
- package/dist/esm/doc.mjs.map +1 -1
- package/dist/esm/frequentQuestions.mjs +2 -2
- package/dist/esm/frequentQuestions.mjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +1151 -252
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +3777 -1124
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +793 -161
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +31 -31
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/esm/legal.mjs +2 -2
- package/dist/esm/legal.mjs.map +1 -1
- package/dist/types/blog.d.ts +2 -2
- package/dist/types/blog.d.ts.map +1 -1
- package/dist/types/common.d.ts +5 -2
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/doc.d.ts +2 -2
- package/dist/types/doc.d.ts.map +1 -1
- package/dist/types/frequentQuestions.d.ts +2 -2
- package/dist/types/frequentQuestions.d.ts.map +1 -1
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts +1 -0
- package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
- package/dist/types/generated/legal.entry.d.ts.map +1 -1
- package/dist/types/legal.d.ts +2 -2
- package/dist/types/legal.d.ts.map +1 -1
- package/docs/ar/intlayer_CMS.md +1 -0
- package/docs/ar/intlayer_cli.md +292 -177
- package/docs/ar/intlayer_visual_editor.md +1 -0
- package/docs/ar/intlayer_with_angular.md +1 -0
- package/docs/ar/intlayer_with_create_react_app.md +1 -0
- package/docs/ar/intlayer_with_lynx+react.md +1 -0
- package/docs/ar/intlayer_with_nextjs_14.md +1 -0
- package/docs/ar/intlayer_with_nextjs_15.md +3 -1
- package/docs/ar/intlayer_with_nuxt.md +1 -0
- package/docs/ar/intlayer_with_react_native+expo.md +1 -0
- package/docs/ar/intlayer_with_vite+preact.md +4 -3
- package/docs/ar/intlayer_with_vite+react.md +108 -112
- package/docs/ar/intlayer_with_vite+solid.md +4 -3
- package/docs/ar/intlayer_with_vite+svelte.md +4 -3
- package/docs/ar/intlayer_with_vite+vue.md +5 -4
- package/docs/ar/mcp_server.md +126 -92
- package/docs/de/intlayer_CMS.md +1 -0
- package/docs/de/intlayer_cli.md +291 -171
- package/docs/de/intlayer_visual_editor.md +1 -0
- package/docs/de/intlayer_with_angular.md +1 -0
- package/docs/de/intlayer_with_create_react_app.md +1 -0
- package/docs/de/intlayer_with_lynx+react.md +1 -0
- package/docs/de/intlayer_with_nextjs_14.md +1 -0
- package/docs/de/intlayer_with_nextjs_15.md +3 -1
- package/docs/de/intlayer_with_nuxt.md +1 -0
- package/docs/de/intlayer_with_react_native+expo.md +1 -0
- package/docs/de/intlayer_with_vite+preact.md +4 -3
- package/docs/de/intlayer_with_vite+react.md +128 -146
- package/docs/de/intlayer_with_vite+solid.md +4 -3
- package/docs/de/intlayer_with_vite+svelte.md +4 -3
- package/docs/de/intlayer_with_vite+vue.md +5 -4
- package/docs/de/mcp_server.md +116 -112
- package/docs/en/CI_CD.md +3 -1
- package/docs/en/autoFill.md +3 -1
- package/docs/en/configuration.md +7 -3
- package/docs/en/dictionary/condition.md +3 -1
- package/docs/en/dictionary/content_extention_customization.md +3 -1
- package/docs/en/dictionary/enumeration.md +3 -1
- package/docs/en/dictionary/file.md +3 -1
- package/docs/en/dictionary/function_fetching.md +3 -1
- package/docs/en/dictionary/get_started.md +3 -1
- package/docs/en/dictionary/insertion.md +3 -1
- package/docs/en/dictionary/markdown.md +3 -1
- package/docs/en/dictionary/nesting.md +3 -1
- package/docs/en/dictionary/translation.md +3 -1
- package/docs/en/how_works_intlayer.md +3 -1
- package/docs/en/index.md +3 -1
- package/docs/en/interest_of_intlayer.md +3 -1
- package/docs/en/intlayer_CMS.md +4 -1
- package/docs/en/intlayer_cli.md +246 -136
- package/docs/en/intlayer_visual_editor.md +4 -1
- package/docs/en/intlayer_with_angular.md +4 -1
- package/docs/en/intlayer_with_create_react_app.md +4 -1
- package/docs/en/intlayer_with_express.md +3 -1
- package/docs/en/intlayer_with_lynx+react.md +4 -1
- package/docs/en/intlayer_with_nextjs_14.md +7 -1
- package/docs/en/intlayer_with_nextjs_15.md +8 -2
- package/docs/en/intlayer_with_nextjs_page_router.md +5 -1
- package/docs/en/intlayer_with_nuxt.md +4 -1
- package/docs/en/intlayer_with_react_native+expo.md +4 -1
- package/docs/en/intlayer_with_vite+preact.md +9 -4
- package/docs/en/intlayer_with_vite+react.md +18 -10
- package/docs/en/intlayer_with_vite+solid.md +7 -4
- package/docs/en/intlayer_with_vite+svelte.md +7 -4
- package/docs/en/intlayer_with_vite+vue.md +10 -5
- package/docs/en/introduction.md +3 -1
- package/docs/en/mcp_server.md +114 -80
- package/docs/en/packages/@intlayer/api/index.md +3 -1
- package/docs/en/packages/@intlayer/chokidar/index.md +3 -1
- package/docs/en/packages/@intlayer/cli/index.md +3 -1
- package/docs/en/packages/@intlayer/config/index.md +3 -1
- package/docs/en/packages/@intlayer/core/index.md +3 -1
- package/docs/en/packages/@intlayer/design-system/index.md +3 -1
- package/docs/en/packages/@intlayer/dictionary-entry/index.md +3 -1
- package/docs/en/packages/@intlayer/editor/index.md +3 -1
- package/docs/en/packages/@intlayer/editor-react/index.md +3 -1
- package/docs/en/packages/@intlayer/webpack/index.md +3 -1
- package/docs/en/packages/angular-intlayer/index.md +3 -1
- package/docs/en/packages/express-intlayer/index.md +3 -1
- package/docs/en/packages/express-intlayer/t.md +3 -1
- package/docs/en/packages/intlayer/getConfiguration.md +3 -1
- package/docs/en/packages/intlayer/getEnumeration.md +3 -1
- package/docs/en/packages/intlayer/getHTMLTextDir.md +3 -1
- package/docs/en/packages/intlayer/getLocaleLang.md +3 -1
- package/docs/en/packages/intlayer/getLocaleName.md +3 -1
- package/docs/en/packages/intlayer/getLocalizedUrl.md +3 -1
- package/docs/en/packages/intlayer/getMultilingualUrls.md +3 -1
- package/docs/en/packages/intlayer/getPathWithoutLocale.md +3 -1
- package/docs/en/packages/intlayer/getTranslation.md +3 -1
- package/docs/en/packages/intlayer/getTranslationContent.md +3 -1
- package/docs/en/packages/intlayer/index.md +3 -1
- package/docs/en/packages/intlayer-cli/index.md +3 -1
- package/docs/en/packages/intlayer-editor/index.md +3 -1
- package/docs/en/packages/lynx-intlayer/index.md +3 -1
- package/docs/en/packages/next-intlayer/index.md +3 -1
- package/docs/en/packages/next-intlayer/t.md +3 -1
- package/docs/en/packages/next-intlayer/useDictionary.md +3 -1
- package/docs/en/packages/next-intlayer/useIntlayer.md +3 -1
- package/docs/en/packages/next-intlayer/useIntlayerAsync.md +3 -1
- package/docs/en/packages/next-intlayer/useLocale.md +3 -1
- package/docs/en/packages/nuxt-intlayer/index.md +3 -1
- package/docs/en/packages/preact-intlayer/index.md +3 -1
- package/docs/en/packages/react-intlayer/index.md +3 -1
- package/docs/en/packages/react-intlayer/t.md +3 -1
- package/docs/en/packages/react-intlayer/useDictionary.md +3 -1
- package/docs/en/packages/react-intlayer/useIntlayer.md +3 -1
- package/docs/en/packages/react-intlayer/useIntlayerAsync.md +3 -1
- package/docs/en/packages/react-intlayer/useLocale.md +3 -1
- package/docs/en/packages/react-native-intlayer/index.md +3 -1
- package/docs/en/packages/react-scripts-intlayer/index.md +3 -1
- package/docs/en/packages/solid-intlayer/index.md +3 -1
- package/docs/en/packages/svelte-intlayer/index.md +3 -1
- package/docs/en/packages/vite-intlayer/index.md +3 -1
- package/docs/en/packages/vue-intlayer/index.md +3 -1
- package/docs/en/per_locale_file.md +3 -1
- package/docs/en/roadmap.md +5 -2
- package/docs/en/vs_code_extension.md +3 -1
- package/docs/en-GB/intlayer_CMS.md +1 -0
- package/docs/en-GB/intlayer_cli.md +257 -138
- package/docs/en-GB/intlayer_visual_editor.md +1 -0
- package/docs/en-GB/intlayer_with_angular.md +1 -0
- package/docs/en-GB/intlayer_with_create_react_app.md +1 -0
- package/docs/en-GB/intlayer_with_lynx+react.md +1 -0
- package/docs/en-GB/intlayer_with_nextjs_14.md +1 -0
- package/docs/en-GB/intlayer_with_nextjs_15.md +3 -1
- package/docs/en-GB/intlayer_with_nuxt.md +1 -0
- package/docs/en-GB/intlayer_with_react_native+expo.md +1 -0
- package/docs/en-GB/intlayer_with_vite+preact.md +4 -3
- package/docs/en-GB/intlayer_with_vite+react.md +71 -87
- package/docs/en-GB/intlayer_with_vite+solid.md +4 -3
- package/docs/en-GB/intlayer_with_vite+svelte.md +4 -3
- package/docs/en-GB/intlayer_with_vite+vue.md +5 -4
- package/docs/en-GB/mcp_server.md +116 -82
- package/docs/es/intlayer_CMS.md +1 -0
- package/docs/es/intlayer_cli.md +283 -164
- package/docs/es/intlayer_visual_editor.md +1 -0
- package/docs/es/intlayer_with_angular.md +1 -0
- package/docs/es/intlayer_with_create_react_app.md +1 -0
- package/docs/es/intlayer_with_lynx+react.md +1 -0
- package/docs/es/intlayer_with_nextjs_14.md +1 -0
- package/docs/es/intlayer_with_nextjs_15.md +3 -1
- package/docs/es/intlayer_with_nuxt.md +1 -0
- package/docs/es/intlayer_with_react_native+expo.md +1 -0
- package/docs/es/intlayer_with_vite+preact.md +4 -3
- package/docs/es/intlayer_with_vite+react.md +98 -98
- package/docs/es/intlayer_with_vite+solid.md +4 -3
- package/docs/es/intlayer_with_vite+svelte.md +4 -3
- package/docs/es/intlayer_with_vite+vue.md +5 -4
- package/docs/es/mcp_server.md +120 -86
- package/docs/es/vs_code_extension.md +1 -0
- package/docs/fr/intlayer_CMS.md +1 -0
- package/docs/fr/intlayer_cli.md +280 -184
- package/docs/fr/intlayer_visual_editor.md +1 -0
- package/docs/fr/intlayer_with_angular.md +1 -0
- package/docs/fr/intlayer_with_create_react_app.md +1 -0
- package/docs/fr/intlayer_with_lynx+react.md +1 -0
- package/docs/fr/intlayer_with_nextjs_14.md +1 -0
- package/docs/fr/intlayer_with_nextjs_15.md +3 -1
- package/docs/fr/intlayer_with_nuxt.md +1 -0
- package/docs/fr/intlayer_with_react_native+expo.md +1 -0
- package/docs/fr/intlayer_with_vite+preact.md +5 -4
- package/docs/fr/intlayer_with_vite+react.md +80 -69
- package/docs/fr/intlayer_with_vite+solid.md +4 -3
- package/docs/fr/intlayer_with_vite+svelte.md +4 -3
- package/docs/fr/intlayer_with_vite+vue.md +5 -4
- package/docs/fr/mcp_server.md +121 -87
- package/docs/hi/intlayer_CMS.md +1 -0
- package/docs/hi/intlayer_cli.md +295 -174
- package/docs/hi/intlayer_visual_editor.md +1 -0
- package/docs/hi/intlayer_with_angular.md +1 -0
- package/docs/hi/intlayer_with_create_react_app.md +1 -0
- package/docs/hi/intlayer_with_lynx+react.md +1 -0
- package/docs/hi/intlayer_with_nextjs_14.md +1 -0
- package/docs/hi/intlayer_with_nextjs_15.md +3 -1
- package/docs/hi/intlayer_with_nuxt.md +1 -0
- package/docs/hi/intlayer_with_react_native+expo.md +1 -0
- package/docs/hi/intlayer_with_vite+preact.md +4 -3
- package/docs/hi/intlayer_with_vite+react.md +114 -111
- package/docs/hi/intlayer_with_vite+solid.md +4 -3
- package/docs/hi/intlayer_with_vite+svelte.md +4 -3
- package/docs/hi/intlayer_with_vite+vue.md +5 -4
- package/docs/hi/mcp_server.md +118 -84
- package/docs/it/intlayer_CMS.md +1 -0
- package/docs/it/intlayer_cli.md +282 -167
- package/docs/it/intlayer_visual_editor.md +1 -0
- package/docs/it/intlayer_with_angular.md +1 -0
- package/docs/it/intlayer_with_create_react_app.md +1 -0
- package/docs/it/intlayer_with_lynx+react.md +1 -0
- package/docs/it/intlayer_with_nextjs_14.md +1 -0
- package/docs/it/intlayer_with_nextjs_15.md +3 -1
- package/docs/it/intlayer_with_nuxt.md +1 -0
- package/docs/it/intlayer_with_react_native+expo.md +1 -0
- package/docs/it/intlayer_with_vite+preact.md +4 -3
- package/docs/it/intlayer_with_vite+react.md +163 -116
- package/docs/it/intlayer_with_vite+solid.md +4 -3
- package/docs/it/intlayer_with_vite+svelte.md +4 -3
- package/docs/it/intlayer_with_vite+vue.md +4 -4
- package/docs/it/mcp_server.md +120 -86
- package/docs/ja/intlayer_CMS.md +1 -0
- package/docs/ja/intlayer_cli.md +285 -168
- package/docs/ja/intlayer_visual_editor.md +1 -0
- package/docs/ja/intlayer_with_angular.md +1 -0
- package/docs/ja/intlayer_with_create_react_app.md +1 -0
- package/docs/ja/intlayer_with_lynx+react.md +1 -0
- package/docs/ja/intlayer_with_nextjs_14.md +1 -0
- package/docs/ja/intlayer_with_nextjs_15.md +3 -1
- package/docs/ja/intlayer_with_nuxt.md +1 -0
- package/docs/ja/intlayer_with_react_native+expo.md +1 -0
- package/docs/ja/intlayer_with_vite+preact.md +4 -3
- package/docs/ja/intlayer_with_vite+react.md +160 -222
- package/docs/ja/intlayer_with_vite+solid.md +4 -3
- package/docs/ja/intlayer_with_vite+svelte.md +4 -3
- package/docs/ja/intlayer_with_vite+vue.md +5 -4
- package/docs/ja/mcp_server.md +121 -85
- package/docs/ko/intlayer_CMS.md +1 -0
- package/docs/ko/intlayer_cli.md +291 -175
- package/docs/ko/intlayer_visual_editor.md +1 -0
- package/docs/ko/intlayer_with_angular.md +1 -0
- package/docs/ko/intlayer_with_create_react_app.md +1 -0
- package/docs/ko/intlayer_with_lynx+react.md +1 -0
- package/docs/ko/intlayer_with_nextjs_14.md +1 -0
- package/docs/ko/intlayer_with_nextjs_15.md +3 -1
- package/docs/ko/intlayer_with_nuxt.md +1 -0
- package/docs/ko/intlayer_with_react_native+expo.md +1 -0
- package/docs/ko/intlayer_with_vite+preact.md +4 -3
- package/docs/ko/intlayer_with_vite+react.md +123 -152
- package/docs/ko/intlayer_with_vite+solid.md +4 -3
- package/docs/ko/intlayer_with_vite+svelte.md +4 -3
- package/docs/ko/intlayer_with_vite+vue.md +5 -4
- package/docs/ko/mcp_server.md +117 -83
- package/docs/ko/packages/intlayer/getLocalizedUrl.md +1 -23
- package/docs/pt/intlayer_CMS.md +1 -0
- package/docs/pt/intlayer_cli.md +274 -154
- package/docs/pt/intlayer_visual_editor.md +1 -0
- package/docs/pt/intlayer_with_angular.md +1 -0
- package/docs/pt/intlayer_with_create_react_app.md +1 -0
- package/docs/pt/intlayer_with_lynx+react.md +1 -0
- package/docs/pt/intlayer_with_nextjs_14.md +1 -0
- package/docs/pt/intlayer_with_nextjs_15.md +3 -1
- package/docs/pt/intlayer_with_nuxt.md +1 -0
- package/docs/pt/intlayer_with_react_native+expo.md +1 -0
- package/docs/pt/intlayer_with_vite+preact.md +4 -3
- package/docs/pt/intlayer_with_vite+react.md +117 -136
- package/docs/pt/intlayer_with_vite+solid.md +4 -3
- package/docs/pt/intlayer_with_vite+svelte.md +4 -3
- package/docs/pt/intlayer_with_vite+vue.md +4 -4
- package/docs/pt/mcp_server.md +121 -87
- package/docs/ru/intlayer_CMS.md +1 -0
- package/docs/ru/intlayer_cli.md +287 -170
- package/docs/ru/intlayer_visual_editor.md +1 -0
- package/docs/ru/intlayer_with_angular.md +1 -0
- package/docs/ru/intlayer_with_create_react_app.md +1 -0
- package/docs/ru/intlayer_with_lynx+react.md +1 -0
- package/docs/ru/intlayer_with_nextjs_14.md +1 -0
- package/docs/ru/intlayer_with_nextjs_15.md +3 -1
- package/docs/ru/intlayer_with_nuxt.md +1 -0
- package/docs/ru/intlayer_with_react_native+expo.md +1 -0
- package/docs/ru/intlayer_with_vite+preact.md +4 -3
- package/docs/ru/intlayer_with_vite+react.md +105 -87
- package/docs/ru/intlayer_with_vite+solid.md +4 -3
- package/docs/ru/intlayer_with_vite+svelte.md +4 -3
- package/docs/ru/intlayer_with_vite+vue.md +5 -4
- package/docs/ru/mcp_server.md +119 -85
- package/docs/zh/intlayer_CMS.md +1 -0
- package/docs/zh/intlayer_cli.md +275 -155
- package/docs/zh/intlayer_visual_editor.md +1 -0
- package/docs/zh/intlayer_with_angular.md +1 -0
- package/docs/zh/intlayer_with_create_react_app.md +1 -0
- package/docs/zh/intlayer_with_lynx+react.md +1 -0
- package/docs/zh/intlayer_with_nextjs_14.md +1 -0
- package/docs/zh/intlayer_with_nextjs_15.md +3 -1
- package/docs/zh/intlayer_with_nuxt.md +1 -0
- package/docs/zh/intlayer_with_react_native+expo.md +1 -0
- package/docs/zh/intlayer_with_vite+preact.md +4 -3
- package/docs/zh/intlayer_with_vite+react.md +154 -188
- package/docs/zh/intlayer_with_vite+solid.md +4 -3
- package/docs/zh/intlayer_with_vite+svelte.md +4 -3
- package/docs/zh/intlayer_with_vite+vue.md +5 -4
- package/docs/zh/mcp_server.md +119 -86
- package/docs/zh/packages/intlayer/getLocalizedUrl.md +1 -23
- package/frequent_questions/ar/build_error_CI_CD.md +75 -0
- package/frequent_questions/de/build_error_CI_CD.md +75 -0
- package/frequent_questions/en/build_error_CI_CD.md +75 -0
- package/frequent_questions/en-GB/build_error_CI_CD.md +75 -0
- package/frequent_questions/es/build_error_CI_CD.md +75 -0
- package/frequent_questions/fr/build_error_CI_CD.md +75 -0
- package/frequent_questions/hi/build_error_CI_CD.md +75 -0
- package/frequent_questions/it/build_error_CI_CD.md +75 -0
- package/frequent_questions/ja/build_error_CI_CD.md +75 -0
- package/frequent_questions/ja/intlayer_command_undefined.md +3 -3
- package/frequent_questions/ko/build_error_CI_CD.md +75 -0
- package/frequent_questions/ko/intlayer_command_undefined.md +3 -3
- package/frequent_questions/pt/build_error_CI_CD.md +75 -0
- package/frequent_questions/ru/build_error_CI_CD.md +75 -0
- package/frequent_questions/zh/build_error_CI_CD.md +75 -0
- package/frequent_questions/zh/intlayer_command_undefined.md +3 -3
- package/legal/ar/privacy_notice.md +83 -0
- package/legal/ar/terms_of_service.md +55 -0
- package/legal/de/privacy_notice.md +83 -0
- package/legal/de/terms_of_service.md +55 -0
- package/legal/en/privacy_notice.md +83 -0
- package/legal/en/terms_of_service.md +55 -0
- package/legal/en-GB/privacy_notice.md +83 -0
- package/legal/en-GB/terms_of_service.md +55 -0
- package/legal/es/privacy_notice.md +83 -0
- package/legal/es/terms_of_service.md +55 -0
- package/legal/fr/privacy_notice.md +83 -0
- package/legal/fr/terms_of_service.md +55 -0
- package/legal/hi/privacy_notice.md +83 -0
- package/legal/hi/terms_of_service.md +55 -0
- package/legal/it/privacy_notice.md +83 -0
- package/legal/it/terms_of_service.md +55 -0
- package/legal/ja/privacy_notice.md +83 -0
- package/legal/ja/terms_of_service.md +55 -0
- package/legal/ko/privacy_notice.md +83 -0
- package/legal/ko/terms_of_service.md +55 -0
- package/legal/pt/privacy_notice.md +83 -0
- package/legal/pt/terms_of_service.md +55 -0
- package/legal/ru/privacy_notice.md +83 -0
- package/legal/ru/terms_of_service.md +55 -0
- package/legal/zh/privacy_notice.md +83 -0
- package/legal/zh/terms_of_service.md +55 -0
- package/package.json +12 -11
- package/src/blog.ts +6 -4
- package/src/common.ts +25 -7
- package/src/doc.ts +6 -4
- package/src/frequentQuestions.ts +6 -4
- package/src/generated/blog.entry.ts +1177 -280
- package/src/generated/docs.entry.ts +3868 -1217
- package/src/generated/frequentQuestions.entry.ts +808 -178
- package/src/generated/legal.entry.ts +34 -36
- package/src/legal.ts +6 -4
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
createdAt:
|
|
3
|
-
updatedAt:
|
|
4
|
-
title:
|
|
5
|
-
description: Scopri come
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2024-03-07
|
|
4
|
+
title: Iniziare con Intlayer in Vite + React
|
|
5
|
+
description: Scopri come aggiungere l'internazionalizzazione (i18n) alla tua applicazione Vite e React utilizzando Intlayer. Segui questa guida per rendere la tua app multilingue.
|
|
6
6
|
keywords:
|
|
7
7
|
- Internazionalizzazione
|
|
8
8
|
- Documentazione
|
|
9
9
|
- Intlayer
|
|
10
10
|
- Vite
|
|
11
11
|
- React
|
|
12
|
-
-
|
|
12
|
+
- i18n
|
|
13
13
|
- JavaScript
|
|
14
14
|
slugs:
|
|
15
15
|
- doc
|
|
16
16
|
- environment
|
|
17
|
-
-
|
|
18
|
-
|
|
17
|
+
- vite-and-react
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
19
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4---
|
|
20
|
+
|
|
21
|
+
# Iniziare con l'internazionalizzazione (i18n) con Intlayer, Vite e React
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
<iframe title="The best i18n solution for Vite and React? Discover Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?si=VaKmrYMmXjo3xpk2"/>
|
|
21
24
|
|
|
22
25
|
Consulta il [Template dell'Applicazione](https://github.com/aymericzip/intlayer-vite-react-template) su GitHub.
|
|
23
26
|
|
|
@@ -27,10 +30,10 @@ Consulta il [Template dell'Applicazione](https://github.com/aymericzip/intlayer-
|
|
|
27
30
|
|
|
28
31
|
Con Intlayer, puoi:
|
|
29
32
|
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
33
|
+
- **Gestisci facilmente le traduzioni** utilizzando dizionari dichiarativi a livello di componente.
|
|
34
|
+
- **Localizza dinamicamente i metadata**, le rotte e i contenuti.
|
|
35
|
+
- **Garantisci il supporto a TypeScript** con tipi autogenerati, migliorando l'autocompletamento e il rilevamento degli errori.
|
|
36
|
+
- **Approfitta di funzionalità avanzate**, come il rilevamento e il cambio dinamico della lingua.
|
|
34
37
|
|
|
35
38
|
---
|
|
36
39
|
|
|
@@ -42,17 +45,17 @@ Installa i pacchetti necessari usando npm:
|
|
|
42
45
|
|
|
43
46
|
```bash packageManager="npm"
|
|
44
47
|
npm install intlayer react-intlayer
|
|
45
|
-
npm install --save-dev
|
|
48
|
+
npm install vite-intlayer --save-dev
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
```bash packageManager="pnpm"
|
|
49
52
|
pnpm add intlayer react-intlayer
|
|
50
|
-
pnpm add --save-dev
|
|
53
|
+
pnpm add vite-intlayer --save-dev
|
|
51
54
|
```
|
|
52
55
|
|
|
53
56
|
```bash packageManager="yarn"
|
|
54
57
|
yarn add intlayer react-intlayer
|
|
55
|
-
yarn add --save-dev
|
|
58
|
+
yarn add vite-intlayer --save-dev
|
|
56
59
|
```
|
|
57
60
|
|
|
58
61
|
- **intlayer**
|
|
@@ -60,14 +63,14 @@ yarn add --save-dev vite-intlayer
|
|
|
60
63
|
Il pacchetto principale che fornisce strumenti di internazionalizzazione per la gestione della configurazione, la traduzione, la [dichiarazione dei contenuti](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/dictionary/get_started.md), la traspilazione e i [comandi CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_cli.md).
|
|
61
64
|
|
|
62
65
|
- **react-intlayer**
|
|
63
|
-
Il pacchetto che integra Intlayer con
|
|
66
|
+
Il pacchetto che integra Intlayer con le applicazioni React. Fornisce provider di contesto e hook per l'internazionalizzazione in React.
|
|
64
67
|
|
|
65
68
|
- **vite-intlayer**
|
|
66
69
|
Include il plugin Vite per integrare Intlayer con il [bundler Vite](https://vite.dev/guide/why.html#why-bundle-for-production), oltre a middleware per rilevare la lingua preferita dall'utente, gestire i cookie e gestire il reindirizzamento degli URL.
|
|
67
70
|
|
|
68
71
|
### Passo 2: Configurazione del tuo progetto
|
|
69
72
|
|
|
70
|
-
Crea un file di configurazione per
|
|
73
|
+
Crea un file di configurazione per impostare le lingue della tua applicazione:
|
|
71
74
|
|
|
72
75
|
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
73
76
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
@@ -78,7 +81,7 @@ const config: IntlayerConfig = {
|
|
|
78
81
|
Locales.ENGLISH,
|
|
79
82
|
Locales.FRENCH,
|
|
80
83
|
Locales.SPANISH,
|
|
81
|
-
// Le tue altre
|
|
84
|
+
// Le tue altre localizzazioni
|
|
82
85
|
],
|
|
83
86
|
defaultLocale: Locales.ENGLISH,
|
|
84
87
|
},
|
|
@@ -91,14 +94,13 @@ export default config;
|
|
|
91
94
|
import { Locales } from "intlayer";
|
|
92
95
|
|
|
93
96
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
94
|
-
// Configurazione per Intlayer
|
|
95
97
|
const config = {
|
|
96
98
|
internationalization: {
|
|
97
99
|
locales: [
|
|
98
100
|
Locales.ENGLISH,
|
|
99
101
|
Locales.FRENCH,
|
|
100
102
|
Locales.SPANISH,
|
|
101
|
-
// Le tue altre
|
|
103
|
+
// Le tue altre localizzazioni
|
|
102
104
|
],
|
|
103
105
|
defaultLocale: Locales.ENGLISH,
|
|
104
106
|
},
|
|
@@ -111,14 +113,13 @@ export default config;
|
|
|
111
113
|
const { Locales } = require("intlayer");
|
|
112
114
|
|
|
113
115
|
/** @type {import('intlayer').IntlayerConfig} */
|
|
114
|
-
// Configurazione per Intlayer
|
|
115
116
|
const config = {
|
|
116
117
|
internationalization: {
|
|
117
118
|
locales: [
|
|
118
119
|
Locales.ENGLISH,
|
|
119
120
|
Locales.FRENCH,
|
|
120
121
|
Locales.SPANISH,
|
|
121
|
-
// Le tue altre
|
|
122
|
+
// Le tue altre localizzazioni
|
|
122
123
|
],
|
|
123
124
|
defaultLocale: Locales.ENGLISH,
|
|
124
125
|
},
|
|
@@ -166,9 +167,9 @@ module.exports = defineConfig({
|
|
|
166
167
|
});
|
|
167
168
|
```
|
|
168
169
|
|
|
169
|
-
> Il plugin Vite `intlayerPlugin()` viene utilizzato per integrare Intlayer con Vite. Garantisce la creazione dei file di dichiarazione
|
|
170
|
+
> Il plugin Vite `intlayerPlugin()` viene utilizzato per integrare Intlayer con Vite. Garantisce la creazione dei file di dichiarazione del contenuto e li monitora in modalità sviluppo. Definisce le variabili d'ambiente di Intlayer all'interno dell'applicazione Vite. Inoltre, fornisce alias per ottimizzare le prestazioni.
|
|
170
171
|
|
|
171
|
-
### Passo 4: Dichiara
|
|
172
|
+
### Passo 4: Dichiara il Tuo Contenuto
|
|
172
173
|
|
|
173
174
|
Crea e gestisci le tue dichiarazioni di contenuto per memorizzare le traduzioni:
|
|
174
175
|
|
|
@@ -260,7 +261,7 @@ const appContent = {
|
|
|
260
261
|
// Non dimenticare di importare React se usi un nodo React nel tuo contenuto
|
|
261
262
|
en: (
|
|
262
263
|
<>
|
|
263
|
-
|
|
264
|
+
Edit <code>src/App.tsx</code> e salva per testare HMR
|
|
264
265
|
</>
|
|
265
266
|
),
|
|
266
267
|
fr: (
|
|
@@ -276,7 +277,7 @@ const appContent = {
|
|
|
276
277
|
},
|
|
277
278
|
|
|
278
279
|
readTheDocs: t({
|
|
279
|
-
en: "
|
|
280
|
+
en: "Clicca sui loghi di Vite e React per saperne di più",
|
|
280
281
|
fr: "Cliquez sur les logos Vite et React pour en savoir plus",
|
|
281
282
|
es: "Haga clic en los logotipos de Vite y React para obtener más información",
|
|
282
283
|
}),
|
|
@@ -297,13 +298,11 @@ const appContent = {
|
|
|
297
298
|
en: "Vite logo",
|
|
298
299
|
fr: "Logo Vite",
|
|
299
300
|
es: "Logo Vite",
|
|
300
|
-
it: "Logo Vite",
|
|
301
301
|
}),
|
|
302
302
|
reactLogo: t({
|
|
303
303
|
en: "React logo",
|
|
304
304
|
fr: "Logo React",
|
|
305
305
|
es: "Logo React",
|
|
306
|
-
it: "Logo React",
|
|
307
306
|
}),
|
|
308
307
|
|
|
309
308
|
title: "Vite + React",
|
|
@@ -312,7 +311,6 @@ const appContent = {
|
|
|
312
311
|
en: "count is ",
|
|
313
312
|
fr: "le compte est ",
|
|
314
313
|
es: "el recuento es ",
|
|
315
|
-
it: "il conteggio è ",
|
|
316
314
|
}),
|
|
317
315
|
|
|
318
316
|
edit:
|
|
@@ -322,7 +320,7 @@ const appContent = {
|
|
|
322
320
|
// Non dimenticare di importare React se usi un nodo React nel tuo contenuto
|
|
323
321
|
en: (
|
|
324
322
|
<>
|
|
325
|
-
Edit <code>src/App.tsx</code>
|
|
323
|
+
Edit <code>src/App.tsx</code> e salva per testare HMR
|
|
326
324
|
</>
|
|
327
325
|
),
|
|
328
326
|
fr: (
|
|
@@ -332,7 +330,7 @@ const appContent = {
|
|
|
332
330
|
),
|
|
333
331
|
es: (
|
|
334
332
|
<>
|
|
335
|
-
|
|
333
|
+
Edita <code>src/App.tsx</code> e salva per testare HMR
|
|
336
334
|
</>
|
|
337
335
|
),
|
|
338
336
|
},
|
|
@@ -411,13 +409,13 @@ module.exports = appContent;
|
|
|
411
409
|
|
|
412
410
|
> Le tue dichiarazioni di contenuto possono essere definite ovunque nella tua applicazione non appena sono incluse nella directory `contentDir` (di default, `./src`). E devono corrispondere all'estensione del file di dichiarazione del contenuto (di default, `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
413
411
|
|
|
414
|
-
> Per maggiori dettagli, consulta la [documentazione
|
|
412
|
+
> Per maggiori dettagli, consulta la [documentazione sulle dichiarazioni di contenuto](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/dictionary/get_started.md).
|
|
415
413
|
|
|
416
414
|
> Se il tuo file di contenuto include codice TSX, dovresti considerare di importare `import React from "react";` nel tuo file di contenuto.
|
|
417
415
|
|
|
418
416
|
### Passo 5: Utilizza Intlayer nel tuo Codice
|
|
419
417
|
|
|
420
|
-
Accedi ai tuoi dizionari di contenuti in tutta
|
|
418
|
+
Accedi ai tuoi dizionari di contenuti in tutta la tua applicazione:
|
|
421
419
|
|
|
422
420
|
```tsx {5,9} fileName="src/App.tsx" codeFormat="typescript"
|
|
423
421
|
import { useState, type FC } from "react";
|
|
@@ -457,7 +455,7 @@ const AppContent: FC = () => {
|
|
|
457
455
|
);
|
|
458
456
|
};
|
|
459
457
|
|
|
460
|
-
const App = () => (
|
|
458
|
+
const App: FC = () => (
|
|
461
459
|
<IntlayerProvider>
|
|
462
460
|
<AppContent />
|
|
463
461
|
</IntlayerProvider>
|
|
@@ -560,7 +558,7 @@ const App = () => (
|
|
|
560
558
|
module.exports = App;
|
|
561
559
|
```
|
|
562
560
|
|
|
563
|
-
> Se vuoi usare il tuo contenuto in un attributo
|
|
561
|
+
> Se vuoi usare il tuo contenuto in un attributo `string`, come `alt`, `title`, `href`, `aria-label`, ecc., devi chiamare il valore della funzione, come:
|
|
564
562
|
|
|
565
563
|
> ```jsx
|
|
566
564
|
> <img src={content.image.src.value} alt={content.image.value} />
|
|
@@ -582,7 +580,7 @@ const LocaleSwitcher: FC = () => {
|
|
|
582
580
|
|
|
583
581
|
return (
|
|
584
582
|
<button onClick={() => setLocale(Locales.English)}>
|
|
585
|
-
Cambia lingua in
|
|
583
|
+
Cambia lingua in Inglese
|
|
586
584
|
</button>
|
|
587
585
|
);
|
|
588
586
|
};
|
|
@@ -597,7 +595,7 @@ const LocaleSwitcher = () => {
|
|
|
597
595
|
|
|
598
596
|
return (
|
|
599
597
|
<button onClick={() => setLocale(Locales.English)}>
|
|
600
|
-
Cambia lingua in
|
|
598
|
+
Cambia lingua in Inglese
|
|
601
599
|
</button>
|
|
602
600
|
);
|
|
603
601
|
};
|
|
@@ -612,7 +610,7 @@ const LocaleSwitcher = () => {
|
|
|
612
610
|
|
|
613
611
|
return (
|
|
614
612
|
<button onClick={() => setLocale(Locales.English)}>
|
|
615
|
-
Cambia lingua in
|
|
613
|
+
Cambia lingua in Inglese
|
|
616
614
|
</button>
|
|
617
615
|
);
|
|
618
616
|
};
|
|
@@ -620,9 +618,9 @@ const LocaleSwitcher = () => {
|
|
|
620
618
|
|
|
621
619
|
> Per saperne di più sull'hook `useLocale`, consulta la [documentazione](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/packages/react-intlayer/useLocale.md).
|
|
622
620
|
|
|
623
|
-
### (Opzionale) Passo 7:
|
|
621
|
+
### (Opzionale) Passo 7: Aggiungere il routing localizzato alla tua applicazione
|
|
624
622
|
|
|
625
|
-
Lo scopo di questo passaggio è creare
|
|
623
|
+
Lo scopo di questo passaggio è creare rotte uniche per ogni lingua. Questo è utile per la SEO e per URL amichevoli per i motori di ricerca.
|
|
626
624
|
Esempio:
|
|
627
625
|
|
|
628
626
|
```plaintext
|
|
@@ -631,13 +629,13 @@ Esempio:
|
|
|
631
629
|
- https://example.com/fr/about
|
|
632
630
|
```
|
|
633
631
|
|
|
634
|
-
> Per impostazione predefinita,
|
|
632
|
+
> Per impostazione predefinita, i percorsi non sono prefissati per la lingua predefinita. Se desideri aggiungere un prefisso anche per la lingua predefinita, puoi impostare l'opzione `middleware.prefixDefault` su `true` nella tua configurazione. Consulta la [documentazione sulla configurazione](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/configuration.md) per maggiori informazioni.
|
|
635
633
|
|
|
636
634
|
Per aggiungere il routing localizzato alla tua applicazione, puoi creare un componente `LocaleRouter` che avvolge le rotte della tua applicazione e gestisce il routing basato sulla lingua. Ecco un esempio che utilizza [React Router](https://reactrouter.com/home):
|
|
637
635
|
|
|
638
636
|
```tsx fileName="src/components/LocaleRouter.tsx" codeFormat="typescript"
|
|
639
|
-
//
|
|
640
|
-
import { type Locales, configuration, getPathWithoutLocale } from "intlayer"; // Funzioni e tipi
|
|
637
|
+
// Importing necessary dependencies and functions
|
|
638
|
+
import { type Locales, configuration, getPathWithoutLocale } from "intlayer"; // Funzioni di utilità e tipi da 'intlayer'
|
|
641
639
|
import type { FC, PropsWithChildren } from "react"; // Tipi React per componenti funzionali e props
|
|
642
640
|
import { IntlayerProvider } from "react-intlayer"; // Provider per il contesto di internazionalizzazione
|
|
643
641
|
import {
|
|
@@ -654,7 +652,7 @@ const { locales, defaultLocale } = internationalization;
|
|
|
654
652
|
|
|
655
653
|
/**
|
|
656
654
|
* Un componente che gestisce la localizzazione e avvolge i figli con il contesto locale appropriato.
|
|
657
|
-
* Gestisce il rilevamento e la validazione della
|
|
655
|
+
* Gestisce il rilevamento e la validazione della lingua basata sull'URL.
|
|
658
656
|
*/
|
|
659
657
|
const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
660
658
|
children,
|
|
@@ -662,25 +660,25 @@ const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
|
662
660
|
}) => {
|
|
663
661
|
const { pathname, search } = useLocation(); // Ottieni il percorso URL corrente
|
|
664
662
|
|
|
665
|
-
// Determina la
|
|
663
|
+
// Determina la locale corrente, utilizzando quella di default se non fornita
|
|
666
664
|
const currentLocale = locale ?? defaultLocale;
|
|
667
665
|
|
|
668
|
-
//
|
|
666
|
+
// Rimuovi il prefisso della locale dal percorso per costruire un percorso base
|
|
669
667
|
const pathWithoutLocale = getPathWithoutLocale(
|
|
670
668
|
pathname // Percorso URL corrente
|
|
671
669
|
);
|
|
672
670
|
|
|
673
671
|
/**
|
|
674
|
-
* Se middleware.prefixDefault è true, la
|
|
672
|
+
* Se middleware.prefixDefault è true, la locale di default deve sempre essere prefissata.
|
|
675
673
|
*/
|
|
676
674
|
if (middleware.prefixDefault) {
|
|
677
|
-
// Valida la
|
|
675
|
+
// Valida la locale
|
|
678
676
|
if (!locale || !locales.includes(locale)) {
|
|
679
|
-
// Reindirizza alla
|
|
677
|
+
// Reindirizza alla locale di default con il percorso aggiornato
|
|
680
678
|
return (
|
|
681
679
|
<Navigate
|
|
682
680
|
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
683
|
-
replace // Sostituisce la voce corrente
|
|
681
|
+
replace // Sostituisce la voce corrente nella cronologia con quella nuova
|
|
684
682
|
/>
|
|
685
683
|
);
|
|
686
684
|
}
|
|
@@ -692,7 +690,7 @@ const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
|
692
690
|
} else {
|
|
693
691
|
/**
|
|
694
692
|
* Quando middleware.prefixDefault è falso, la locale predefinita non è prefissata.
|
|
695
|
-
*
|
|
693
|
+
* Assicurarsi che la locale corrente sia valida e non la locale predefinita.
|
|
696
694
|
*/
|
|
697
695
|
if (
|
|
698
696
|
currentLocale.toString() !== defaultLocale.toString() &&
|
|
@@ -700,13 +698,13 @@ const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
|
700
698
|
.filter(
|
|
701
699
|
(locale) => locale.toString() !== defaultLocale.toString() // Esclude la locale predefinita
|
|
702
700
|
)
|
|
703
|
-
.includes(currentLocale) // Controlla se la
|
|
701
|
+
.includes(currentLocale) // Controlla se la locale corrente è nella lista delle locale valide
|
|
704
702
|
) {
|
|
705
|
-
// Reindirizza al percorso senza prefisso della
|
|
703
|
+
// Reindirizza al percorso senza prefisso della locale
|
|
706
704
|
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
707
705
|
}
|
|
708
706
|
|
|
709
|
-
// Avvolge i figli con IntlayerProvider e imposta la
|
|
707
|
+
// Avvolge i figli con IntlayerProvider e imposta la locale corrente
|
|
710
708
|
return (
|
|
711
709
|
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
712
710
|
);
|
|
@@ -714,8 +712,8 @@ const AppLocalized: FC<PropsWithChildren<{ locale: Locales }>> = ({
|
|
|
714
712
|
};
|
|
715
713
|
|
|
716
714
|
/**
|
|
717
|
-
* Un componente router che configura le rotte specifiche per
|
|
718
|
-
* Usa React Router per gestire la navigazione e
|
|
715
|
+
* Un componente router che configura le rotte specifiche per la locale.
|
|
716
|
+
* Usa React Router per gestire la navigazione e renderizzare componenti localizzati.
|
|
719
717
|
*/
|
|
720
718
|
export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
721
719
|
<BrowserRouter>
|
|
@@ -734,7 +732,7 @@ export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
|
734
732
|
))}
|
|
735
733
|
|
|
736
734
|
{
|
|
737
|
-
// Se il prefisso per la locale predefinita è disabilitato, renderizza i figli direttamente
|
|
735
|
+
// Se il prefisso per la locale predefinita è disabilitato, renderizza i figli direttamente nel percorso root
|
|
738
736
|
!middleware.prefixDefault && (
|
|
739
737
|
<Route
|
|
740
738
|
path="*"
|
|
@@ -750,7 +748,7 @@ export const LocaleRouter: FC<PropsWithChildren> = ({ children }) => (
|
|
|
750
748
|
```
|
|
751
749
|
|
|
752
750
|
```jsx fileName="src/components/LocaleRouter.mjx" codeFormat="esm"
|
|
753
|
-
// Importazione delle dipendenze e
|
|
751
|
+
// Importazione delle dipendenze e funzioni necessarie
|
|
754
752
|
import { configuration, getPathWithoutLocale } from "intlayer"; // Funzioni e tipi di utilità da 'intlayer'
|
|
755
753
|
// Funzioni e tipi di utilità da 'intlayer'
|
|
756
754
|
import { IntlayerProvider } from "react-intlayer"; // Provider per il contesto di internazionalizzazione
|
|
@@ -760,19 +758,19 @@ import {
|
|
|
760
758
|
Route,
|
|
761
759
|
Navigate,
|
|
762
760
|
useLocation,
|
|
763
|
-
} from "react-router-dom"; // Componenti del router per
|
|
761
|
+
} from "react-router-dom"; // Componenti del router per la gestione della navigazione
|
|
764
762
|
|
|
765
763
|
// Destrutturazione della configurazione da Intlayer
|
|
766
764
|
const { internationalization, middleware } = configuration;
|
|
767
765
|
const { locales, defaultLocale } = internationalization;
|
|
768
766
|
|
|
769
767
|
/**
|
|
770
|
-
* Un componente che gestisce la localizzazione e avvolge i
|
|
768
|
+
* Un componente che gestisce la localizzazione e avvolge i figli con il contesto della locale appropriata.
|
|
771
769
|
/**
|
|
772
770
|
* Gestisce il rilevamento e la validazione della localizzazione basata sull'URL.
|
|
773
771
|
*/
|
|
774
772
|
const AppLocalized = ({ children, locale }) => {
|
|
775
|
-
const { pathname, search } = useLocation(); //
|
|
773
|
+
const { pathname, search } = useLocation(); // Ottiene il percorso URL corrente
|
|
776
774
|
|
|
777
775
|
// Determina la localizzazione corrente, utilizzando quella di default se non fornita
|
|
778
776
|
const currentLocale = locale ?? defaultLocale;
|
|
@@ -792,7 +790,7 @@ const AppLocalized = ({ children, locale }) => {
|
|
|
792
790
|
return (
|
|
793
791
|
<Navigate
|
|
794
792
|
to={`/${defaultLocale}/${pathWithoutLocale}${search}`}
|
|
795
|
-
replace // Sostituisce la voce corrente
|
|
793
|
+
replace // Sostituisce la voce corrente della cronologia con quella nuova
|
|
796
794
|
/>
|
|
797
795
|
);
|
|
798
796
|
}
|
|
@@ -803,8 +801,8 @@ const AppLocalized = ({ children, locale }) => {
|
|
|
803
801
|
);
|
|
804
802
|
} else {
|
|
805
803
|
/**
|
|
806
|
-
* Quando middleware.prefixDefault è
|
|
807
|
-
*
|
|
804
|
+
* Quando middleware.prefixDefault è false, la locale predefinita non è prefissata.
|
|
805
|
+
* Assicura che la locale corrente sia valida e non sia la locale predefinita.
|
|
808
806
|
*/
|
|
809
807
|
if (
|
|
810
808
|
currentLocale.toString() !== defaultLocale.toString() &&
|
|
@@ -826,7 +824,7 @@ const AppLocalized = ({ children, locale }) => {
|
|
|
826
824
|
};
|
|
827
825
|
|
|
828
826
|
/**
|
|
829
|
-
* Un componente router che configura le rotte specifiche per localizzazione.
|
|
827
|
+
* Un componente router che configura le rotte specifiche per la localizzazione.
|
|
830
828
|
* Utilizza React Router per gestire la navigazione e rendere i componenti localizzati.
|
|
831
829
|
*/
|
|
832
830
|
export const LocaleRouter = ({ children }) => (
|
|
@@ -838,7 +836,7 @@ export const LocaleRouter = ({ children }) => (
|
|
|
838
836
|
)
|
|
839
837
|
.map((locale) => (
|
|
840
838
|
<Route
|
|
841
|
-
//
|
|
839
|
+
// Modello di percorso per catturare la locale (es. /en/, /fr/) e abbinare tutti i percorsi successivi
|
|
842
840
|
path={`/${locale}/*`}
|
|
843
841
|
key={locale}
|
|
844
842
|
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Avvolge i figli con la gestione della locale
|
|
@@ -846,7 +844,7 @@ export const LocaleRouter = ({ children }) => (
|
|
|
846
844
|
))}
|
|
847
845
|
|
|
848
846
|
{
|
|
849
|
-
// Se il prefisso
|
|
847
|
+
// Se il prefisso per la locale predefinita è disabilitato, renderizza i figli direttamente al percorso root
|
|
850
848
|
!middleware.prefixDefault && (
|
|
851
849
|
<Route
|
|
852
850
|
path="*"
|
|
@@ -862,9 +860,24 @@ export const LocaleRouter = ({ children }) => (
|
|
|
862
860
|
```
|
|
863
861
|
|
|
864
862
|
```jsx fileName="src/components/LocaleRouter.cjx" codeFormat="commonjs"
|
|
863
|
+
// Importazione delle dipendenze e delle funzioni necessarie
|
|
864
|
+
const { configuration, getPathWithoutLocale } = require("intlayer"); // Funzioni e tipi di utilità da 'intlayer'
|
|
865
|
+
const { IntlayerProvider, useLocale } = require("react-intlayer"); // Provider per il contesto di internazionalizzazione
|
|
866
|
+
const {
|
|
867
|
+
BrowserRouter,
|
|
868
|
+
Routes,
|
|
869
|
+
Route,
|
|
870
|
+
Navigate,
|
|
871
|
+
useLocation,
|
|
872
|
+
} = require("react-router-dom"); // Componenti del router per la gestione della navigazione
|
|
873
|
+
|
|
874
|
+
// Destrutturazione della configurazione da Intlayer
|
|
875
|
+
const { internationalization, middleware } = configuration;
|
|
876
|
+
const { locales, defaultLocale } = internationalization;
|
|
877
|
+
|
|
865
878
|
/**
|
|
866
|
-
* Un componente che gestisce la localizzazione e avvolge i figli con il contesto
|
|
867
|
-
* Gestisce il rilevamento e la validazione della
|
|
879
|
+
* Un componente che gestisce la localizzazione e avvolge i figli con il contesto locale appropriato.
|
|
880
|
+
* Gestisce il rilevamento e la validazione della locale basata sull'URL.
|
|
868
881
|
*/
|
|
869
882
|
const AppLocalized = ({ children, locale }) => {
|
|
870
883
|
const { pathname, search } = useLocation(); // Ottieni il percorso URL corrente
|
|
@@ -872,7 +885,7 @@ const AppLocalized = ({ children, locale }) => {
|
|
|
872
885
|
// Determina la locale corrente, utilizzando quella di default se non fornita
|
|
873
886
|
const currentLocale = locale ?? defaultLocale;
|
|
874
887
|
|
|
875
|
-
//
|
|
888
|
+
// Rimuove il prefisso della locale dal percorso per costruire un percorso base
|
|
876
889
|
const pathWithoutLocale = getPathWithoutLocale(
|
|
877
890
|
pathname // Percorso URL corrente
|
|
878
891
|
);
|
|
@@ -898,22 +911,22 @@ const AppLocalized = ({ children, locale }) => {
|
|
|
898
911
|
);
|
|
899
912
|
} else {
|
|
900
913
|
/**
|
|
901
|
-
* Quando middleware.prefixDefault è falso, la locale
|
|
902
|
-
* Assicurarsi che la locale corrente sia valida e non la locale
|
|
914
|
+
* Quando middleware.prefixDefault è falso, la locale di default non è prefissata.
|
|
915
|
+
* Assicurarsi che la locale corrente sia valida e non la locale di default.
|
|
903
916
|
*/
|
|
904
917
|
if (
|
|
905
918
|
currentLocale.toString() !== defaultLocale.toString() &&
|
|
906
919
|
!locales
|
|
907
920
|
.filter(
|
|
908
|
-
(locale) => locale.toString() !== defaultLocale.toString() // Esclude la locale
|
|
921
|
+
(locale) => locale.toString() !== defaultLocale.toString() // Esclude la locale di default
|
|
909
922
|
)
|
|
910
|
-
.includes(currentLocale) //
|
|
923
|
+
.includes(currentLocale) // Controlla se la locale corrente è nella lista delle locale valide
|
|
911
924
|
) {
|
|
912
|
-
// Reindirizza al percorso senza prefisso della
|
|
925
|
+
// Reindirizza al percorso senza prefisso della lingua
|
|
913
926
|
return <Navigate to={`${pathWithoutLocale}${search}`} replace />;
|
|
914
927
|
}
|
|
915
928
|
|
|
916
|
-
// Avvolge i figli con IntlayerProvider e imposta la
|
|
929
|
+
// Avvolge i figli con IntlayerProvider e imposta la lingua corrente
|
|
917
930
|
return (
|
|
918
931
|
<IntlayerProvider locale={currentLocale}>{children}</IntlayerProvider>
|
|
919
932
|
);
|
|
@@ -921,7 +934,7 @@ const AppLocalized = ({ children, locale }) => {
|
|
|
921
934
|
};
|
|
922
935
|
|
|
923
936
|
/**
|
|
924
|
-
* Un componente router che configura le rotte specifiche per
|
|
937
|
+
* Un componente router che configura le rotte specifiche per la lingua.
|
|
925
938
|
* Utilizza React Router per gestire la navigazione e rendere i componenti localizzati.
|
|
926
939
|
*/
|
|
927
940
|
const LocaleRouter = ({ children }) => (
|
|
@@ -933,7 +946,7 @@ const LocaleRouter = ({ children }) => (
|
|
|
933
946
|
)
|
|
934
947
|
.map((locale) => (
|
|
935
948
|
<Route
|
|
936
|
-
//
|
|
949
|
+
// Pattern della rotta per catturare la lingua (es. /en/, /fr/) e corrispondere a tutti i percorsi successivi
|
|
937
950
|
path={`/${locale}/*`}
|
|
938
951
|
key={locale}
|
|
939
952
|
element={<AppLocalized locale={locale}>{children}</AppLocalized>} // Avvolge i figli con la gestione della localizzazione
|
|
@@ -941,7 +954,7 @@ const LocaleRouter = ({ children }) => (
|
|
|
941
954
|
))}
|
|
942
955
|
|
|
943
956
|
{
|
|
944
|
-
// Se il prefisso per la localizzazione predefinita è disabilitato, renderizza i figli direttamente al percorso
|
|
957
|
+
// Se il prefisso per la localizzazione predefinita è disabilitato, renderizza i figli direttamente al percorso radice
|
|
945
958
|
!middleware.prefixDefault && (
|
|
946
959
|
<Route
|
|
947
960
|
path="*"
|
|
@@ -956,7 +969,7 @@ const LocaleRouter = ({ children }) => (
|
|
|
956
969
|
);
|
|
957
970
|
```
|
|
958
971
|
|
|
959
|
-
|
|
972
|
+
Quindi, puoi utilizzare il componente `LocaleRouter` nella tua applicazione:
|
|
960
973
|
|
|
961
974
|
```tsx fileName="src/App.tsx" codeFormat="typescript"
|
|
962
975
|
import { LocaleRouter } from "./components/LocaleRouter";
|
|
@@ -995,7 +1008,7 @@ const App = () => (
|
|
|
995
1008
|
);
|
|
996
1009
|
```
|
|
997
1010
|
|
|
998
|
-
In parallelo, puoi anche utilizzare il `intLayerMiddlewarePlugin` per aggiungere il routing lato server alla tua applicazione. Questo plugin rileverà automaticamente la locale corrente basandosi sull'URL e imposterà il cookie della locale appropriata. Se non viene specificata alcuna locale, il plugin determinerà la locale più
|
|
1011
|
+
In parallelo, puoi anche utilizzare il `intLayerMiddlewarePlugin` per aggiungere il routing lato server alla tua applicazione. Questo plugin rileverà automaticamente la locale corrente basandosi sull'URL e imposterà il cookie della locale appropriata. Se non viene specificata alcuna locale, il plugin determinerà la locale più adatta in base alle preferenze linguistiche del browser dell'utente. Se non viene rilevata alcuna locale, verrà effettuato un reindirizzamento alla locale predefinita.
|
|
999
1012
|
|
|
1000
1013
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1001
1014
|
import { defineConfig } from "vite";
|
|
@@ -1032,7 +1045,7 @@ module.exports = defineConfig({
|
|
|
1032
1045
|
|
|
1033
1046
|
### (Opzionale) Passo 8: Cambiare l'URL quando la lingua cambia
|
|
1034
1047
|
|
|
1035
|
-
Per cambiare l'URL quando la lingua cambia, puoi usare la proprietà `onLocaleChange` fornita
|
|
1048
|
+
Per cambiare l'URL quando la lingua cambia, puoi usare la proprietà `onLocaleChange` fornita dall'hook `useLocale`. Parallelamente, puoi usare gli hook `useLocation` e `useNavigate` di `react-router-dom` per aggiornare il percorso dell'URL.
|
|
1036
1049
|
|
|
1037
1050
|
```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
1038
1051
|
import { useLocation, useNavigate } from "react-router-dom";
|
|
@@ -1076,15 +1089,15 @@ const LocaleSwitcher: FC = () => {
|
|
|
1076
1089
|
key={localeItem}
|
|
1077
1090
|
>
|
|
1078
1091
|
<span>
|
|
1079
|
-
{/*
|
|
1092
|
+
{/* Località - es. FR */}
|
|
1080
1093
|
{localeItem}
|
|
1081
1094
|
</span>
|
|
1082
1095
|
<span>
|
|
1083
|
-
{/* Lingua nella sua stessa
|
|
1096
|
+
{/* Lingua nella sua stessa località - es. Français */}
|
|
1084
1097
|
{getLocaleName(localeItem, locale)}
|
|
1085
1098
|
</span>
|
|
1086
1099
|
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1087
|
-
{/* Lingua nella
|
|
1100
|
+
{/* Lingua nella località corrente - es. Francés con la località corrente impostata su Locales.SPANISH */}
|
|
1088
1101
|
{getLocaleName(localeItem)}
|
|
1089
1102
|
</span>
|
|
1090
1103
|
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
@@ -1148,7 +1161,7 @@ const LocaleSwitcher = () => {
|
|
|
1148
1161
|
{getLocaleName(localeItem, locale)}
|
|
1149
1162
|
</span>
|
|
1150
1163
|
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1151
|
-
{/* Lingua nella
|
|
1164
|
+
{/* Lingua nella localizzazione corrente - es. Francés con la localizzazione corrente impostata su Locales.SPANISH */}
|
|
1152
1165
|
{getLocaleName(localeItem)}
|
|
1153
1166
|
</span>
|
|
1154
1167
|
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
@@ -1204,15 +1217,15 @@ const LocaleSwitcher = () => {
|
|
|
1204
1217
|
key={localeItem}
|
|
1205
1218
|
>
|
|
1206
1219
|
<span>
|
|
1207
|
-
{/*
|
|
1220
|
+
{/* Locale - es. FR */}
|
|
1208
1221
|
{localeItem}
|
|
1209
1222
|
</span>
|
|
1210
1223
|
<span>
|
|
1211
|
-
{/* Lingua nella sua stessa
|
|
1224
|
+
{/* Lingua nella sua stessa Locale - es. Français */}
|
|
1212
1225
|
{getLocaleName(localeItem, locale)}
|
|
1213
1226
|
</span>
|
|
1214
1227
|
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1215
|
-
{/* Lingua nella
|
|
1228
|
+
{/* Lingua nella Locale corrente - es. Francés con la locale corrente impostata su Locales.SPANISH */}
|
|
1216
1229
|
{getLocaleName(localeItem)}
|
|
1217
1230
|
</span>
|
|
1218
1231
|
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
@@ -1242,19 +1255,19 @@ Di seguito il **Passo 9** aggiornato con spiegazioni aggiuntive ed esempi di cod
|
|
|
1242
1255
|
|
|
1243
1256
|
---
|
|
1244
1257
|
|
|
1245
|
-
### (Opzionale) Passo 9: Cambiare gli attributi di lingua e direzione dell
|
|
1258
|
+
### (Opzionale) Passo 9: Cambiare gli attributi di lingua e direzione dell’HTML
|
|
1246
1259
|
|
|
1247
1260
|
Quando la tua applicazione supporta più lingue, è fondamentale aggiornare gli attributi `lang` e `dir` del tag `<html>` per corrispondere alla locale corrente. Questo garantisce:
|
|
1248
1261
|
|
|
1249
1262
|
- **Accessibilità**: I lettori di schermo e le tecnologie assistive si basano sull'attributo `lang` corretto per pronunciare e interpretare accuratamente il contenuto.
|
|
1250
1263
|
- **Rendering del testo**: L'attributo `dir` (direzione) assicura che il testo venga visualizzato nell'ordine corretto (ad esempio, da sinistra a destra per l'inglese, da destra a sinistra per l'arabo o l'ebraico), essenziale per la leggibilità.
|
|
1251
|
-
- **SEO**: I motori di ricerca utilizzano l'attributo `lang` per determinare la lingua della tua pagina, aiutando a
|
|
1264
|
+
- **SEO**: I motori di ricerca utilizzano l'attributo `lang` per determinare la lingua della tua pagina, aiutando a mostrare il contenuto localizzato appropriato nei risultati di ricerca.
|
|
1252
1265
|
|
|
1253
1266
|
Aggiornando dinamicamente questi attributi quando la lingua cambia, garantisci un'esperienza coerente e accessibile per gli utenti in tutte le lingue supportate.
|
|
1254
1267
|
|
|
1255
1268
|
#### Implementazione del Hook
|
|
1256
1269
|
|
|
1257
|
-
Crea un hook personalizzato per gestire gli attributi HTML.
|
|
1270
|
+
Crea un hook personalizzato per gestire gli attributi HTML. L'hook ascolta i cambiamenti della lingua e aggiorna gli attributi di conseguenza:
|
|
1258
1271
|
|
|
1259
1272
|
```tsx fileName="src/hooks/useI18nHTMLAttributes.tsx" codeFormat="typescript"
|
|
1260
1273
|
import { useEffect } from "react";
|
|
@@ -1263,7 +1276,7 @@ import { getHTMLTextDir } from "intlayer";
|
|
|
1263
1276
|
|
|
1264
1277
|
/**
|
|
1265
1278
|
* Aggiorna gli attributi `lang` e `dir` dell'elemento HTML <html> in base alla lingua corrente.
|
|
1266
|
-
* - `lang`: Informa
|
|
1279
|
+
* - `lang`: Informa browser e motori di ricerca sulla lingua della pagina.
|
|
1267
1280
|
* - `dir`: Garantisce l'ordine di lettura corretto (es. 'ltr' per inglese, 'rtl' per arabo).
|
|
1268
1281
|
*
|
|
1269
1282
|
* Questo aggiornamento dinamico è essenziale per una corretta resa del testo, accessibilità e SEO.
|
|
@@ -1272,10 +1285,10 @@ export const useI18nHTMLAttributes = () => {
|
|
|
1272
1285
|
const { locale } = useLocale();
|
|
1273
1286
|
|
|
1274
1287
|
useEffect(() => {
|
|
1275
|
-
// Aggiorna l'attributo della lingua
|
|
1288
|
+
// Aggiorna l'attributo della lingua all'attuale locale.
|
|
1276
1289
|
document.documentElement.lang = locale;
|
|
1277
1290
|
|
|
1278
|
-
// Imposta la direzione del testo in base
|
|
1291
|
+
// Imposta la direzione del testo in base all'attuale locale.
|
|
1279
1292
|
document.documentElement.dir = getHTMLTextDir(locale);
|
|
1280
1293
|
}, [locale]);
|
|
1281
1294
|
};
|
|
@@ -1287,7 +1300,7 @@ import { useLocale } from "react-intlayer";
|
|
|
1287
1300
|
import { getHTMLTextDir } from "intlayer";
|
|
1288
1301
|
|
|
1289
1302
|
/**
|
|
1290
|
-
* Aggiorna gli attributi `lang` e `dir` dell'elemento HTML <html> in base
|
|
1303
|
+
* Aggiorna gli attributi `lang` e `dir` dell'elemento HTML <html> in base al locale corrente.
|
|
1291
1304
|
* - `lang`: Informa i browser e i motori di ricerca sulla lingua della pagina.
|
|
1292
1305
|
* - `dir`: Garantisce l'ordine di lettura corretto (ad esempio, 'ltr' per l'inglese, 'rtl' per l'arabo).
|
|
1293
1306
|
*
|
|
@@ -1404,17 +1417,33 @@ module.exports = App;
|
|
|
1404
1417
|
|
|
1405
1418
|
Applicando queste modifiche, la tua applicazione:
|
|
1406
1419
|
|
|
1407
|
-
- Garantirà che l'attributo **language** (`lang`) rifletta correttamente la locale corrente, importante per SEO e comportamento del browser.
|
|
1408
|
-
- Adatterà la **direzione del testo** (`dir`) in base alla locale, migliorando leggibilità e usabilità per lingue con ordini di lettura differenti.
|
|
1409
|
-
- Fornirà un'esperienza più **accessibile**, poiché le tecnologie assistive
|
|
1420
|
+
- Garantirà che l'attributo **language** (`lang`) rifletta correttamente la locale corrente, importante per la SEO e il comportamento del browser.
|
|
1421
|
+
- Adatterà la **direzione del testo** (`dir`) in base alla locale, migliorando la leggibilità e l'usabilità per lingue con ordini di lettura differenti.
|
|
1422
|
+
- Fornirà un'esperienza più **accessibile**, poiché le tecnologie assistive si basano su questi attributi per funzionare al meglio.
|
|
1410
1423
|
|
|
1411
|
-
### (Opzionale) Passo 10: Creare un
|
|
1424
|
+
### (Opzionale) Passo 10: Creare un componente Link localizzato
|
|
1425
|
+
|
|
1426
|
+
// Applica l'hook per aggiornare gli attributi lang e dir del tag <html> in base alla locale.
|
|
1427
|
+
useI18nHTMLAttributes();
|
|
1428
|
+
|
|
1429
|
+
// ... Resto del tuo componente
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1432
|
+
const App = () => (
|
|
1433
|
+
<IntlayerProvider>
|
|
1434
|
+
<AppContent />
|
|
1435
|
+
</IntlayerProvider>
|
|
1436
|
+
);
|
|
1437
|
+
|
|
1438
|
+
module.exports = App;
|
|
1439
|
+
|
|
1440
|
+
````
|
|
1412
1441
|
|
|
1413
1442
|
Applicando queste modifiche, la tua applicazione:
|
|
1414
1443
|
|
|
1415
|
-
- Garantirà che l'attributo **
|
|
1444
|
+
- Garantirà che l'attributo **lingua** (`lang`) rifletta correttamente la locale corrente, cosa importante per la SEO e il comportamento del browser.
|
|
1416
1445
|
- Adatterà la **direzione del testo** (`dir`) in base alla locale, migliorando la leggibilità e l'usabilità per le lingue con ordini di lettura differenti.
|
|
1417
|
-
- Fornirà un'esperienza più **accessibile**, poiché le tecnologie assistive dipendono da questi attributi per funzionare
|
|
1446
|
+
- Fornirà un'esperienza più **accessibile**, poiché le tecnologie assistive dipendono da questi attributi per funzionare in modo ottimale.
|
|
1418
1447
|
|
|
1419
1448
|
### (Opzionale) Passo 10: Creare un componente Link localizzato
|
|
1420
1449
|
|
|
@@ -1423,7 +1452,7 @@ Per garantire che la navigazione della tua applicazione rispetti la lingua corre
|
|
|
1423
1452
|
Questo comportamento è utile per diversi motivi:
|
|
1424
1453
|
|
|
1425
1454
|
- **SEO e esperienza utente**: Gli URL localizzati aiutano i motori di ricerca a indicizzare correttamente le pagine specifiche per lingua e forniscono agli utenti contenuti nella loro lingua preferita.
|
|
1426
|
-
- **Coerenza**: Utilizzando un link localizzato in tutta l'applicazione, garantisci che la navigazione rimanga all'interno della lingua corrente, evitando cambiamenti di lingua
|
|
1455
|
+
- **Coerenza**: Utilizzando un link localizzato in tutta l'applicazione, garantisci che la navigazione rimanga all'interno della lingua corrente, evitando cambiamenti di lingua imprevisti.
|
|
1427
1456
|
- **Manutenibilità**: Centralizzare la logica di localizzazione in un unico componente semplifica la gestione degli URL, rendendo il tuo codice più facile da mantenere ed estendere man mano che la tua applicazione cresce.
|
|
1428
1457
|
|
|
1429
1458
|
Di seguito è riportata l'implementazione di un componente `Link` localizzato in TypeScript:
|
|
@@ -1452,8 +1481,8 @@ export const checkIsExternalLink = (href?: string): boolean =>
|
|
|
1452
1481
|
|
|
1453
1482
|
/**
|
|
1454
1483
|
* Un componente Link personalizzato che adatta l'attributo href in base alla locale corrente.
|
|
1455
|
-
* Per i link interni, utilizza `getLocalizedUrl` per
|
|
1456
|
-
* Questo garantisce che la navigazione rimanga all'interno dello stesso contesto locale.
|
|
1484
|
+
* Per i link interni, utilizza `getLocalizedUrl` per aggiungere il prefisso della locale all'URL (es. /fr/about).
|
|
1485
|
+
* Questo garantisce che la navigazione rimanga all'interno dello stesso contesto di locale.
|
|
1457
1486
|
*/
|
|
1458
1487
|
export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
|
|
1459
1488
|
({ href, children, ...props }, ref) => {
|
|
@@ -1473,7 +1502,7 @@ export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
1473
1502
|
);
|
|
1474
1503
|
|
|
1475
1504
|
Link.displayName = "Link";
|
|
1476
|
-
|
|
1505
|
+
````
|
|
1477
1506
|
|
|
1478
1507
|
```jsx fileName="src/components/Link.mjx" codeFormat="esm"
|
|
1479
1508
|
import { getLocalizedUrl } from "intlayer";
|
|
@@ -1488,9 +1517,9 @@ export const checkIsExternalLink = (href?: string): boolean =>
|
|
|
1488
1517
|
/^https?:\/\//.test(href ?? "");
|
|
1489
1518
|
|
|
1490
1519
|
/**
|
|
1491
|
-
*
|
|
1520
|
+
* Un componente Link personalizzato che adatta l'attributo href in base alla locale corrente.
|
|
1492
1521
|
* Per i link interni, utilizza `getLocalizedUrl` per aggiungere il prefisso della locale all'URL (es. /fr/about).
|
|
1493
|
-
* Questo garantisce che la navigazione rimanga all'interno dello stesso contesto locale.
|
|
1522
|
+
* Questo garantisce che la navigazione rimanga all'interno dello stesso contesto di locale.
|
|
1494
1523
|
*/
|
|
1495
1524
|
export const Link = forwardRef(({ href, children, ...props }, ref) => {
|
|
1496
1525
|
const { locale } = useLocale();
|
|
@@ -1524,7 +1553,7 @@ const checkIsExternalLink = (href) => /^https?:\/\//.test(href ?? "");
|
|
|
1524
1553
|
/**
|
|
1525
1554
|
* Un componente Link personalizzato che adatta l'attributo href in base alla locale corrente.
|
|
1526
1555
|
* Per i link interni, utilizza `getLocalizedUrl` per anteporre la locale all'URL (es. /fr/about).
|
|
1527
|
-
* Questo garantisce che la navigazione rimanga all'interno dello stesso contesto locale.
|
|
1556
|
+
* Questo garantisce che la navigazione rimanga all'interno dello stesso contesto di locale.
|
|
1528
1557
|
*/
|
|
1529
1558
|
const Link = forwardRef(({ href, children, ...props }, ref) => {
|
|
1530
1559
|
const { locale } = useLocale();
|
|
@@ -1554,14 +1583,32 @@ Link.displayName = "Link";
|
|
|
1554
1583
|
La funzione di supporto `checkIsExternalLink` determina se un URL è esterno. I link esterni vengono lasciati invariati perché non necessitano di localizzazione.
|
|
1555
1584
|
|
|
1556
1585
|
- **Recupero della Locale Corrente**:
|
|
1557
|
-
L'hook `useLocale` fornisce la locale corrente (ad esempio, `fr` per
|
|
1586
|
+
L'hook `useLocale` fornisce la locale corrente (ad esempio, `fr` per francese).
|
|
1558
1587
|
|
|
1559
1588
|
- **Localizzazione dell'URL**:
|
|
1560
|
-
Per i link interni (cioè non esterni), `getLocalizedUrl` viene utilizzato per aggiungere automaticamente il prefisso della locale corrente all'URL. Ciò significa che se l'utente è in francese, passando `/about` come `href
|
|
1589
|
+
Per i link interni (cioè non esterni), `getLocalizedUrl` viene utilizzato per aggiungere automaticamente il prefisso della locale corrente all'URL. Ciò significa che se l'utente è in francese, passando `/about` come `href` verrà trasformato in `/fr/about`.
|
|
1561
1590
|
|
|
1562
1591
|
- **Restituzione del Link**:
|
|
1563
1592
|
Il componente restituisce un elemento `<a>` con l'URL localizzato, garantendo che la navigazione sia coerente con la lingua selezionata.
|
|
1564
1593
|
|
|
1594
|
+
Integrando questo componente `Link` in tutta la tua applicazione, mantieni un'esperienza utente coerente e consapevole della lingua, beneficiando anche di un miglior SEO e usabilità.
|
|
1595
|
+
|
|
1596
|
+
### Configurare TypeScript
|
|
1597
|
+
|
|
1598
|
+
Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScript e rendere il tuo codice più robusto.
|
|
1599
|
+
|
|
1600
|
+

|
|
1601
|
+
|
|
1602
|
+

|
|
1603
|
+
|
|
1604
|
+
Assicurati che la tua configurazione di TypeScript includa i tipi generati automaticamente.
|
|
1605
|
+
|
|
1606
|
+
````json5 fileName="tsconfig.json"
|
|
1607
|
+
{
|
|
1608
|
+
// ... Le tue configurazioni TypeScript esistenti
|
|
1609
|
+
"include": [
|
|
1610
|
+
Il componente restituisce un elemento `<a>` con l'URL localizzato, garantendo che la navigazione sia coerente con la lingua selezionata.
|
|
1611
|
+
|
|
1565
1612
|
Integrando questo componente `Link` in tutta la tua applicazione, mantieni un'esperienza utente coerente e consapevole della lingua, beneficiando inoltre di un miglior SEO e usabilità.
|
|
1566
1613
|
|
|
1567
1614
|
### Configurare TypeScript
|
|
@@ -1572,7 +1619,7 @@ Intlayer utilizza l'augmentation dei moduli per sfruttare i vantaggi di TypeScri
|
|
|
1572
1619
|
|
|
1573
1620
|

|
|
1574
1621
|
|
|
1575
|
-
Assicurati che la configurazione
|
|
1622
|
+
Assicurati che la tua configurazione TypeScript includa i tipi generati automaticamente.
|
|
1576
1623
|
|
|
1577
1624
|
```json5 fileName="tsconfig.json"
|
|
1578
1625
|
{
|
|
@@ -1582,7 +1629,7 @@ Assicurati che la configurazione di TypeScript includa i tipi generati automatic
|
|
|
1582
1629
|
".intlayer/**/*.ts", // Includi i tipi generati automaticamente
|
|
1583
1630
|
],
|
|
1584
1631
|
}
|
|
1585
|
-
|
|
1632
|
+
````
|
|
1586
1633
|
|
|
1587
1634
|
### Configurazione Git
|
|
1588
1635
|
|
|
@@ -1597,14 +1644,14 @@ Per farlo, puoi aggiungere le seguenti istruzioni al tuo file `.gitignore`:
|
|
|
1597
1644
|
|
|
1598
1645
|
### Estensione VS Code
|
|
1599
1646
|
|
|
1600
|
-
Per migliorare la tua esperienza di sviluppo con Intlayer, puoi installare l
|
|
1647
|
+
Per migliorare la tua esperienza di sviluppo con Intlayer, puoi installare l'estensione ufficiale **Intlayer VS Code Extension**.
|
|
1601
1648
|
|
|
1602
1649
|
[Installa dal Marketplace di VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1603
1650
|
|
|
1604
1651
|
Questa estensione offre:
|
|
1605
1652
|
|
|
1606
1653
|
- **Completamento automatico** per le chiavi di traduzione.
|
|
1607
|
-
- **Rilevamento errori in tempo reale** per traduzioni mancanti.
|
|
1654
|
+
- **Rilevamento errori in tempo reale** per le traduzioni mancanti.
|
|
1608
1655
|
- **Anteprime inline** del contenuto tradotto.
|
|
1609
1656
|
- **Azioni rapide** per creare e aggiornare facilmente le traduzioni.
|
|
1610
1657
|
|
|
@@ -1614,7 +1661,7 @@ Per maggiori dettagli su come utilizzare l'estensione, consulta la [documentazio
|
|
|
1614
1661
|
|
|
1615
1662
|
### Approfondimenti
|
|
1616
1663
|
|
|
1617
|
-
Per approfondire, puoi implementare l'[editor visuale](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_visual_editor.md)
|
|
1664
|
+
Per approfondire, puoi implementare l'[editor visuale](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_visual_editor.md) o esternalizzare i tuoi contenuti utilizzando il [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/it/intlayer_CMS.md).
|
|
1618
1665
|
|
|
1619
1666
|
---
|
|
1620
1667
|
|