@intlayer/docs 9.1.3 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blog/ar/rag_powered_documentation_assistant.md +7 -0
- package/blog/de/rag_powered_documentation_assistant.md +6 -0
- package/blog/en-GB/rag_powered_documentation_assistant.md +6 -0
- package/blog/es/rag_powered_documentation_assistant.md +7 -0
- package/blog/fr/i18n_meaning.md +7 -1
- package/blog/fr/list_i18n_technologies/frameworks/angular.md +5 -1
- package/blog/fr/rag_powered_documentation_assistant.md +6 -0
- package/blog/hi/next-i18next_vs_next-intl_vs_intlayer.md +119 -42
- package/blog/hi/rag_powered_documentation_assistant.md +7 -0
- package/blog/id/rag_powered_documentation_assistant.md +6 -0
- package/blog/it/rag_powered_documentation_assistant.md +6 -0
- package/blog/ja/rag_powered_documentation_assistant.md +7 -0
- package/blog/ko/list_i18n_technologies/frameworks/react.md +7 -7
- package/blog/ko/rag_powered_documentation_assistant.md +6 -0
- package/blog/pl/rag_powered_documentation_assistant.md +6 -0
- package/blog/pt/rag_powered_documentation_assistant.md +6 -0
- package/blog/ru/rag_powered_documentation_assistant.md +7 -0
- package/blog/tr/intlayer_with_react-intl.md +3 -1
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +175 -42
- package/blog/tr/rag_powered_documentation_assistant.md +6 -0
- package/blog/uk/rag_powered_documentation_assistant.md +6 -0
- package/blog/vi/rag_powered_documentation_assistant.md +6 -0
- package/blog/zh/intlayer_with_i18next.md +87 -28
- package/blog/zh/intlayer_with_next-i18next.md +86 -29
- package/blog/zh/intlayer_with_next-intl.md +88 -28
- package/blog/zh/intlayer_with_react-i18next.md +87 -28
- package/blog/zh/intlayer_with_react-intl.md +88 -27
- package/blog/zh/intlayer_with_vue-i18n.md +117 -8
- package/blog/zh/rag_powered_documentation_assistant.md +6 -0
- package/dist/cjs/generated/blog.entry.cjs +27 -27
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +234 -214
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +17 -17
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +2 -2
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +27 -27
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +234 -214
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +17 -17
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +2 -2
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/analytics.md +222 -0
- package/docs/ar/autoFill.md +28 -9
- package/docs/ar/configuration.md +25 -8
- package/docs/ar/dictionary/file.md +3 -1
- package/docs/ar/dictionary/nesting.md +47 -30
- package/docs/ar/formatters.md +148 -193
- package/docs/ar/intlayer_CMS.md +152 -0
- package/docs/ar/intlayer_with_angular_21.md +9 -9
- package/docs/ar/intlayer_with_nextjs_14.md +1 -28
- package/docs/ar/intlayer_with_nextjs_15.md +1 -33
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +40 -83
- package/docs/ar/intlayer_with_solid_start.md +1078 -0
- package/docs/ar/intlayer_with_vite+vue.md +1 -3
- package/docs/ar/packages/intlayer/getLocalizedUrl.md +26 -24
- package/docs/ar/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/ar/packages/react-intlayer/useDictionary.md +4 -21
- package/docs/ar/packages/react-intlayer/useIntlayer.md +2 -2
- package/docs/ar/packages/vite-intlayer/exports.md +15 -0
- package/docs/ar/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/ar/packages/vite-intlayer/intlayerPrune.md +70 -3
- package/docs/ar/releases/v9.md +0 -37
- package/docs/ar/self_hosting.md +46 -49
- package/docs/bn/configuration.md +25 -8
- package/docs/bn/intlayer_with_angular_21.md +9 -9
- package/docs/cs/configuration.md +25 -8
- package/docs/cs/intlayer_with_angular_21.md +9 -9
- package/docs/de/analytics.md +222 -0
- package/docs/de/autoFill.md +28 -9
- package/docs/de/configuration.md +25 -8
- package/docs/de/dictionary/file.md +3 -1
- package/docs/de/dictionary/nesting.md +47 -31
- package/docs/de/formatters.md +208 -334
- package/docs/de/intlayer_CMS.md +66 -15
- package/docs/de/intlayer_with_angular_21.md +9 -9
- package/docs/de/intlayer_with_nestjs.md +11 -7
- package/docs/de/intlayer_with_nextjs_14.md +1 -28
- package/docs/de/intlayer_with_nextjs_15.md +1 -33
- package/docs/de/intlayer_with_solid_start.md +1078 -0
- package/docs/de/intlayer_with_vite+vue.md +1 -3
- package/docs/de/packages/intlayer/getLocalizedUrl.md +33 -25
- package/docs/de/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/de/packages/react-intlayer/useDictionary.md +2 -5
- package/docs/de/packages/vite-intlayer/exports.md +15 -0
- package/docs/de/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/de/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/de/releases/v9.md +0 -15
- package/docs/de/self_hosting.md +46 -50
- package/docs/en/cli/doc-review.md +13 -2
- package/docs/en/configuration.md +24 -15
- package/docs/en/intlayer_with_angular_21.md +9 -9
- package/docs/en/intlayer_with_solid_start.md +1091 -0
- package/docs/en/intlayer_with_vite+solid.md +12 -0
- package/docs/en-GB/analytics.md +222 -0
- package/docs/en-GB/autoFill.md +26 -7
- package/docs/en-GB/configuration.md +25 -8
- package/docs/en-GB/dictionary/file.md +2 -0
- package/docs/en-GB/dictionary/nesting.md +64 -205
- package/docs/en-GB/formatters.md +146 -181
- package/docs/en-GB/intlayer_CMS.md +152 -0
- package/docs/en-GB/intlayer_with_angular_21.md +9 -9
- package/docs/en-GB/intlayer_with_nestjs.md +6 -2
- package/docs/en-GB/intlayer_with_nextjs_14.md +0 -27
- package/docs/en-GB/intlayer_with_nextjs_15.md +1 -33
- package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +40 -82
- package/docs/en-GB/intlayer_with_solid_start.md +1078 -0
- package/docs/en-GB/intlayer_with_vite+vue.md +1 -3
- package/docs/en-GB/packages/intlayer/getLocalizedUrl.md +30 -22
- package/docs/en-GB/packages/intlayer/getMultilingualUrls.md +16 -48
- package/docs/en-GB/packages/vite-intlayer/exports.md +15 -0
- package/docs/en-GB/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/en-GB/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/en-GB/self_hosting.md +60 -49
- package/docs/es/analytics.md +222 -0
- package/docs/es/autoFill.md +28 -9
- package/docs/es/configuration.md +24 -7
- package/docs/es/dictionary/file.md +3 -1
- package/docs/es/dictionary/nesting.md +47 -30
- package/docs/es/formatters.md +114 -168
- package/docs/es/intlayer_CMS.md +35 -10
- package/docs/es/intlayer_with_angular_21.md +9 -9
- package/docs/es/intlayer_with_nextjs_14.md +1 -28
- package/docs/es/intlayer_with_nextjs_15.md +1 -33
- package/docs/es/intlayer_with_solid_start.md +1078 -0
- package/docs/es/packages/intlayer/getLocalizedUrl.md +31 -23
- package/docs/es/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/es/packages/vite-intlayer/exports.md +15 -0
- package/docs/es/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/es/packages/vite-intlayer/intlayerPrune.md +69 -2
- package/docs/es/releases/v9.md +0 -15
- package/docs/es/self_hosting.md +46 -49
- package/docs/fr/analytics.md +222 -0
- package/docs/fr/autoFill.md +27 -8
- package/docs/fr/configuration.md +25 -8
- package/docs/fr/dictionary/file.md +2 -0
- package/docs/fr/dictionary/nesting.md +37 -184
- package/docs/fr/formatters.md +95 -236
- package/docs/fr/intlayer_CMS.md +66 -15
- package/docs/fr/intlayer_with_angular_21.md +9 -9
- package/docs/fr/intlayer_with_nextjs_14.md +1 -28
- package/docs/fr/intlayer_with_nextjs_15.md +1 -33
- package/docs/fr/intlayer_with_solid_start.md +1078 -0
- package/docs/fr/packages/intlayer/getLocalizedUrl.md +37 -27
- package/docs/fr/packages/intlayer/getMultilingualUrls.md +18 -20
- package/docs/fr/packages/vite-intlayer/exports.md +15 -0
- package/docs/fr/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/fr/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/fr/releases/v9.md +0 -15
- package/docs/fr/self_hosting.md +46 -49
- package/docs/hi/analytics.md +222 -0
- package/docs/hi/autoFill.md +28 -9
- package/docs/hi/configuration.md +25 -8
- package/docs/hi/dictionary/file.md +3 -1
- package/docs/hi/dictionary/nesting.md +47 -30
- package/docs/hi/formatters.md +233 -334
- package/docs/hi/how_works_intlayer.md +3 -1
- package/docs/hi/intlayer_CMS.md +152 -0
- package/docs/hi/intlayer_with_angular_21.md +9 -9
- package/docs/hi/intlayer_with_nestjs.md +11 -7
- package/docs/hi/intlayer_with_nextjs_14.md +1 -28
- package/docs/hi/intlayer_with_nextjs_15.md +1 -33
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +40 -83
- package/docs/hi/intlayer_with_solid_start.md +1077 -0
- package/docs/hi/intlayer_with_vite+preact.md +56 -49
- package/docs/hi/intlayer_with_vite+react.md +48 -41
- package/docs/hi/intlayer_with_vite+solid.md +32 -41
- package/docs/hi/intlayer_with_vite+vue.md +49 -44
- package/docs/hi/packages/intlayer/getLocalizedUrl.md +26 -24
- package/docs/hi/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/hi/packages/next-intlayer/t.md +33 -1
- package/docs/hi/packages/react-intlayer/useDictionary.md +4 -21
- package/docs/hi/packages/vite-intlayer/exports.md +15 -0
- package/docs/hi/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/hi/packages/vite-intlayer/intlayerPrune.md +78 -5
- package/docs/hi/plugins/sync-json.md +9 -9
- package/docs/hi/releases/v9.md +0 -15
- package/docs/hi/self_hosting.md +38 -51
- package/docs/id/analytics.md +223 -0
- package/docs/id/configuration.md +25 -8
- package/docs/id/dictionary/nesting.md +37 -184
- package/docs/id/formatters.md +208 -305
- package/docs/id/intlayer_CMS.md +164 -0
- package/docs/id/intlayer_with_angular_21.md +9 -9
- package/docs/id/intlayer_with_nextjs_14.md +1 -26
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +70 -63
- package/docs/id/intlayer_with_solid_start.md +1078 -0
- package/docs/id/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/id/packages/react-intlayer/useIntlayer.md +2 -2
- package/docs/id/packages/vite-intlayer/exports.md +15 -0
- package/docs/id/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/id/packages/vite-intlayer/intlayerPrune.md +78 -5
- package/docs/id/releases/v9.md +12 -0
- package/docs/id/self_hosting.md +61 -50
- package/docs/it/analytics.md +222 -0
- package/docs/it/autoFill.md +27 -8
- package/docs/it/configuration.md +25 -8
- package/docs/it/dictionary/file.md +3 -1
- package/docs/it/dictionary/nesting.md +47 -30
- package/docs/it/formatters.md +114 -168
- package/docs/it/intlayer_CMS.md +66 -15
- package/docs/it/intlayer_with_angular_21.md +9 -9
- package/docs/it/intlayer_with_nestjs.md +11 -7
- package/docs/it/intlayer_with_nextjs_14.md +1 -28
- package/docs/it/intlayer_with_nextjs_15.md +1 -33
- package/docs/it/intlayer_with_solid_start.md +1078 -0
- package/docs/it/intlayer_with_vite+vue.md +1 -3
- package/docs/it/packages/intlayer/getLocalizedUrl.md +34 -26
- package/docs/it/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/it/packages/react-intlayer/useDictionary.md +4 -21
- package/docs/it/packages/vite-intlayer/exports.md +15 -0
- package/docs/it/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/it/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/it/releases/v9.md +0 -15
- package/docs/it/self_hosting.md +60 -49
- package/docs/ja/analytics.md +222 -0
- package/docs/ja/autoFill.md +28 -9
- package/docs/ja/configuration.md +25 -8
- package/docs/ja/dictionary/content_file.md +15 -7
- package/docs/ja/dictionary/file.md +3 -1
- package/docs/ja/dictionary/nesting.md +47 -30
- package/docs/ja/formatters.md +133 -187
- package/docs/ja/intlayer_visual_editor.md +3 -1
- package/docs/ja/intlayer_with_angular_21.md +6 -6
- package/docs/ja/intlayer_with_nestjs.md +2 -12
- package/docs/ja/intlayer_with_nextjs_14.md +1 -28
- package/docs/ja/intlayer_with_nextjs_15.md +1 -33
- package/docs/ja/intlayer_with_react_router_v7.md +456 -20
- package/docs/ja/intlayer_with_solid_start.md +1078 -0
- package/docs/ja/intlayer_with_vite+preact.md +73 -41
- package/docs/ja/intlayer_with_vite+vue.md +1 -3
- package/docs/ja/mcp_server.md +3 -9
- package/docs/ja/packages/intlayer/getLocalizedUrl.md +26 -24
- package/docs/ja/packages/intlayer/getMultilingualUrls.md +3 -17
- package/docs/ja/packages/vite-intlayer/exports.md +15 -0
- package/docs/ja/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/ja/packages/vite-intlayer/intlayerPrune.md +79 -6
- package/docs/ja/releases/v9.md +12 -0
- package/docs/ja/self_hosting.md +46 -50
- package/docs/ko/analytics.md +222 -0
- package/docs/ko/autoFill.md +28 -9
- package/docs/ko/configuration.md +25 -8
- package/docs/ko/dictionary/file.md +3 -1
- package/docs/ko/dictionary/nesting.md +47 -30
- package/docs/ko/formatters.md +133 -187
- package/docs/ko/intlayer_with_angular_21.md +9 -9
- package/docs/ko/intlayer_with_lynx+react.md +133 -39
- package/docs/ko/intlayer_with_nextjs_14.md +1 -28
- package/docs/ko/intlayer_with_nextjs_15.md +1 -33
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +40 -188
- package/docs/ko/intlayer_with_solid_start.md +1078 -0
- package/docs/ko/intlayer_with_vite+preact.md +57 -23
- package/docs/ko/intlayer_with_vite+vue.md +1 -3
- package/docs/ko/packages/intlayer/getLocalizedUrl.md +26 -24
- package/docs/ko/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/ko/packages/vite-intlayer/exports.md +15 -0
- package/docs/ko/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/ko/packages/vite-intlayer/intlayerPrune.md +79 -6
- package/docs/ko/releases/v9.md +12 -0
- package/docs/ko/self_hosting.md +60 -49
- package/docs/nl/configuration.md +25 -8
- package/docs/nl/intlayer_with_angular_21.md +9 -9
- package/docs/pl/analytics.md +220 -0
- package/docs/pl/configuration.md +25 -8
- package/docs/pl/dictionary/nesting.md +47 -30
- package/docs/pl/formatters.md +208 -305
- package/docs/pl/intlayer_CMS.md +152 -0
- package/docs/pl/intlayer_with_angular_21.md +9 -9
- package/docs/pl/intlayer_with_nextjs_14.md +1 -26
- package/docs/pl/intlayer_with_solid_start.md +1078 -0
- package/docs/pl/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/pl/packages/react-intlayer/useDictionary.md +2 -19
- package/docs/pl/packages/vite-intlayer/exports.md +15 -0
- package/docs/pl/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/pl/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/pl/releases/v9.md +0 -15
- package/docs/pl/self_hosting.md +60 -49
- package/docs/pt/analytics.md +222 -0
- package/docs/pt/configuration.md +25 -8
- package/docs/pt/dictionary/file.md +3 -1
- package/docs/pt/dictionary/nesting.md +47 -30
- package/docs/pt/formatters.md +112 -168
- package/docs/pt/intlayer_CMS.md +66 -15
- package/docs/pt/intlayer_with_angular_21.md +9 -9
- package/docs/pt/intlayer_with_astro_lit.md +26 -1
- package/docs/pt/intlayer_with_nextjs_14.md +1 -28
- package/docs/pt/intlayer_with_nextjs_15.md +1 -33
- package/docs/pt/intlayer_with_solid_start.md +1078 -0
- package/docs/pt/intlayer_with_vite+vue.md +1 -3
- package/docs/pt/packages/intlayer/getLocalizedUrl.md +34 -26
- package/docs/pt/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/pt/packages/vite-intlayer/exports.md +15 -0
- package/docs/pt/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/pt/packages/vite-intlayer/intlayerPrune.md +78 -6
- package/docs/pt/releases/v9.md +0 -15
- package/docs/pt/self_hosting.md +60 -49
- package/docs/ru/analytics.md +222 -0
- package/docs/ru/autoFill.md +27 -8
- package/docs/ru/configuration.md +25 -8
- package/docs/ru/dictionary/file.md +3 -1
- package/docs/ru/dictionary/nesting.md +64 -205
- package/docs/ru/formatters.md +108 -128
- package/docs/ru/intlayer_with_angular_21.md +9 -9
- package/docs/ru/intlayer_with_nextjs_14.md +1 -28
- package/docs/ru/intlayer_with_nextjs_15.md +1 -33
- package/docs/ru/intlayer_with_solid_start.md +1078 -0
- package/docs/ru/intlayer_with_vite+vue.md +1 -3
- package/docs/ru/packages/intlayer/getLocalizedUrl.md +34 -26
- package/docs/ru/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/ru/packages/react-intlayer/useDictionary.md +4 -21
- package/docs/ru/packages/vite-intlayer/exports.md +15 -0
- package/docs/ru/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/ru/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/ru/releases/v9.md +0 -15
- package/docs/ru/self_hosting.md +60 -49
- package/docs/tr/analytics.md +222 -0
- package/docs/tr/autoFill.md +28 -9
- package/docs/tr/configuration.md +25 -8
- package/docs/tr/dictionary/file.md +2 -0
- package/docs/tr/dictionary/nesting.md +47 -30
- package/docs/tr/formatters.md +144 -190
- package/docs/tr/intlayer_CMS.md +152 -0
- package/docs/tr/intlayer_with_angular_21.md +9 -9
- package/docs/tr/intlayer_with_nestjs.md +2 -12
- package/docs/tr/intlayer_with_nextjs_15.md +1 -33
- package/docs/tr/intlayer_with_solid_start.md +1078 -0
- package/docs/tr/intlayer_with_vite+vue.md +1 -3
- package/docs/tr/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/tr/packages/vite-intlayer/exports.md +15 -0
- package/docs/tr/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/tr/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/tr/self_hosting.md +47 -50
- package/docs/uk/analytics.md +222 -0
- package/docs/uk/configuration.md +25 -8
- package/docs/uk/dictionary/nesting.md +47 -30
- package/docs/uk/formatters.md +128 -185
- package/docs/uk/intlayer_CMS.md +152 -0
- package/docs/uk/intlayer_with_angular_21.md +9 -9
- package/docs/uk/intlayer_with_nextjs_14.md +1 -26
- package/docs/uk/intlayer_with_solid_start.md +1078 -0
- package/docs/uk/packages/react-intlayer/useDictionary.md +2 -19
- package/docs/uk/packages/vite-intlayer/exports.md +15 -0
- package/docs/uk/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/uk/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/uk/releases/v9.md +0 -15
- package/docs/uk/self_hosting.md +60 -50
- package/docs/ur/configuration.md +25 -8
- package/docs/ur/intlayer_with_angular_21.md +9 -9
- package/docs/vi/analytics.md +222 -0
- package/docs/vi/configuration.md +24 -8
- package/docs/vi/dictionary/nesting.md +37 -184
- package/docs/vi/formatters.md +208 -309
- package/docs/vi/intlayer_CMS.md +164 -0
- package/docs/vi/intlayer_with_angular_21.md +9 -9
- package/docs/vi/intlayer_with_nextjs_14.md +0 -25
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +70 -63
- package/docs/vi/intlayer_with_solid_start.md +1078 -0
- package/docs/vi/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/vi/packages/react-intlayer/useIntlayer.md +2 -2
- package/docs/vi/packages/vite-intlayer/exports.md +15 -0
- package/docs/vi/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/vi/packages/vite-intlayer/intlayerPrune.md +77 -4
- package/docs/vi/plugins/sync-json.md +6 -6
- package/docs/vi/releases/v9.md +12 -0
- package/docs/vi/self_hosting.md +61 -50
- package/docs/zh/CI_CD.md +4 -0
- package/docs/zh/analytics.md +222 -0
- package/docs/zh/autoFill.md +28 -9
- package/docs/zh/configuration.md +24 -8
- package/docs/zh/dictionary/file.md +2 -0
- package/docs/zh/dictionary/nesting.md +47 -30
- package/docs/zh/formatters.md +140 -188
- package/docs/zh/intlayer_CMS.md +164 -0
- package/docs/zh/intlayer_with_analog.md +193 -3
- package/docs/zh/intlayer_with_angular_19.md +272 -3
- package/docs/zh/intlayer_with_angular_21.md +7 -7
- package/docs/zh/intlayer_with_create_react_app.md +348 -26
- package/docs/zh/intlayer_with_lynx+react.md +263 -4
- package/docs/zh/intlayer_with_nextjs_14.md +1 -28
- package/docs/zh/intlayer_with_nextjs_15.md +1 -33
- package/docs/zh/intlayer_with_nextjs_no_locale_path.md +558 -1
- package/docs/zh/intlayer_with_nuxt.md +182 -7
- package/docs/zh/intlayer_with_react_router_v7.md +183 -25
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +306 -42
- package/docs/zh/intlayer_with_solid_start.md +1077 -0
- package/docs/zh/intlayer_with_storybook.md +260 -3
- package/docs/zh/intlayer_with_svelte_kit.md +428 -48
- package/docs/zh/intlayer_with_tanstack+solid.md +713 -13
- package/docs/zh/intlayer_with_tanstack.md +731 -20
- package/docs/zh/intlayer_with_vanilla.md +314 -4
- package/docs/zh/intlayer_with_vite+lit.md +465 -4
- package/docs/zh/intlayer_with_vite+preact.md +422 -116
- package/docs/zh/intlayer_with_vite+react.md +324 -45
- package/docs/zh/intlayer_with_vite+react_compiler.md +228 -13
- package/docs/zh/intlayer_with_vite+solid.md +462 -32
- package/docs/zh/intlayer_with_vite+vanilla.md +497 -4
- package/docs/zh/mcp_server.md +3 -9
- package/docs/zh/packages/intlayer/getLocalizedUrl.md +26 -24
- package/docs/zh/packages/intlayer/getMultilingualUrls.md +4 -18
- package/docs/zh/packages/vite-intlayer/exports.md +29 -0
- package/docs/zh/packages/vite-intlayer/intlayer.md +121 -6
- package/docs/zh/packages/vite-intlayer/intlayerPrune.md +79 -6
- package/docs/zh/releases/v9.md +12 -0
- package/docs/zh/self_hosting.md +60 -50
- package/docs/zh-TW/intlayer_with_angular_21.md +7 -7
- package/package.json +6 -6
- package/src/generated/blog.entry.ts +27 -27
- package/src/generated/docs.entry.ts +234 -214
- package/src/generated/frequentQuestions.entry.ts +17 -17
- package/src/generated/legal.entry.ts +2 -2
package/docs/zh/formatters.md
CHANGED
|
@@ -46,34 +46,6 @@ author: aymericzip
|
|
|
46
46
|
|
|
47
47
|
Intlayer 提供了一组基于原生 `Intl` API 构建的轻量级辅助工具,以及一个缓存的 `Intl` 包装器,避免重复构建重量级的格式化器。这些工具完全支持本地化,可以直接从主 `intlayer` 包中使用。
|
|
48
48
|
|
|
49
|
-
### 导入
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
import {
|
|
53
|
-
Intl,
|
|
54
|
-
number,
|
|
55
|
-
percentage,
|
|
56
|
-
currency,
|
|
57
|
-
date,
|
|
58
|
-
relativeTime,
|
|
59
|
-
units,
|
|
60
|
-
compact,
|
|
61
|
-
list,
|
|
62
|
-
getLocaleName,
|
|
63
|
-
getLocaleLang,
|
|
64
|
-
getLocaleFromPath,
|
|
65
|
-
getPathWithoutLocale,
|
|
66
|
-
getLocalizedUrl,
|
|
67
|
-
getHTMLTextDir,
|
|
68
|
-
getContent,
|
|
69
|
-
getTranslation,
|
|
70
|
-
getIntlayer,
|
|
71
|
-
getIntlayerAsync,
|
|
72
|
-
} from "intlayer";
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
如果您使用 React,也可以使用 hooks;请参见 `react-intlayer/format`。
|
|
76
|
-
|
|
77
49
|
## 缓存的 Intl
|
|
78
50
|
|
|
79
51
|
导出的 `Intl` 是对全局 `Intl` 的一个轻量级缓存包装器。它会缓存 `NumberFormat`、`DateTimeFormat`、`RelativeTimeFormat`、`ListFormat`、`DisplayNames`、`Collator` 和 `PluralRules` 的实例,从而避免重复构建相同的格式化器。
|
|
@@ -110,72 +82,8 @@ pluralRules.select(1); // "one"
|
|
|
110
82
|
pluralRules.select(2); // "other"
|
|
111
83
|
```
|
|
112
84
|
|
|
113
|
-
## 额外的 Intl 工具
|
|
114
|
-
|
|
115
|
-
除了格式化辅助工具外,您还可以直接使用缓存的 Intl 包装器来使用其他 Intl 功能:
|
|
116
|
-
|
|
117
|
-
### `Intl.DisplayNames`
|
|
118
|
-
|
|
119
|
-
用于获取语言、地区、货币和书写系统的本地化名称:
|
|
120
|
-
|
|
121
|
-
```ts
|
|
122
|
-
import { Intl } from "intlayer";
|
|
123
|
-
|
|
124
|
-
const languageNames = new Intl.DisplayNames("en", { type: "language" });
|
|
125
|
-
languageNames.of("fr"); // "French"
|
|
126
|
-
|
|
127
|
-
const regionNames = new Intl.DisplayNames("fr", { type: "region" });
|
|
128
|
-
regionNames.of("US"); // "États-Unis"
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### `Intl.Collator`
|
|
132
|
-
|
|
133
|
-
用于基于区域设置的字符串比较和排序:
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
import { Intl } from "intlayer";
|
|
137
|
-
|
|
138
|
-
const collator = new Intl.Collator("de", {
|
|
139
|
-
sensitivity: "base",
|
|
140
|
-
numeric: true,
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
const words = ["äpfel", "zebra", "100", "20"];
|
|
144
|
-
words.sort(collator.compare); // ["20", "100", "äpfel", "zebra"]
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### `Intl.PluralRules`
|
|
148
|
-
|
|
149
|
-
用于确定不同区域设置中的复数形式:
|
|
150
|
-
|
|
151
|
-
```ts
|
|
152
|
-
import { Intl } from "intlayer";
|
|
153
|
-
|
|
154
|
-
const pluralRules = new Intl.PluralRules("ar");
|
|
155
|
-
pluralRules.select(0); // "zero"
|
|
156
|
-
pluralRules.select(1); // "one"
|
|
157
|
-
pluralRules.select(2); // "two"
|
|
158
|
-
pluralRules.select(3); // "few"
|
|
159
|
-
pluralRules.select(11); // "many"
|
|
160
|
-
```
|
|
161
|
-
|
|
162
85
|
## 区域设置工具
|
|
163
86
|
|
|
164
|
-
### `getLocaleName(displayLocale, targetLocale?)`
|
|
165
|
-
|
|
166
|
-
获取某个区域设置在另一种区域设置中的本地化名称:
|
|
167
|
-
|
|
168
|
-
```ts
|
|
169
|
-
import { getLocaleName } from "intlayer";
|
|
170
|
-
|
|
171
|
-
getLocaleName("fr", "en"); // "French"
|
|
172
|
-
getLocaleName("en", "fr"); // "anglais"
|
|
173
|
-
getLocaleName("de", "es"); // "alemán"
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
- **displayLocale**: 要获取名称的语言环境
|
|
177
|
-
- **targetLocale**: 用于显示名称的语言环境(默认为 displayLocale)
|
|
178
|
-
|
|
179
87
|
### `getLocaleLang(locale?)`
|
|
180
88
|
|
|
181
89
|
从语言环境字符串中提取语言代码:
|
|
@@ -206,22 +114,6 @@ getLocaleFromPath("https://example.com/es/about"); // "es"
|
|
|
206
114
|
- **inputUrl**:要处理的完整 URL 字符串或路径名
|
|
207
115
|
- **returns**:检测到的语言环境,如果未找到语言环境则返回默认语言环境
|
|
208
116
|
|
|
209
|
-
### `getPathWithoutLocale(inputUrl, locales?)`
|
|
210
|
-
|
|
211
|
-
从 URL 或路径名中移除语言环境段:
|
|
212
|
-
|
|
213
|
-
```ts
|
|
214
|
-
import { getPathWithoutLocale } from "intlayer";
|
|
215
|
-
|
|
216
|
-
getPathWithoutLocale("/en/dashboard"); // "/dashboard"
|
|
217
|
-
getPathWithoutLocale("/fr/dashboard"); // "/dashboard"
|
|
218
|
-
getPathWithoutLocale("https://example.com/en/about"); // "https://example.com/about"
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
- **inputUrl**:要处理的完整 URL 字符串或路径名
|
|
222
|
-
- **locales**:可选的支持语言数组(默认为配置的语言)
|
|
223
|
-
- **returns**:去除语言段后的 URL
|
|
224
|
-
|
|
225
117
|
### `getLocalizedUrl(url, currentLocale, locales?, defaultLocale?, prefixDefault?)`
|
|
226
118
|
|
|
227
119
|
为当前语言生成本地化 URL:
|
|
@@ -330,9 +222,11 @@ const content = await getIntlayerAsync("common", "fr");
|
|
|
330
222
|
|
|
331
223
|
以下所有辅助函数均从 `intlayer` 导出。
|
|
332
224
|
|
|
333
|
-
### `
|
|
225
|
+
### `percentage(value, options?)`
|
|
226
|
+
|
|
227
|
+
将数字格式化为百分比字符串。
|
|
334
228
|
|
|
335
|
-
|
|
229
|
+
行为:大于 1 的值被解释为完整的百分比并进行归一化(例如,`25` → `25%`,`0.25` → `25%`)。
|
|
336
230
|
|
|
337
231
|
- **value**: `number | string`
|
|
338
232
|
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
@@ -340,49 +234,121 @@ const content = await getIntlayerAsync("common", "fr");
|
|
|
340
234
|
示例:
|
|
341
235
|
|
|
342
236
|
```ts
|
|
343
|
-
import {
|
|
237
|
+
import { percentage } from "intlayer";
|
|
344
238
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
239
|
+
percentage(0.25); // "25%"
|
|
240
|
+
percentage(25); // "25%"
|
|
241
|
+
percentage(0.237, { minimumFractionDigits: 1 }); // "23.7%"
|
|
348
242
|
```
|
|
349
243
|
|
|
350
|
-
###
|
|
244
|
+
### 格式化器函数
|
|
351
245
|
|
|
352
|
-
|
|
246
|
+
#### `number(value, options?)`
|
|
353
247
|
|
|
354
|
-
|
|
248
|
+
使用locale感知的分组和小数格式化数值。
|
|
355
249
|
|
|
356
250
|
- **value**: `number | string`
|
|
357
251
|
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
358
252
|
|
|
359
|
-
示例:
|
|
360
|
-
|
|
361
253
|
```ts
|
|
362
|
-
|
|
254
|
+
number(123456.789); // "123,456.789" (in en-US)
|
|
255
|
+
number("1000000", { locale: "fr" }); // "1 000 000"
|
|
256
|
+
number(1234.5, { minimumFractionDigits: 2 }); // "1,234.50"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### `percentage(value, options?)`
|
|
260
|
+
|
|
261
|
+
将数字格式化为百分比字符串。大于 1 的值会被规范化(例如,`25` → `25%`,`0.25` → `25%`)。
|
|
363
262
|
|
|
263
|
+
- **value**: `number | string`
|
|
264
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
265
|
+
|
|
266
|
+
```ts
|
|
364
267
|
percentage(0.25); // "25%"
|
|
365
268
|
percentage(25); // "25%"
|
|
366
269
|
percentage(0.237, { minimumFractionDigits: 1 }); // "23.7%"
|
|
367
270
|
```
|
|
368
271
|
|
|
369
|
-
|
|
272
|
+
#### `currency(value, options?)`
|
|
370
273
|
|
|
371
|
-
|
|
274
|
+
将值格式化为本地化货币。默认为 `USD`。
|
|
372
275
|
|
|
373
276
|
- **value**: `number | string`
|
|
374
277
|
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
375
|
-
-
|
|
376
|
-
|
|
377
|
-
示例:
|
|
278
|
+
- 常见: `currency`, `currencyDisplay` (`"symbol" | "code" | "name"`)
|
|
378
279
|
|
|
379
280
|
```ts
|
|
380
|
-
import { currency } from "intlayer";
|
|
381
|
-
|
|
382
281
|
currency(1234.5, { currency: "EUR" }); // "€1,234.50"
|
|
383
282
|
currency("5000", { locale: "fr", currency: "CAD", currencyDisplay: "code" }); // "5 000,00 CAD"
|
|
384
283
|
```
|
|
385
284
|
|
|
285
|
+
#### `date(date, optionsOrPreset?)`
|
|
286
|
+
|
|
287
|
+
格式化日期/时间值。
|
|
288
|
+
|
|
289
|
+
- **date**: `Date | string | number`
|
|
290
|
+
- **optionsOrPreset**: `Intl.DateTimeFormatOptions & { locale?: LocalesValues }` 或预设: `"short" | "long" | "dateOnly" | "timeOnly" | "full"`
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
date(new Date(), "short"); // 例如 "08/02/25, 14:30"
|
|
294
|
+
date("2025-08-02T14:30:00Z", { locale: "fr", month: "long", day: "numeric" }); // "2 août"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### `relativeTime(from, to?, options?)`
|
|
298
|
+
|
|
299
|
+
格式化两个时刻之间的相对时间。
|
|
300
|
+
|
|
301
|
+
- **from**: `Date | string | number`
|
|
302
|
+
- **to**: `Date | string | number` (默认值为 `new Date()`)
|
|
303
|
+
- **options**: `{ locale?, unit?, numeric?, style? }`
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
const now = new Date();
|
|
307
|
+
const in3Days = new Date(now.getTime() + 3 * 864e5);
|
|
308
|
+
relativeTime(now, in3Days, { unit: "day" }); // "in 3 days"
|
|
309
|
+
|
|
310
|
+
const twoHoursAgo = new Date(now.getTime() - 2 * 3600e3);
|
|
311
|
+
relativeTime(now, twoHoursAgo, { unit: "hour", numeric: "auto" }); // "2 hours ago"
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
#### `units(value, options?)`
|
|
315
|
+
|
|
316
|
+
使用单位格式化数值。
|
|
317
|
+
|
|
318
|
+
- **value**: `number | string`
|
|
319
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
320
|
+
- 常见: `unit` (例如, `"kilometer"`, `"byte"`), `unitDisplay` (`"short" | "narrow" | "long"`)
|
|
321
|
+
|
|
322
|
+
```ts
|
|
323
|
+
units(5, { unit: "kilometer", unitDisplay: "long", locale: "en-GB" }); // "5 kilometers"
|
|
324
|
+
units(1024, { unit: "byte", unitDisplay: "narrow" }); // "1,024B"
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
#### `compact(value, options?)`
|
|
328
|
+
|
|
329
|
+
使用紧凑记号法格式化数字。
|
|
330
|
+
|
|
331
|
+
- **value**: `number | string`
|
|
332
|
+
- **options**: `Intl.NumberFormatOptions & { locale?: LocalesValues }`
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
compact(1200); // "1.2K"
|
|
336
|
+
compact("1000000", { locale: "fr", compactDisplay: "long" }); // "1 million"
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
#### `list(values, options?)`
|
|
340
|
+
|
|
341
|
+
将数组格式化为本地化列表字符串。
|
|
342
|
+
|
|
343
|
+
- **values**: `(string | number)[]`
|
|
344
|
+
- **options**: `Intl.ListFormatOptions & { locale?: LocalesValues }`
|
|
345
|
+
- 常见: `type` (`"conjunction" | "disjunction" | "unit"`), `style` (`"long" | "short" | "narrow"`)
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
list(["apple", "banana", "orange"]); // "apple, banana, and orange"
|
|
349
|
+
list(["red", "green", "blue"], { locale: "fr", type: "disjunction" }); // "rouge, vert ou bleu"
|
|
350
|
+
```
|
|
351
|
+
|
|
386
352
|
## 缓存的 Intl
|
|
387
353
|
|
|
388
354
|
从 `intlayer` 导出的 `Intl` 是围绕全局 `Intl` 的缓存包装器。它会缓存格式化程序实例(`NumberFormat`、`DateTimeFormat` 等),以避免重复构造它们,从而提高性能。
|
|
@@ -413,44 +379,68 @@ pluralRules.select(2); // "other"
|
|
|
413
379
|
|
|
414
380
|
### 额外的 Intl 功能
|
|
415
381
|
|
|
416
|
-
|
|
382
|
+
#### `Intl.DisplayNames`
|
|
417
383
|
|
|
418
|
-
|
|
384
|
+
用于获取本地化的语言、地区、货币和脚本名称:
|
|
419
385
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
- 预设值: `"short" | "long" | "dateOnly" | "timeOnly" | "full"`
|
|
386
|
+
```ts
|
|
387
|
+
import { Intl } from "intlayer";
|
|
423
388
|
|
|
424
|
-
|
|
389
|
+
const languageNames = new Intl.DisplayNames("en", { type: "language" });
|
|
390
|
+
languageNames.of("fr"); // "French"
|
|
391
|
+
|
|
392
|
+
const regionNames = new Intl.DisplayNames("fr", { type: "region" });
|
|
393
|
+
regionNames.of("US"); // "États-Unis"
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
#### `Intl.Collator`
|
|
397
|
+
|
|
398
|
+
用于区域感知的字符串比较和排序:
|
|
425
399
|
|
|
426
400
|
```ts
|
|
427
|
-
import {
|
|
401
|
+
import { Intl } from "intlayer";
|
|
428
402
|
|
|
429
|
-
|
|
430
|
-
|
|
403
|
+
const collator = new Intl.Collator("de", {
|
|
404
|
+
sensitivity: "base",
|
|
405
|
+
numeric: true,
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
const words = ["äpfel", "zebra", "100", "20"];
|
|
409
|
+
words.sort(collator.compare); // ["20", "100", "äpfel", "zebra"]
|
|
431
410
|
```
|
|
432
411
|
|
|
433
|
-
|
|
412
|
+
#### `Intl.PluralRules`
|
|
434
413
|
|
|
435
|
-
|
|
414
|
+
用于在不同的 locales 中确定复数形式:
|
|
436
415
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
416
|
+
```ts
|
|
417
|
+
import { Intl } from "intlayer";
|
|
418
|
+
|
|
419
|
+
const pluralRules = new Intl.PluralRules("ar");
|
|
420
|
+
pluralRules.select(0); // "zero"
|
|
421
|
+
pluralRules.select(1); // "one"
|
|
422
|
+
pluralRules.select(2); // "two"
|
|
423
|
+
pluralRules.select(3); // "few"
|
|
424
|
+
pluralRules.select(11); // "many"
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## 语言环境工具函数
|
|
428
|
+
|
|
429
|
+
### `date(date, optionsOrPreset?)`
|
|
430
|
+
|
|
431
|
+
使用 `Intl.DateTimeFormat` 格式化日期/时间值。
|
|
432
|
+
|
|
433
|
+
- **date**: `Date | string | number`
|
|
434
|
+
- **optionsOrPreset**: `Intl.DateTimeFormatOptions & { locale?: LocalesValues }` 或者以下预设之一:
|
|
435
|
+
- 预设值: `"short" | "long" | "dateOnly" | "timeOnly" | "full"`
|
|
442
436
|
|
|
443
437
|
示例:
|
|
444
438
|
|
|
445
439
|
```ts
|
|
446
|
-
import {
|
|
447
|
-
|
|
448
|
-
const now = new Date();
|
|
449
|
-
const in3Days = new Date(now.getTime() + 3 * 864e5);
|
|
450
|
-
relativeTime(now, in3Days, { unit: "day" }); // "in 3 days"
|
|
440
|
+
import { date } from "intlayer";
|
|
451
441
|
|
|
452
|
-
|
|
453
|
-
|
|
442
|
+
date(new Date(), "short"); // 例如,"08/02/25, 14:30"
|
|
443
|
+
date("2025-08-02T14:30:00Z", { locale: "fr", month: "long", day: "numeric" }); // "2 août"
|
|
454
444
|
```
|
|
455
445
|
|
|
456
446
|
### `units(value, options?)`
|
|
@@ -471,8 +461,6 @@ units(5, { unit: "kilometer", unitDisplay: "long", locale: "en-GB" }); // "5 kil
|
|
|
471
461
|
units(1024, { unit: "byte", unitDisplay: "narrow" }); // "1,024B"(依赖于区域设置)
|
|
472
462
|
```
|
|
473
463
|
|
|
474
|
-
## 地区工具
|
|
475
|
-
|
|
476
464
|
### `compact(value, options?)`
|
|
477
465
|
|
|
478
466
|
使用紧凑表示法格式化数字(例如,`1.2K`,`1M`)。
|
|
@@ -508,12 +496,6 @@ list(["red", "green", "blue"], { locale: "fr", type: "disjunction" }); // "rouge
|
|
|
508
496
|
list([1, 2, 3], { type: "unit" }); // "1, 2, 3"
|
|
509
497
|
```
|
|
510
498
|
|
|
511
|
-
## 说明
|
|
512
|
-
|
|
513
|
-
- 所有辅助函数都接受 `string` 类型的输入;它们会在内部被强制转换为数字或日期。
|
|
514
|
-
- 如果未提供,区域设置默认使用您配置的 `internationalization.defaultLocale`。
|
|
515
|
-
- 这些工具是轻量封装;对于高级格式化,请直接传递标准的 `Intl` 选项。
|
|
516
|
-
|
|
517
499
|
### `getPathWithoutLocale(inputUrl, locales?)`
|
|
518
500
|
|
|
519
501
|
从 URL 中移除语言区域段:
|
|
@@ -525,36 +507,6 @@ getPathWithoutLocale("/en/dashboard"); // "/dashboard"
|
|
|
525
507
|
getPathWithoutLocale("/fr/dashboard"); // "/dashboard"
|
|
526
508
|
```
|
|
527
509
|
|
|
528
|
-
## 入口点和重新导出(`@index.ts`)
|
|
529
|
-
|
|
530
|
-
格式化函数位于核心包中,并从更高级的包中重新导出,以保持跨运行时的导入简洁:
|
|
531
|
-
|
|
532
|
-
示例:
|
|
533
|
-
|
|
534
|
-
```ts
|
|
535
|
-
// 应用代码(推荐)
|
|
536
|
-
import {
|
|
537
|
-
number,
|
|
538
|
-
currency,
|
|
539
|
-
date,
|
|
540
|
-
relativeTime,
|
|
541
|
-
units,
|
|
542
|
-
compact,
|
|
543
|
-
list,
|
|
544
|
-
Intl,
|
|
545
|
-
getLocaleName,
|
|
546
|
-
getLocaleLang,
|
|
547
|
-
getLocaleFromPath,
|
|
548
|
-
getPathWithoutLocale,
|
|
549
|
-
getLocalizedUrl,
|
|
550
|
-
getHTMLTextDir,
|
|
551
|
-
getContent,
|
|
552
|
-
getTranslation,
|
|
553
|
-
getIntlayer,
|
|
554
|
-
getIntlayerAsync,
|
|
555
|
-
} from "intlayer";
|
|
556
|
-
```
|
|
557
|
-
|
|
558
510
|
### `getHTMLTextDir(locale?)`
|
|
559
511
|
|
|
560
512
|
返回一个 locale 的文本方向:
|
package/docs/zh/intlayer_CMS.md
CHANGED
|
@@ -244,12 +244,176 @@ bun x intlayer dictionary push -d my-first-dictionary-key --env production
|
|
|
244
244
|
|
|
245
245
|
然后,您将能够在 [Intlayer CMS](https://app.intlayer.org/content) 中查看和管理您的字典。
|
|
246
246
|
|
|
247
|
+
## 使用 `@intlayer/api` SDK 进行编程访问
|
|
248
|
+
|
|
249
|
+
除了 CLI 和可视化编辑器,Intlayer 在 [`@intlayer/api`](https://www.npmjs.com/package/@intlayer/api) 包中提供了一个类型化的 SDK。它让你可以将 CMS 视为一个**无头内容数据库**:你可以直接从自己的应用程序、脚本或 CI 流水线中获取项目、获取字典,以及推送或更新它们。
|
|
250
|
+
|
|
251
|
+
SDK 为你处理身份验证。只要你的 `clientId` 和 `clientSecret` 可用(在你的 Intlayer 配置或环境中),它就会自动获取和刷新 OAuth2 访问令牌,并对每个请求进行签名。
|
|
252
|
+
|
|
253
|
+
### 安装
|
|
254
|
+
|
|
255
|
+
```bash packageManager="npm"
|
|
256
|
+
npm install @intlayer/api
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
```bash packageManager="yarn"
|
|
260
|
+
yarn add @intlayer/api
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```bash packageManager="pnpm"
|
|
264
|
+
pnpm add @intlayer/api
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```bash packageManager="bun"
|
|
268
|
+
bun add @intlayer/api
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### 工作原理:身份验证器 + 端点
|
|
272
|
+
|
|
273
|
+
SDK 被拆分为**两个独立的导入**,目的是保持您的包体积小:
|
|
274
|
+
|
|
275
|
+
1. `createIntlayerCMS` — 创建一个轻量级**身份验证器**。它只携带凭证和托管的访问令牌;对任何特定的域一无所知。
|
|
276
|
+
2. `dictionaryEndpoint`、`projectEndpoint` 等 — 按域名的**端点绑定器**,每个都从自己的子路径导入(`@intlayer/api/dictionary`、`@intlayer/api/project` 等)。您将身份验证器传递给您需要的端点。
|
|
277
|
+
|
|
278
|
+
因为每个端点都是单独导入的,您的包只包含您实际使用的域 — 导入 `dictionaryEndpoint` 永远不会拉入项目、AI 或任何其他域客户端。
|
|
279
|
+
|
|
280
|
+
```typescript fileName="cms.ts" codeFormat="typescript"
|
|
281
|
+
import { createIntlayerCMS } from "@intlayer/api";
|
|
282
|
+
|
|
283
|
+
// 配置是可选的:当省略时,凭证从
|
|
284
|
+
// `@intlayer/config/built` 读取,该配置解析 INTLAYER_CLIENT_ID 和
|
|
285
|
+
// INTLAYER_CLIENT_SECRET 环境变量。
|
|
286
|
+
export const cmsAuthenticator = createIntlayerCMS();
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
> [!WARNING]
|
|
290
|
+
> CMS 凭证(`clientId` / `clientSecret`)授予您的内容**写入访问权限**。只在**服务器端**创建身份验证器(服务器操作、路由处理程序、脚本、CI)。永远不要将其导入客户端代码或向浏览器暴露您的凭证。
|
|
291
|
+
|
|
292
|
+
如果您更倾向于不依赖构建时配置,请显式传递凭证:
|
|
293
|
+
|
|
294
|
+
```typescript fileName="cms.ts" codeFormat="typescript"
|
|
295
|
+
import { createIntlayerCMS } from "@intlayer/api";
|
|
296
|
+
|
|
297
|
+
export const cmsAuthenticator = createIntlayerCMS({
|
|
298
|
+
editor: {
|
|
299
|
+
clientId: process.env.INTLAYER_CLIENT_ID,
|
|
300
|
+
clientSecret: process.env.INTLAYER_CLIENT_SECRET,
|
|
301
|
+
// 可选的,用于自托管后端:
|
|
302
|
+
// backendURL: process.env.INTLAYER_BACKEND_URL,
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
> 通过在 [Intlayer 仪表板 - 项目](https://app.intlayer.org/projects)中创建新的访问密钥来获取您的凭证。
|
|
308
|
+
|
|
309
|
+
### 获取项目
|
|
310
|
+
|
|
311
|
+
```typescript fileName="projects.ts" codeFormat="typescript"
|
|
312
|
+
import { createIntlayerCMS } from "@intlayer/api";
|
|
313
|
+
import { projectEndpoint } from "@intlayer/api/project";
|
|
314
|
+
|
|
315
|
+
const cmsAuthenticator = createIntlayerCMS();
|
|
316
|
+
|
|
317
|
+
// 列出您的凭证可访问的项目
|
|
318
|
+
const { data: projects } =
|
|
319
|
+
await projectEndpoint(cmsAuthenticator).getProjects();
|
|
320
|
+
|
|
321
|
+
// 读取所选项目的聚合本地化见解
|
|
322
|
+
const { data: insights } =
|
|
323
|
+
await projectEndpoint(cmsAuthenticator).getProjectInsights();
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### 获取字典
|
|
327
|
+
|
|
328
|
+
```typescript fileName="read-dictionaries.ts" codeFormat="typescript"
|
|
329
|
+
import { createIntlayerCMS } from "@intlayer/api";
|
|
330
|
+
import { dictionaryEndpoint } from "@intlayer/api/dictionary";
|
|
331
|
+
|
|
332
|
+
const cmsAuthenticator = createIntlayerCMS();
|
|
333
|
+
|
|
334
|
+
// 列出项目的所有远程字典
|
|
335
|
+
const { data: dictionaries } =
|
|
336
|
+
await dictionaryEndpoint(cmsAuthenticator).getDictionaries();
|
|
337
|
+
|
|
338
|
+
// 或按 key 获取单个字典
|
|
339
|
+
const { data: dictionary } = await dictionaryEndpoint(
|
|
340
|
+
cmsAuthenticator
|
|
341
|
+
).getDictionary("my-first-dictionary-key");
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### 推送和更新字典
|
|
345
|
+
|
|
346
|
+
使用 CMS 作为数据库来写回内容:
|
|
347
|
+
|
|
348
|
+
```typescript fileName="write-dictionaries.ts" codeFormat="typescript"
|
|
349
|
+
import { createIntlayerCMS } from "@intlayer/api";
|
|
350
|
+
import { dictionaryEndpoint } from "@intlayer/api/dictionary";
|
|
351
|
+
|
|
352
|
+
const cmsAuthenticator = createIntlayerCMS();
|
|
353
|
+
|
|
354
|
+
// 创建一个新的字典
|
|
355
|
+
await dictionaryEndpoint(cmsAuthenticator).addDictionary({
|
|
356
|
+
key: "my-first-dictionary-key",
|
|
357
|
+
content: { title: "Hello world" },
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
// 批量插入字典(在一次调用中创建或更新它们)
|
|
361
|
+
await dictionaryEndpoint(cmsAuthenticator).pushDictionaries([
|
|
362
|
+
{ key: "home", content: { title: "Home" } },
|
|
363
|
+
{ key: "about", content: { title: "About" } },
|
|
364
|
+
]);
|
|
365
|
+
|
|
366
|
+
// 更新现有字典
|
|
367
|
+
await dictionaryEndpoint(cmsAuthenticator).updateDictionary({
|
|
368
|
+
id: "<dictionary-id>",
|
|
369
|
+
key: "home",
|
|
370
|
+
content: { title: "Updated title" },
|
|
371
|
+
});
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
> 提示:重复使用绑定的端点以避免重复代码:
|
|
375
|
+
>
|
|
376
|
+
> ```typescript codeFormat="typescript"
|
|
377
|
+
> const dictionary = dictionaryEndpoint(cmsAuthenticator);
|
|
378
|
+
> await dictionary.pushDictionaries([myDictionary]);
|
|
379
|
+
> const { data } = await dictionary.getDictionaries();
|
|
380
|
+
> ```
|
|
381
|
+
|
|
382
|
+
### 提取单个方法
|
|
383
|
+
|
|
384
|
+
每个端点方法都已经过身份验证且独立(它包含自己的令牌处理),因此您可以提取一个并将其传递——例如将其注入作为依赖项:
|
|
385
|
+
|
|
386
|
+
```typescript fileName="push.ts" codeFormat="typescript"
|
|
387
|
+
import { createIntlayerCMS } from "@intlayer/api";
|
|
388
|
+
import { dictionaryEndpoint } from "@intlayer/api/dictionary";
|
|
389
|
+
|
|
390
|
+
const dictionary = dictionaryEndpoint(createIntlayerCMS());
|
|
391
|
+
|
|
392
|
+
// 已认证 — 每次调用时自动刷新令牌
|
|
393
|
+
export const pushDictionaries = dictionary.pushDictionaries;
|
|
394
|
+
|
|
395
|
+
// 使用示例
|
|
396
|
+
await pushDictionaries([{ key: "home", content: { title: "Home" } }]);
|
|
397
|
+
```
|
|
398
|
+
|
|
247
399
|
## 实时同步
|
|
248
400
|
|
|
249
401
|
实时同步让您的应用在运行时反映 CMS 内容的更改。无需重新构建或重新部署。启用后,更新会被流式传输到实时同步服务器,刷新您的应用读取的字典。
|
|
250
402
|
|
|
251
403
|
完整的设置指南(启用方式、启动 Live Sync 服务器、本地开发工作流程和限制条件)请参阅 [Live Sync 文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/live-sync.md)。
|
|
252
404
|
|
|
405
|
+
## 自托管
|
|
406
|
+
|
|
407
|
+
Intlayer 可以完全在您自己的基础设施上运行。一条命令可以使用 Docker Compose 启动完整的堆栈(仪表板、API、数据库、对象存储和电子邮件):
|
|
408
|
+
|
|
409
|
+
```sh
|
|
410
|
+
curl -fsSL https://intlayer.org/install.sh | sh
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
有关完整的设置指南、环境变量参考、升级说明和备份/恢复过程,请参阅[自托管指南](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/self_hosting.md)。
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
253
417
|
## 调试
|
|
254
418
|
|
|
255
419
|
如果您遇到 CMS 的任何问题,请检查以下内容:
|