@intlayer/docs 8.12.5-canary.0 → 9.0.0-canary.3
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/dist/cjs/generated/docs.entry.cjs +320 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +320 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +16 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/cli/doc-review.md +110 -4
- package/docs/ar/cli/index.md +1 -1
- package/docs/ar/cli/scan.md +1 -1
- package/docs/ar/configuration.md +36 -3
- package/docs/ar/dictionary/condition.md +167 -5
- package/docs/ar/dictionary/enumeration.md +540 -6
- package/docs/ar/dictionary/file.md +151 -1
- package/docs/ar/dictionary/gender.md +168 -7
- package/docs/ar/dictionary/nesting.md +173 -65
- package/docs/ar/dictionary/plurial.md +174 -5
- package/docs/ar/dictionary/translation.md +156 -2
- package/docs/ar/dynamic_dictionaries/collections.md +1 -1
- package/docs/ar/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/ar/dynamic_dictionaries/index.md +1 -1
- package/docs/ar/dynamic_dictionaries/variants.md +1 -1
- package/docs/ar/intlayer_with_vite+react.md +31 -31
- package/docs/ar/plugins/sync-json.md +222 -49
- package/docs/ar/releases/v8.md +187 -1
- package/docs/ar/releases/v9.md +232 -0
- package/docs/bn/cli/index.md +1 -1
- package/docs/bn/cli/scan.md +1 -1
- package/docs/bn/configuration.md +36 -3
- package/docs/cs/cli/index.md +1 -1
- package/docs/cs/cli/scan.md +1 -1
- package/docs/cs/configuration.md +35 -2
- package/docs/de/cli/doc-review.md +110 -4
- package/docs/de/cli/index.md +1 -1
- package/docs/de/cli/scan.md +1 -1
- package/docs/de/configuration.md +35 -2
- package/docs/de/dictionary/condition.md +167 -5
- package/docs/de/dictionary/enumeration.md +777 -7
- package/docs/de/dictionary/file.md +151 -1
- package/docs/de/dictionary/gender.md +168 -7
- package/docs/de/dictionary/nesting.md +173 -65
- package/docs/de/dictionary/plurial.md +347 -7
- package/docs/de/dictionary/translation.md +156 -2
- package/docs/de/dynamic_dictionaries/collections.md +1 -1
- package/docs/de/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/de/dynamic_dictionaries/index.md +1 -1
- package/docs/de/dynamic_dictionaries/variants.md +1 -1
- package/docs/de/intlayer_with_vite+react.md +48 -48
- package/docs/de/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/de/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/de/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/de/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/de/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/de/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/de/plugins/sync-json.md +222 -49
- package/docs/de/releases/v8.md +197 -1
- package/docs/de/releases/v9.md +232 -0
- package/docs/en/CI_CD.md +7 -7
- package/docs/en/cli/ci.md +62 -8
- package/docs/en/cli/doc-review.md +110 -4
- package/docs/en/cli/index.md +1 -1
- package/docs/en/cli/scan.md +1 -1
- package/docs/en/compat/i18n-js.md +44 -0
- package/docs/en/compat/i18next.md +59 -0
- package/docs/en/compat/index.md +51 -0
- package/docs/en/compat/lingui.md +44 -0
- package/docs/en/compat/next-i18next.md +57 -0
- package/docs/en/compat/next-intl.md +59 -0
- package/docs/en/compat/next-translate.md +45 -0
- package/docs/en/compat/ngx-translate.md +45 -0
- package/docs/en/compat/nuxtjs-i18n.md +46 -0
- package/docs/en/compat/polyglot.md +45 -0
- package/docs/en/compat/react-i18next.md +58 -0
- package/docs/en/compat/react-intl.md +55 -0
- package/docs/en/compat/svelte-i18n.md +47 -0
- package/docs/en/compat/transloco.md +45 -0
- package/docs/en/compat/vue-i18n.md +58 -0
- package/docs/en/configuration.md +35 -2
- package/docs/en/dictionary/condition.md +163 -1
- package/docs/en/dictionary/enumeration.md +309 -7
- package/docs/en/dictionary/file.md +151 -1
- package/docs/en/dictionary/gender.md +162 -1
- package/docs/en/dictionary/nesting.md +173 -9
- package/docs/en/dictionary/plurial.md +155 -10
- package/docs/en/dictionary/translation.md +145 -52
- package/docs/en/dynamic_dictionaries/collections.md +1 -1
- package/docs/en/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/en/dynamic_dictionaries/index.md +1 -1
- package/docs/en/dynamic_dictionaries/variants.md +1 -1
- package/docs/en/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/en/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/en/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/en/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/en/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/en/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/en/plugins/sync-json.md +56 -2
- package/docs/en/releases/v8.md +187 -1
- package/docs/en/releases/v9.md +220 -0
- package/docs/en-GB/cli/doc-review.md +110 -4
- package/docs/en-GB/cli/index.md +1 -1
- package/docs/en-GB/cli/scan.md +1 -1
- package/docs/en-GB/configuration.md +35 -2
- package/docs/en-GB/dictionary/condition.md +364 -1
- package/docs/en-GB/dictionary/enumeration.md +577 -5
- package/docs/en-GB/dictionary/file.md +317 -1
- package/docs/en-GB/dictionary/gender.md +375 -2
- package/docs/en-GB/dictionary/nesting.md +368 -71
- package/docs/en-GB/dictionary/plurial.md +347 -7
- package/docs/en-GB/dictionary/translation.md +320 -32
- package/docs/en-GB/dynamic_dictionaries/collections.md +1 -1
- package/docs/en-GB/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/en-GB/dynamic_dictionaries/index.md +1 -1
- package/docs/en-GB/dynamic_dictionaries/variants.md +1 -1
- package/docs/en-GB/plugins/sync-json.md +245 -13
- package/docs/en-GB/releases/v8.md +1 -1
- package/docs/en-GB/releases/v9.md +220 -0
- package/docs/es/cli/doc-review.md +110 -4
- package/docs/es/cli/index.md +1 -1
- package/docs/es/cli/scan.md +1 -1
- package/docs/es/configuration.md +36 -3
- package/docs/es/dictionary/condition.md +167 -5
- package/docs/es/dictionary/enumeration.md +537 -12
- package/docs/es/dictionary/file.md +151 -1
- package/docs/es/dictionary/gender.md +168 -7
- package/docs/es/dictionary/nesting.md +173 -65
- package/docs/es/dictionary/plurial.md +347 -7
- package/docs/es/dictionary/translation.md +156 -2
- package/docs/es/dynamic_dictionaries/collections.md +1 -1
- package/docs/es/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/es/dynamic_dictionaries/index.md +1 -1
- package/docs/es/dynamic_dictionaries/variants.md +1 -1
- package/docs/es/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/es/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/es/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/es/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/es/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/es/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/es/plugins/sync-json.md +222 -49
- package/docs/es/releases/v8.md +187 -1
- package/docs/es/releases/v9.md +228 -0
- package/docs/fr/cli/doc-review.md +110 -4
- package/docs/fr/cli/index.md +1 -1
- package/docs/fr/cli/scan.md +1 -1
- package/docs/fr/configuration.md +49 -16
- package/docs/fr/dictionary/condition.md +369 -6
- package/docs/fr/dictionary/enumeration.md +540 -6
- package/docs/fr/dictionary/file.md +151 -1
- package/docs/fr/dictionary/gender.md +168 -7
- package/docs/fr/dictionary/nesting.md +357 -86
- package/docs/fr/dictionary/plurial.md +174 -5
- package/docs/fr/dictionary/translation.md +156 -2
- package/docs/fr/dynamic_dictionaries/collections.md +1 -1
- package/docs/fr/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/fr/dynamic_dictionaries/index.md +1 -1
- package/docs/fr/dynamic_dictionaries/variants.md +1 -1
- package/docs/fr/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/fr/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/fr/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/fr/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/fr/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/fr/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/fr/plugins/sync-json.md +244 -12
- package/docs/fr/releases/v8.md +187 -1
- package/docs/fr/releases/v9.md +220 -0
- package/docs/hi/cli/doc-review.md +110 -4
- package/docs/hi/cli/index.md +1 -1
- package/docs/hi/cli/scan.md +1 -1
- package/docs/hi/configuration.md +49 -16
- package/docs/hi/dictionary/condition.md +167 -5
- package/docs/hi/dictionary/enumeration.md +540 -6
- package/docs/hi/dictionary/file.md +151 -1
- package/docs/hi/dictionary/gender.md +168 -7
- package/docs/hi/dictionary/nesting.md +173 -65
- package/docs/hi/dictionary/plurial.md +174 -5
- package/docs/hi/dictionary/translation.md +155 -5
- package/docs/hi/dynamic_dictionaries/collections.md +1 -1
- package/docs/hi/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/hi/dynamic_dictionaries/index.md +1 -1
- package/docs/hi/dynamic_dictionaries/variants.md +1 -1
- package/docs/hi/plugins/sync-json.md +221 -48
- package/docs/hi/releases/v8.md +188 -2
- package/docs/hi/releases/v9.md +232 -0
- package/docs/id/cli/doc-review.md +110 -4
- package/docs/id/cli/index.md +1 -1
- package/docs/id/cli/scan.md +1 -1
- package/docs/id/configuration.md +35 -2
- package/docs/id/dictionary/condition.md +167 -5
- package/docs/id/dictionary/enumeration.md +540 -6
- package/docs/id/dictionary/file.md +318 -2
- package/docs/id/dictionary/gender.md +381 -8
- package/docs/id/dictionary/nesting.md +357 -86
- package/docs/id/dictionary/plurial.md +174 -5
- package/docs/id/dictionary/translation.md +156 -2
- package/docs/id/dynamic_dictionaries/collections.md +1 -1
- package/docs/id/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/id/dynamic_dictionaries/index.md +1 -1
- package/docs/id/dynamic_dictionaries/variants.md +1 -1
- package/docs/id/plugins/sync-json.md +222 -49
- package/docs/id/releases/v8.md +191 -2
- package/docs/id/releases/v9.md +232 -0
- package/docs/it/cli/doc-review.md +110 -4
- package/docs/it/cli/index.md +1 -1
- package/docs/it/cli/scan.md +1 -1
- package/docs/it/configuration.md +49 -16
- package/docs/it/dictionary/condition.md +167 -5
- package/docs/it/dictionary/enumeration.md +540 -6
- package/docs/it/dictionary/file.md +318 -2
- package/docs/it/dictionary/gender.md +168 -7
- package/docs/it/dictionary/nesting.md +173 -65
- package/docs/it/dictionary/plurial.md +347 -7
- package/docs/it/dictionary/translation.md +156 -2
- package/docs/it/dynamic_dictionaries/collections.md +1 -1
- package/docs/it/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/it/dynamic_dictionaries/index.md +1 -1
- package/docs/it/dynamic_dictionaries/variants.md +1 -1
- package/docs/it/intlayer_with_vite+react.md +0 -48
- package/docs/it/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/it/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/it/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/it/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/it/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/it/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/it/plugins/sync-json.md +224 -51
- package/docs/it/releases/v8.md +200 -2
- package/docs/it/releases/v9.md +232 -0
- package/docs/ja/cli/doc-review.md +110 -4
- package/docs/ja/cli/index.md +1 -1
- package/docs/ja/cli/scan.md +1 -1
- package/docs/ja/configuration.md +50 -17
- package/docs/ja/dictionary/condition.md +167 -5
- package/docs/ja/dictionary/enumeration.md +540 -6
- package/docs/ja/dictionary/file.md +151 -1
- package/docs/ja/dictionary/gender.md +168 -7
- package/docs/ja/dictionary/nesting.md +173 -65
- package/docs/ja/dictionary/plurial.md +174 -5
- package/docs/ja/dictionary/translation.md +169 -8
- package/docs/ja/dynamic_dictionaries/collections.md +1 -1
- package/docs/ja/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/ja/dynamic_dictionaries/index.md +1 -1
- package/docs/ja/dynamic_dictionaries/variants.md +1 -1
- package/docs/ja/intlayer_with_vite+react.md +290 -0
- package/docs/ja/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/ja/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/ja/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/ja/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/ja/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/ja/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/ja/plugins/sync-json.md +222 -49
- package/docs/ja/releases/v8.md +193 -4
- package/docs/ja/releases/v9.md +232 -0
- package/docs/ko/cli/doc-review.md +110 -4
- package/docs/ko/cli/index.md +1 -1
- package/docs/ko/cli/scan.md +1 -1
- package/docs/ko/configuration.md +49 -16
- package/docs/ko/dictionary/condition.md +167 -5
- package/docs/ko/dictionary/enumeration.md +540 -6
- package/docs/ko/dictionary/file.md +151 -1
- package/docs/ko/dictionary/gender.md +168 -7
- package/docs/ko/dictionary/nesting.md +173 -65
- package/docs/ko/dictionary/plurial.md +174 -5
- package/docs/ko/dictionary/translation.md +169 -8
- package/docs/ko/dynamic_dictionaries/collections.md +1 -1
- package/docs/ko/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/ko/dynamic_dictionaries/index.md +1 -1
- package/docs/ko/dynamic_dictionaries/variants.md +1 -1
- package/docs/ko/intlayer_with_vite+react.md +48 -490
- package/docs/ko/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/ko/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/ko/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/ko/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/ko/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/ko/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/ko/plugins/sync-json.md +223 -50
- package/docs/ko/releases/v8.md +192 -1
- package/docs/ko/releases/v9.md +232 -0
- package/docs/nl/cli/index.md +1 -1
- package/docs/nl/cli/scan.md +1 -1
- package/docs/nl/configuration.md +36 -3
- package/docs/pl/cli/doc-review.md +110 -4
- package/docs/pl/cli/index.md +1 -1
- package/docs/pl/cli/scan.md +1 -1
- package/docs/pl/configuration.md +35 -2
- package/docs/pl/dictionary/condition.md +167 -5
- package/docs/pl/dictionary/enumeration.md +540 -6
- package/docs/pl/dictionary/file.md +318 -2
- package/docs/pl/dictionary/gender.md +168 -7
- package/docs/pl/dictionary/nesting.md +173 -65
- package/docs/pl/dictionary/plurial.md +174 -5
- package/docs/pl/dictionary/translation.md +156 -2
- package/docs/pl/dynamic_dictionaries/collections.md +1 -1
- package/docs/pl/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/pl/dynamic_dictionaries/index.md +1 -1
- package/docs/pl/dynamic_dictionaries/variants.md +1 -1
- package/docs/pl/plugins/sync-json.md +246 -14
- package/docs/pl/releases/v8.md +188 -2
- package/docs/pl/releases/v9.md +232 -0
- package/docs/pt/cli/doc-review.md +110 -4
- package/docs/pt/cli/index.md +1 -1
- package/docs/pt/cli/scan.md +1 -1
- package/docs/pt/configuration.md +49 -16
- package/docs/pt/dictionary/condition.md +167 -5
- package/docs/pt/dictionary/enumeration.md +540 -6
- package/docs/pt/dictionary/file.md +151 -1
- package/docs/pt/dictionary/gender.md +168 -7
- package/docs/pt/dictionary/nesting.md +173 -65
- package/docs/pt/dictionary/plurial.md +347 -7
- package/docs/pt/dictionary/translation.md +156 -2
- package/docs/pt/dynamic_dictionaries/collections.md +1 -1
- package/docs/pt/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/pt/dynamic_dictionaries/index.md +1 -1
- package/docs/pt/dynamic_dictionaries/variants.md +1 -1
- package/docs/pt/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/pt/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/pt/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/pt/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/pt/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/pt/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/pt/plugins/sync-json.md +222 -49
- package/docs/pt/releases/v8.md +187 -1
- package/docs/pt/releases/v9.md +232 -0
- package/docs/ru/cli/doc-review.md +110 -4
- package/docs/ru/cli/index.md +1 -1
- package/docs/ru/cli/scan.md +1 -1
- package/docs/ru/configuration.md +35 -2
- package/docs/ru/dictionary/condition.md +366 -39
- package/docs/ru/dictionary/enumeration.md +777 -7
- package/docs/ru/dictionary/file.md +318 -2
- package/docs/ru/dictionary/gender.md +168 -7
- package/docs/ru/dictionary/nesting.md +368 -71
- package/docs/ru/dictionary/plurial.md +347 -7
- package/docs/ru/dictionary/translation.md +321 -33
- package/docs/ru/dynamic_dictionaries/collections.md +1 -1
- package/docs/ru/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/ru/dynamic_dictionaries/index.md +1 -1
- package/docs/ru/dynamic_dictionaries/variants.md +1 -1
- package/docs/ru/intlayer_with_vite+react.md +48 -47
- package/docs/ru/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/ru/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/ru/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/ru/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/ru/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/ru/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/ru/plugins/sync-json.md +269 -95
- package/docs/ru/releases/v8.md +194 -2
- package/docs/ru/releases/v9.md +232 -0
- package/docs/tr/cli/doc-review.md +110 -4
- package/docs/tr/cli/index.md +1 -1
- package/docs/tr/cli/scan.md +1 -1
- package/docs/tr/configuration.md +35 -2
- package/docs/tr/dictionary/condition.md +167 -5
- package/docs/tr/dictionary/enumeration.md +540 -6
- package/docs/tr/dictionary/file.md +151 -1
- package/docs/tr/dictionary/gender.md +168 -7
- package/docs/tr/dictionary/nesting.md +173 -65
- package/docs/tr/dictionary/plurial.md +174 -5
- package/docs/tr/dictionary/translation.md +156 -2
- package/docs/tr/dynamic_dictionaries/collections.md +1 -1
- package/docs/tr/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/tr/dynamic_dictionaries/index.md +1 -1
- package/docs/tr/dynamic_dictionaries/variants.md +1 -1
- package/docs/tr/migration_from_i18next_to_intlayer.md +1 -1
- package/docs/tr/migration_from_next-i18next_to_intlayer.md +1 -1
- package/docs/tr/migration_from_next-intl_to_intlayer.md +1 -1
- package/docs/tr/migration_from_nuxtjs_i18n_to_intlayer.md +1 -1
- package/docs/tr/migration_from_react-i18next_to_intlayer.md +1 -1
- package/docs/tr/migration_from_vue-i18n_to_intlayer.md +1 -1
- package/docs/tr/plugins/sync-json.md +222 -50
- package/docs/tr/releases/v8.md +187 -1
- package/docs/tr/releases/v9.md +232 -0
- package/docs/uk/cli/doc-review.md +110 -4
- package/docs/uk/cli/index.md +1 -1
- package/docs/uk/cli/scan.md +1 -1
- package/docs/uk/configuration.md +35 -2
- package/docs/uk/dictionary/condition.md +167 -5
- package/docs/uk/dictionary/enumeration.md +540 -6
- package/docs/uk/dictionary/file.md +318 -2
- package/docs/uk/dictionary/gender.md +381 -8
- package/docs/uk/dictionary/nesting.md +173 -65
- package/docs/uk/dictionary/plurial.md +174 -5
- package/docs/uk/dictionary/translation.md +156 -2
- package/docs/uk/dynamic_dictionaries/collections.md +1 -1
- package/docs/uk/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/uk/dynamic_dictionaries/index.md +1 -1
- package/docs/uk/dynamic_dictionaries/variants.md +1 -1
- package/docs/uk/plugins/sync-json.md +56 -2
- package/docs/uk/releases/v8.md +191 -3
- package/docs/uk/releases/v9.md +232 -0
- package/docs/ur/cli/index.md +1 -1
- package/docs/ur/cli/scan.md +1 -1
- package/docs/ur/configuration.md +36 -3
- package/docs/vi/cli/doc-review.md +110 -4
- package/docs/vi/cli/index.md +1 -1
- package/docs/vi/cli/scan.md +1 -1
- package/docs/vi/configuration.md +50 -17
- package/docs/vi/dictionary/condition.md +167 -5
- package/docs/vi/dictionary/enumeration.md +591 -14
- package/docs/vi/dictionary/file.md +318 -2
- package/docs/vi/dictionary/gender.md +168 -7
- package/docs/vi/dictionary/nesting.md +357 -86
- package/docs/vi/dictionary/plurial.md +174 -5
- package/docs/vi/dictionary/translation.md +156 -2
- package/docs/vi/dynamic_dictionaries/collections.md +1 -1
- package/docs/vi/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/vi/dynamic_dictionaries/index.md +1 -1
- package/docs/vi/dynamic_dictionaries/variants.md +1 -1
- package/docs/vi/plugins/sync-json.md +230 -57
- package/docs/vi/releases/v8.md +190 -1
- package/docs/vi/releases/v9.md +232 -0
- package/docs/zh/cli/doc-review.md +110 -4
- package/docs/zh/cli/index.md +1 -1
- package/docs/zh/cli/scan.md +1 -1
- package/docs/zh/configuration.md +49 -16
- package/docs/zh/dictionary/condition.md +167 -5
- package/docs/zh/dictionary/enumeration.md +540 -6
- package/docs/zh/dictionary/file.md +151 -1
- package/docs/zh/dictionary/gender.md +168 -7
- package/docs/zh/dictionary/nesting.md +173 -65
- package/docs/zh/dictionary/plurial.md +174 -5
- package/docs/zh/dictionary/translation.md +169 -8
- package/docs/zh/dynamic_dictionaries/collections.md +1 -1
- package/docs/zh/dynamic_dictionaries/dynamic_content.md +1 -1
- package/docs/zh/dynamic_dictionaries/index.md +1 -1
- package/docs/zh/dynamic_dictionaries/variants.md +1 -1
- package/docs/zh/intlayer_with_vite+react.md +48 -288
- package/docs/zh/plugins/sync-json.md +223 -50
- package/docs/zh/releases/v8.md +1 -1
- package/docs/zh/releases/v9.md +220 -0
- package/package.json +7 -7
- package/src/generated/docs.entry.ts +320 -0
- package/dist/esm/_virtual/_rolldown/runtime.mjs +0 -8
|
@@ -85,7 +85,10 @@ export default config;
|
|
|
85
85
|
|
|
86
86
|
## Sử dụng Dịch thuật trong Các Thành phần React
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
<Tabs group="framework">
|
|
89
|
+
<Tab label="React" value="react">
|
|
90
|
+
|
|
91
|
+
With `react-intlayer`, you can use translations in React components. Here's an example:
|
|
89
92
|
|
|
90
93
|
```jsx fileName="**/*.tsx" codeFormat={["typescript", "esm"]}
|
|
91
94
|
import type { FC } from "react";
|
|
@@ -104,7 +107,158 @@ const MyComponent: FC = () => {
|
|
|
104
107
|
export default MyComponent;
|
|
105
108
|
```
|
|
106
109
|
|
|
107
|
-
|
|
110
|
+
This component fetches the corresponding translation based on the current locale set in your application.
|
|
111
|
+
|
|
112
|
+
</Tab>
|
|
113
|
+
<Tab label="Next.js" value="nextjs">
|
|
114
|
+
|
|
115
|
+
With `next-intlayer`, you can use translations in React Server Components or Client Components. Here's an example in a Client Component:
|
|
116
|
+
|
|
117
|
+
```tsx fileName="**/*.tsx" codeFormat={["typescript", "esm"]}
|
|
118
|
+
"use client";
|
|
119
|
+
|
|
120
|
+
import type { FC } from "react";
|
|
121
|
+
import { useIntlayer } from "next-intlayer";
|
|
122
|
+
|
|
123
|
+
const MyComponent: FC = () => {
|
|
124
|
+
const content = useIntlayer("multi_lang");
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<div>
|
|
128
|
+
<p>{content.welcomeMessage}</p>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export default MyComponent;
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
</Tab>
|
|
137
|
+
<Tab label="Vue" value="vue">
|
|
138
|
+
|
|
139
|
+
With `vue-intlayer`, you can use translations in Vue components. Here's an example:
|
|
140
|
+
|
|
141
|
+
```vue fileName="**/*.vue"
|
|
142
|
+
<script setup lang="ts">
|
|
143
|
+
import { useIntlayer } from "vue-intlayer";
|
|
144
|
+
|
|
145
|
+
const content = useIntlayer("multi_lang");
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<template>
|
|
149
|
+
<div>
|
|
150
|
+
<p>{{ content.welcomeMessage }}</p>
|
|
151
|
+
</div>
|
|
152
|
+
</template>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
</Tab>
|
|
156
|
+
<Tab label="Svelte" value="svelte">
|
|
157
|
+
|
|
158
|
+
With `svelte-intlayer`, you can use translations in Svelte components. The hook returns a Svelte store. Here's an example:
|
|
159
|
+
|
|
160
|
+
```svelte fileName="**/*.svelte"
|
|
161
|
+
<script lang="ts">
|
|
162
|
+
import { useIntlayer } from "svelte-intlayer";
|
|
163
|
+
|
|
164
|
+
const content = useIntlayer("multi_lang");
|
|
165
|
+
</script>
|
|
166
|
+
|
|
167
|
+
<div>
|
|
168
|
+
<p>{$content.welcomeMessage}</p>
|
|
169
|
+
</div>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
</Tab>
|
|
173
|
+
<Tab label="Preact" value="preact">
|
|
174
|
+
|
|
175
|
+
With `preact-intlayer`, you can use translations in Preact components. Here's an example:
|
|
176
|
+
|
|
177
|
+
```tsx fileName="**/*.tsx" codeFormat={["typescript", "esm"]}
|
|
178
|
+
import type { FC } from "preact";
|
|
179
|
+
import { useIntlayer } from "preact-intlayer";
|
|
180
|
+
|
|
181
|
+
const MyComponent: FC = () => {
|
|
182
|
+
const content = useIntlayer("multi_lang");
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<div>
|
|
186
|
+
<p>{content.welcomeMessage}</p>
|
|
187
|
+
</div>
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export default MyComponent;
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
</Tab>
|
|
195
|
+
<Tab label="Solid" value="solid">
|
|
196
|
+
|
|
197
|
+
With `solid-intlayer`, you can use translations in SolidJS components. Here's an example:
|
|
198
|
+
|
|
199
|
+
```tsx fileName="**/*.tsx" codeFormat={["typescript", "esm"]}
|
|
200
|
+
import type { Component } from "solid-js";
|
|
201
|
+
import { useIntlayer } from "solid-intlayer";
|
|
202
|
+
|
|
203
|
+
const MyComponent: Component = () => {
|
|
204
|
+
const content = useIntlayer("multi_lang");
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<div>
|
|
208
|
+
<p>{content.welcomeMessage}</p>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export default MyComponent;
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
</Tab>
|
|
217
|
+
<Tab label="Angular" value="angular">
|
|
218
|
+
|
|
219
|
+
With `angular-intlayer`, you can use translations in Angular components. Here's an example:
|
|
220
|
+
|
|
221
|
+
```typescript fileName="app.component.ts" codeFormat="typescript"
|
|
222
|
+
import { Component } from "@angular/core";
|
|
223
|
+
import { useIntlayer } from "angular-intlayer";
|
|
224
|
+
|
|
225
|
+
@Component({
|
|
226
|
+
selector: "app-my-component",
|
|
227
|
+
template: `
|
|
228
|
+
<div>
|
|
229
|
+
<p>{{ content().welcomeMessage }}</p>
|
|
230
|
+
</div>
|
|
231
|
+
`,
|
|
232
|
+
})
|
|
233
|
+
export class MyComponent {
|
|
234
|
+
content = useIntlayer("multi_lang");
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
</Tab>
|
|
239
|
+
<Tab label="Vanilla JS" value="vanilla">
|
|
240
|
+
|
|
241
|
+
With `vanilla-intlayer`, you can use translations by subscribing to content changes. Here's an example:
|
|
242
|
+
|
|
243
|
+
```typescript fileName="**/*.ts" codeFormat={["typescript", "esm"]}
|
|
244
|
+
import { installIntlayer, useIntlayer } from "vanilla-intlayer";
|
|
245
|
+
|
|
246
|
+
installIntlayer();
|
|
247
|
+
|
|
248
|
+
const content = useIntlayer("multi_lang").onChange((newContent) => {
|
|
249
|
+
document.getElementById("welcome-message")!.textContent = String(
|
|
250
|
+
newContent.welcomeMessage
|
|
251
|
+
);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// Initial render
|
|
255
|
+
document.getElementById("welcome-message")!.textContent = String(
|
|
256
|
+
content.welcomeMessage
|
|
257
|
+
);
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
</Tab>
|
|
261
|
+
</Tabs>
|
|
108
262
|
|
|
109
263
|
## Đối tượng Nội dung Tùy chỉnh
|
|
110
264
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-13
|
|
3
|
-
updatedAt:
|
|
3
|
+
updatedAt: 2026-06-21
|
|
4
4
|
title: Plugin Đồng bộ JSON
|
|
5
5
|
description: Đồng bộ từ điển Intlayer với các tệp JSON i18n của bên thứ ba (i18next, next-intl, react-intl, vue-i18n và nhiều hơn nữa). Giữ nguyên i18n hiện có của bạn trong khi sử dụng Intlayer để quản lý, dịch và kiểm tra các thông điệp của bạn.
|
|
6
6
|
keywords:
|
|
@@ -24,6 +24,9 @@ slugs:
|
|
|
24
24
|
- sync-json
|
|
25
25
|
youtubeVideo: https://www.youtube.com/watch?v=MpGMxniDHNg
|
|
26
26
|
history:
|
|
27
|
+
- version: 9.0.0
|
|
28
|
+
date: 2026-06-21
|
|
29
|
+
changes: "Thêm tùy chọn splitKeys (một từ điển cho mỗi khóa namespace cấp cao nhất) cho bố cục tệp đơn của next-intl / react-intl"
|
|
27
30
|
- version: 7.5.0
|
|
28
31
|
date: 2025-12-13
|
|
29
32
|
changes: "Thêm hỗ trợ định dạng ICU và i18next"
|
|
@@ -62,9 +65,65 @@ pnpm add -D @intlayer/sync-json-plugin
|
|
|
62
65
|
npm i -D @intlayer/sync-json-plugin
|
|
63
66
|
```
|
|
64
67
|
|
|
65
|
-
##
|
|
68
|
+
## Plugins
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
This package provides two plugins:
|
|
71
|
+
|
|
72
|
+
- `loadJSON`: Load JSON files into Intlayer dictionaries.
|
|
73
|
+
- This plugin is used to load JSON files from a source and will be loaded into Intlayer dictionaries. It can scan all the codebase and search for specific JSON files.
|
|
74
|
+
This plugin can be used
|
|
75
|
+
- if you use an i18n library that impose a specific location for your JSON to be loaded (ex: `next-intl`, `i18next`, `react-intl`, `vue-i18n`, etc.), but you want to place your content declaration where you want in your code base.
|
|
76
|
+
- It can also be used if you want to fetch your messages from a remote source (ex: a CMS, a API, etc.) and store your messages in JSON files.
|
|
77
|
+
|
|
78
|
+
> Under the hood, this plugin will scan all the codebase and search for specific JSON files and load them into Intlayer dictionaries.
|
|
79
|
+
> Note that this plugin will not write the output and translations back to the JSON files.
|
|
80
|
+
|
|
81
|
+
- `syncJSON`: Synchronize JSON files with Intlayer dictionaries.
|
|
82
|
+
- This plugin is used to synchronize JSON files with Intlayer dictionaries. It can scan the given location and load the JSON that match the pattern for specific JSON files. This plugin is useful if you want to get the benefits of Intlayer while using another i18n library.
|
|
83
|
+
|
|
84
|
+
## Using both plugins
|
|
85
|
+
|
|
86
|
+
```ts fileName="intlayer.config.ts"
|
|
87
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
88
|
+
import { loadJSON, syncJSON } from "@intlayer/sync-json-plugin";
|
|
89
|
+
|
|
90
|
+
const config: IntlayerConfig = {
|
|
91
|
+
internationalization: {
|
|
92
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
93
|
+
defaultLocale: Locales.ENGLISH,
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
// Keep your current JSON files in sync with Intlayer dictionaries
|
|
97
|
+
plugins: [
|
|
98
|
+
/**
|
|
99
|
+
* Will load all the JSON files in the src that match the pattern {key}.i18n json
|
|
100
|
+
*/
|
|
101
|
+
loadJSON({
|
|
102
|
+
source: ({ key }) => `./src/**/${key}.i18n.json`,
|
|
103
|
+
locale: Locales.ENGLISH,
|
|
104
|
+
priority: 1, // Ensures these JSON files take precedence over files at `./locales/en/${key}.json`
|
|
105
|
+
format: "intlayer", // Format of the JSON content
|
|
106
|
+
}),
|
|
107
|
+
/**
|
|
108
|
+
* Will load, and write the output and translations back to the JSON files in the locales directory
|
|
109
|
+
*/
|
|
110
|
+
syncJSON({
|
|
111
|
+
format: "i18next",
|
|
112
|
+
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
113
|
+
priority: 0,
|
|
114
|
+
format: "i18next",
|
|
115
|
+
}),
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export default config;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## `syncJSON` plugin
|
|
123
|
+
|
|
124
|
+
### Quick start
|
|
125
|
+
|
|
126
|
+
Add the plugin to your `intlayer.config.ts` and point it at your existing JSON structure.
|
|
68
127
|
|
|
69
128
|
```ts fileName="intlayer.config.ts"
|
|
70
129
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
@@ -81,6 +140,7 @@ const config: IntlayerConfig = {
|
|
|
81
140
|
syncJSON({
|
|
82
141
|
// Bố cục theo từng locale, từng namespace (ví dụ: next-intl, i18next với namespaces)
|
|
83
142
|
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
143
|
+
format: "icu",
|
|
84
144
|
}),
|
|
85
145
|
],
|
|
86
146
|
};
|
|
@@ -91,11 +151,24 @@ export default config;
|
|
|
91
151
|
Phương án thay thế: một tệp duy nhất cho mỗi locale (thường dùng với i18next/react-intl):
|
|
92
152
|
|
|
93
153
|
```ts fileName="intlayer.config.ts"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
154
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
155
|
+
import { syncJSON } from "@intlayer/sync-json-plugin";
|
|
156
|
+
|
|
157
|
+
const config: IntlayerConfig = {
|
|
158
|
+
internationalization: {
|
|
159
|
+
locales: [Locales.ENGLISH, Locales.FRENCH],
|
|
160
|
+
defaultLocale: Locales.ENGLISH,
|
|
161
|
+
},
|
|
162
|
+
plugins: [
|
|
163
|
+
syncJSON({
|
|
164
|
+
format: "i18next",
|
|
165
|
+
source: ({ locale }) => `./locales/${locale}.json`,
|
|
166
|
+
format: "i18next",
|
|
167
|
+
}),
|
|
168
|
+
],
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export default config;
|
|
99
172
|
```
|
|
100
173
|
|
|
101
174
|
### Cách hoạt động
|
|
@@ -112,6 +185,7 @@ syncJSON({
|
|
|
112
185
|
location?: string, // nhãn tùy chọn, mặc định: "plugin"
|
|
113
186
|
priority?: number, // ưu tiên tùy chọn để giải quyết xung đột, mặc định: 0
|
|
114
187
|
format?: 'intlayer' | 'icu' | 'i18next', // bộ định dạng tùy chọn, được sử dụng cho tương thích runtime Intlayer
|
|
188
|
+
splitKeys?: boolean, // tùy chọn, chia một tệp thành một từ điển cho mỗi khóa cấp cao nhất (tự động phát hiện)
|
|
115
189
|
});
|
|
116
190
|
```
|
|
117
191
|
|
|
@@ -136,18 +210,50 @@ syncJSON({
|
|
|
136
210
|
}),
|
|
137
211
|
```
|
|
138
212
|
|
|
139
|
-
|
|
213
|
+
#### `splitKeys` (boolean)
|
|
140
214
|
|
|
141
|
-
|
|
215
|
+
Kiểm soát liệu một tệp JSON duy nhất mà **các khóa cấp đầu tiên là các namespace** có nên trở thành một từ điển cho mỗi khóa cấp cao nhất, thay vì một từ điển duy nhất chứa toàn bộ tệp.
|
|
142
216
|
|
|
143
|
-
|
|
217
|
+
Điều này phù hợp với mô hình namespace của các thư viện như `next-intl` và `react-intl`, nơi một tệp `messages/{locale}.json` nhóm nhiều namespace theo các khóa cấp đầu tiên của nó, mỗi khóa được xử lý độc lập (ví dụ: `useTranslations('Hero')` phân giải thành từ điển `Hero`).
|
|
144
218
|
|
|
145
|
-
|
|
219
|
+
- `undefined` (mặc định): **tự động phát hiện** — tệp được chia khi mẫu `source` không có phân đoạn `{key}` (một tệp chứa mọi namespace), và được giữ dưới dạng một từ điển duy nhất nếu không (một tệp cho mỗi khóa).
|
|
220
|
+
- `true`: luôn chia mỗi khóa cấp cao nhất thành từ điển riêng của nó.
|
|
221
|
+
- `false`: không bao giờ chia; toàn bộ tệp trở thành một từ điển duy nhất.
|
|
146
222
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
223
|
+
Given a single `messages/{locale}.json` file:
|
|
224
|
+
|
|
225
|
+
```json fileName="messages/en.json"
|
|
226
|
+
{
|
|
227
|
+
"Hero": { "title": "Full-stack developer" },
|
|
228
|
+
"Nav": { "work": "Work", "about": "About" },
|
|
229
|
+
"About": { "lead": "I build apps end to end." }
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
```ts fileName="intlayer.config.ts"
|
|
234
|
+
syncJSON({
|
|
235
|
+
format: "icu",
|
|
236
|
+
source: ({ locale }) => `./messages/${locale}.json`,
|
|
237
|
+
// splitKeys: true, // implied because the pattern has no `{key}` segment
|
|
238
|
+
}),
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Điều này tạo ra ba từ điển — `Hero`, `Nav`, và `About` — do đó `useTranslations('Hero')` (next-intl) phân giải chính xác. Khi ghi lại, tất cả các namespace được tập hợp lại vào cùng một tệp theo từng locale.
|
|
242
|
+
|
|
243
|
+
> Khi bạn giữ phân đoạn `{key}` rõ ràng trong `source` của mình (ví dụ: `./locales/${locale}/${key}.json`), mỗi tệp đã là một namespace, vì vậy việc chia tách bị tắt theo mặc định.
|
|
244
|
+
|
|
245
|
+
### Multiple JSON sources and priority
|
|
246
|
+
|
|
247
|
+
You can add multiple `syncJSON` plugins to synchronize different JSON sources. This is useful when you have multiple i18n libraries or different JSON structures in your project.
|
|
248
|
+
|
|
249
|
+
#### Priority system
|
|
250
|
+
|
|
251
|
+
When multiple plugins target the same dictionary key, the `priority` parameter determines which plugin takes precedence:
|
|
252
|
+
|
|
253
|
+
- Higher priority numbers win over lower ones
|
|
254
|
+
- Default priority of `.content` files is `0`
|
|
255
|
+
- Default priority of plugins is `0`
|
|
256
|
+
- Plugins with the same priority are processed in the order they appear in the configuration
|
|
151
257
|
|
|
152
258
|
```ts fileName="intlayer.config.ts"
|
|
153
259
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
@@ -189,73 +295,140 @@ const config: IntlayerConfig = {
|
|
|
189
295
|
export default config;
|
|
190
296
|
```
|
|
191
297
|
|
|
192
|
-
|
|
298
|
+
## Load JSON plugin
|
|
193
299
|
|
|
194
|
-
|
|
300
|
+
### Quick start
|
|
195
301
|
|
|
196
|
-
|
|
197
|
-
2. Các nguồn có mức ưu tiên thấp hơn được sử dụng làm phương án dự phòng cho các khóa bị thiếu
|
|
198
|
-
3. Điều này cho phép bạn duy trì các bản dịch kế thừa trong khi dần dần chuyển sang các cấu trúc mới
|
|
302
|
+
Add the plugin to your `intlayer.config.ts` to ingest existing JSON files as Intlayer dictionaries. This plugin is read‑only (no writes to disk):
|
|
199
303
|
|
|
200
|
-
|
|
304
|
+
```ts fileName="intlayer.config.ts"
|
|
305
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
306
|
+
import { loadJSON } from "@intlayer/sync-json-plugin";
|
|
307
|
+
|
|
308
|
+
const config: IntlayerConfig = {
|
|
309
|
+
internationalization: {
|
|
310
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
311
|
+
defaultLocale: Locales.ENGLISH,
|
|
312
|
+
},
|
|
201
313
|
|
|
202
|
-
|
|
314
|
+
plugins: [
|
|
315
|
+
// Ingest JSON messages located anywhere in your source tree
|
|
316
|
+
loadJSON({
|
|
317
|
+
source: ({ key }) => `./src/**/${key}.i18n.json`,
|
|
318
|
+
// Load a single locale per plugin instance (defaults to the config defaultLocale)
|
|
319
|
+
locale: Locales.ENGLISH,
|
|
320
|
+
priority: 0,
|
|
321
|
+
}),
|
|
322
|
+
],
|
|
323
|
+
};
|
|
203
324
|
|
|
204
|
-
|
|
325
|
+
export default config;
|
|
326
|
+
```
|
|
205
327
|
|
|
206
|
-
|
|
328
|
+
Alternative: per‑locale layout, still read‑only (only the selected locale is loaded):
|
|
207
329
|
|
|
208
330
|
```ts fileName="intlayer.config.ts"
|
|
209
|
-
import {
|
|
331
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
332
|
+
import { loadJSON } from "@intlayer/sync-json-plugin";
|
|
210
333
|
|
|
211
|
-
|
|
334
|
+
const config: IntlayerConfig = {
|
|
335
|
+
internationalization: {
|
|
336
|
+
locales: [Locales.ENGLISH, Locales.FRENCH],
|
|
337
|
+
defaultLocale: Locales.ENGLISH,
|
|
338
|
+
},
|
|
212
339
|
plugins: [
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
340
|
+
loadJSON({
|
|
341
|
+
// Only files for Locales.FRENCH will be loaded from this pattern
|
|
342
|
+
source: ({ key, locale }) => `./locales/${locale}/${key}.json`,
|
|
343
|
+
locale: Locales.FRENCH,
|
|
216
344
|
}),
|
|
217
345
|
],
|
|
218
346
|
};
|
|
347
|
+
|
|
348
|
+
export default config;
|
|
219
349
|
```
|
|
220
350
|
|
|
221
|
-
###
|
|
351
|
+
### How it works
|
|
222
352
|
|
|
223
|
-
|
|
353
|
+
- Discover: builds a glob from your `source` builder and collects matching JSON files.
|
|
354
|
+
- Ingest: loads each JSON file as an Intlayer dictionary with the provided `locale`.
|
|
355
|
+
- Read‑only: does not write or format output files; use `syncJSON` if you need round‑trip sync.
|
|
356
|
+
- Auto‑fill ready: defines a `fill` pattern so `intlayer content fill` can populate missing keys.
|
|
224
357
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
358
|
+
### API
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
loadJSON({
|
|
362
|
+
// Build paths to your JSON. `locale` is optional if your structure has no locale segment
|
|
363
|
+
source: ({ key, locale }) => string,
|
|
364
|
+
|
|
365
|
+
// Target locale for the dictionaries loaded by this plugin instance
|
|
366
|
+
// Defaults to configuration.internationalization.defaultLocale
|
|
367
|
+
locale?: Locale,
|
|
368
|
+
|
|
369
|
+
// Optional label to identify the source
|
|
370
|
+
location?: string, // default: "plugin"
|
|
371
|
+
|
|
372
|
+
// Priority used for conflict resolution against other sources
|
|
373
|
+
priority?: number, // default: 0
|
|
374
|
+
|
|
375
|
+
// Optional formatter for the JSON content
|
|
376
|
+
format?: 'intlayer' | 'icu' | 'i18next', // default: 'intlayer'
|
|
377
|
+
|
|
378
|
+
// Split a single file into one dictionary per top-level key (auto-detected)
|
|
379
|
+
splitKeys?: boolean,
|
|
380
|
+
});
|
|
231
381
|
```
|
|
232
382
|
|
|
233
|
-
|
|
383
|
+
#### `format` ('intlayer' | 'icu' | 'i18next')
|
|
234
384
|
|
|
235
|
-
|
|
385
|
+
Chỉ định bộ định dạng sẽ được sử dụng cho nội dung từ điển khi tải các tệp JSON. Điều này cho phép sử dụng các cú pháp định dạng thông báo khác nhau tương thích với các thư viện i18n khác nhau.
|
|
386
|
+
|
|
387
|
+
- `'intlayer'`: Bộ định dạng Intlayer mặc định (mặc định).
|
|
388
|
+
- `'icu'`: Sử dụng định dạng thông báo ICU (tương thích với các thư viện như react-intl, vue-i18n).
|
|
389
|
+
- `'i18next'`: Sử dụng định dạng thông báo i18next (tương thích với i18next, next-i18next, Solid-i18next).
|
|
236
390
|
|
|
237
|
-
|
|
391
|
+
**Ví dụ:**
|
|
238
392
|
|
|
239
|
-
```ts
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
393
|
+
```ts
|
|
394
|
+
loadJSON({
|
|
395
|
+
source: ({ key }) => `./src/**/${key}.i18n.json`,
|
|
396
|
+
locale: Locales.ENGLISH,
|
|
397
|
+
format: "icu", // Sử dụng định dạng ICU để tương thích
|
|
398
|
+
}),
|
|
245
399
|
```
|
|
246
400
|
|
|
247
|
-
|
|
401
|
+
#### `splitKeys` (boolean)
|
|
248
402
|
|
|
249
|
-
|
|
403
|
+
Hành vi tương tự như trong [`syncJSON`](#splitkeys-boolean): khi một tệp JSON duy nhất nhóm nhiều namespace theo các khóa cấp đầu tiên của nó, mỗi khóa cấp cao nhất sẽ trở thành từ điển riêng của nó.
|
|
250
404
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
405
|
+
- `undefined` (mặc định): **tự động phát hiện** — chia khi mẫu `source` không có phân đoạn `{key}`, nếu không thì là một từ điển duy nhất.
|
|
406
|
+
- `true` / `false`: buộc hoặc tắt chia tách.
|
|
407
|
+
|
|
408
|
+
```ts
|
|
409
|
+
loadJSON({
|
|
410
|
+
source: ({ locale }) => `./messages/${locale}.json`,
|
|
411
|
+
format: "icu",
|
|
412
|
+
// splitKeys auto-enabled: `Hero`, `Nav`, `About`, … each become a dictionary
|
|
413
|
+
}),
|
|
257
414
|
```
|
|
258
415
|
|
|
416
|
+
### Behavior and conventions
|
|
417
|
+
|
|
418
|
+
- If your `source` mask includes a locale placeholder, only files for the selected `locale` are ingested.
|
|
419
|
+
- Nếu không có phân đoạn `{key}` trong mặt nạ của bạn, mỗi khóa cấp cao nhất của tệp sẽ trở thành từ điển riêng của nó theo mặc định (xem [`splitKeys`](#splitkeys-boolean)). Đặt `splitKeys: false` để thay vào đó tải toàn bộ tệp dưới dạng một từ điển `index` duy nhất.
|
|
420
|
+
- Keys are derived from file paths by substituting the `{key}` placeholder in your `source` builder.
|
|
421
|
+
- The plugin only uses discovered files and does not fabricate missing locales or keys.
|
|
422
|
+
- The `fill` path is inferred from your `source` and used to update missing values via CLI when you opt‑in.
|
|
423
|
+
|
|
424
|
+
## Conflict resolution
|
|
425
|
+
|
|
426
|
+
When the same translation key exists in multiple JSON sources:
|
|
427
|
+
|
|
428
|
+
1. The plugin with the highest priority determines the final value
|
|
429
|
+
2. Lower priority sources are used as fallbacks for missing keys
|
|
430
|
+
3. This allows you to maintain legacy translations while gradually migrating to new structures
|
|
431
|
+
|
|
259
432
|
## CLI
|
|
260
433
|
|
|
261
434
|
Các tệp JSON được đồng bộ sẽ được coi như các tệp `.content` khác. Điều đó có nghĩa là tất cả các lệnh intlayer sẽ có sẵn cho các tệp JSON được đồng bộ. Bao gồm:
|
|
@@ -268,13 +441,13 @@ Các tệp JSON được đồng bộ sẽ được coi như các tệp `.conten
|
|
|
268
441
|
|
|
269
442
|
Xem [Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/vi/cli/index.md) để biết thêm chi tiết.
|
|
270
443
|
|
|
271
|
-
##
|
|
444
|
+
## Limitations (current)
|
|
272
445
|
|
|
273
446
|
- Không hỗ trợ chèn hoặc số nhiều/ICU khi nhắm mục tiêu các thư viện bên thứ ba.
|
|
274
447
|
- Trình chỉnh sửa trực quan chưa có sẵn cho các runtime không phải Intlayer.
|
|
275
448
|
- Chỉ đồng bộ JSON; không hỗ trợ các định dạng danh mục không phải JSON.
|
|
276
449
|
|
|
277
|
-
##
|
|
450
|
+
## Why this matters
|
|
278
451
|
|
|
279
452
|
- Chúng ta có thể đề xuất các giải pháp i18n đã được thiết lập và định vị Intlayer như một tiện ích bổ sung.
|
|
280
453
|
- Chúng ta tận dụng SEO/từ khóa của họ với các hướng dẫn kết thúc bằng việc gợi ý sử dụng Intlayer để quản lý JSON.
|