From 4d32c6d99ecf01d20307e6c6822a85ffac1b47a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20=C5=A0pendl?= Date: Fri, 7 Jan 2022 18:22:25 +0100 Subject: [PATCH] allow multiple translation files for each locale --- generator/templates-vue3/js/src/i18n.js | 2 +- generator/templates-vue3/ts/src/i18n.ts | 2 +- generator/templates/js/src/i18n.js | 2 +- generator/templates/ts/src/i18n.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/templates-vue3/js/src/i18n.js b/generator/templates-vue3/js/src/i18n.js index e12a355..ba2c384 100644 --- a/generator/templates-vue3/js/src/i18n.js +++ b/generator/templates-vue3/js/src/i18n.js @@ -13,7 +13,7 @@ function loadLocaleMessages() { const matched = key.match(/([A-Za-z0-9-_]+)\./i) if (matched && matched.length > 1) { const locale = matched[1] - messages[locale] = locales(key).default + messages[locale] = {...messages[locale], ...locales(key).default} } }) return messages diff --git a/generator/templates-vue3/ts/src/i18n.ts b/generator/templates-vue3/ts/src/i18n.ts index b64ec4b..35b9922 100644 --- a/generator/templates-vue3/ts/src/i18n.ts +++ b/generator/templates-vue3/ts/src/i18n.ts @@ -13,7 +13,7 @@ function loadLocaleMessages(): LocaleMessages { const matched = key.match(/([A-Za-z0-9-_]+)\./i) if (matched && matched.length > 1) { const locale = matched[1] - messages[locale] = locales(key).default + messages[locale] = {...messages[locale], ...locales(key).default} } }) return messages diff --git a/generator/templates/js/src/i18n.js b/generator/templates/js/src/i18n.js index 024497d..a97978c 100644 --- a/generator/templates/js/src/i18n.js +++ b/generator/templates/js/src/i18n.js @@ -10,7 +10,7 @@ function loadLocaleMessages () { const matched = key.match(/([A-Za-z0-9-_]+)\./i) if (matched && matched.length > 1) { const locale = matched[1] - messages[locale] = locales(key) + messages[locale] = {...messages[locale], ...locales(key)} } }) return messages diff --git a/generator/templates/ts/src/i18n.ts b/generator/templates/ts/src/i18n.ts index ceab242..4482f9e 100644 --- a/generator/templates/ts/src/i18n.ts +++ b/generator/templates/ts/src/i18n.ts @@ -10,7 +10,7 @@ function loadLocaleMessages (): LocaleMessages { const matched = key.match(/([A-Za-z0-9-_]+)\./i) if (matched && matched.length > 1) { const locale = matched[1] - messages[locale] = locales(key) + messages[locale] = {...messages[locale], ...locales(key)} } }) return messages