From c55991239351b4ca50ae157bb4759f2675cde3ab Mon Sep 17 00:00:00 2001 From: Yasser Lahbibi Date: Sun, 6 Nov 2022 14:31:02 +0100 Subject: [PATCH] feat: merge messages if any (#1615) --- src/runtime/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime/utils.ts b/src/runtime/utils.ts index 4f1b2ebe9..0b279943c 100644 --- a/src/runtime/utils.ts +++ b/src/runtime/utils.ts @@ -101,7 +101,10 @@ export async function loadInitialMessages( } ): Promise> { const { defaultLocale, initialLocale, localeCodes, fallbackLocale, langDir, lazy } = options - const setter = (locale: Locale, message: Record) => (messages[locale] = message) + const setter = (locale: Locale, message: Record) => { + const base = messages[locale] || {} + messages[locale] = { ...base, ...message } + } if (langDir) { // load fallback messages