Skip to content

Commit

Permalink
feat: merge messages if any (nuxt-modules#1615)
Browse files Browse the repository at this point in the history
  • Loading branch information
yassilah authored Nov 6, 2022
1 parent e756b96 commit c559912
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ export async function loadInitialMessages<Context extends NuxtApp = NuxtApp>(
}
): Promise<Record<string, any>> {
const { defaultLocale, initialLocale, localeCodes, fallbackLocale, langDir, lazy } = options
const setter = (locale: Locale, message: Record<string, any>) => (messages[locale] = message)
const setter = (locale: Locale, message: Record<string, any>) => {
const base = messages[locale] || {}
messages[locale] = { ...base, ...message }
}

if (langDir) {
// load fallback messages
Expand Down

0 comments on commit c559912

Please sign in to comment.