Skip to content

Commit

Permalink
Fix: handle the case fallbackLocales is false
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinyaigeek committed Aug 30, 2021
1 parent ea00f55 commit dbc0030
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/cli/src/api/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export class Catalog {
}

const getMultipleFallbacks = (locale) => {
const fL = fallbackLocales[locale]
const fL = fallbackLocales && fallbackLocales[locale]

// some probably the fallback will be undefined, so just search by locale
if (!fL) return null
Expand All @@ -318,7 +318,9 @@ export class Catalog {
// We search in fallbackLocales as dependent of each locale
getMultipleFallbacks(locale) ||
// Get translation in fallbackLocales.default (if any)
(fallbackLocales.default && getTranslation(fallbackLocales.default)) ||
(fallbackLocales &&
fallbackLocales.default &&
getTranslation(fallbackLocales.default)) ||
// Get message default
catalogs[locale][key].defaults ||
// If sourceLocale is either target locale of fallback one, use key
Expand Down

0 comments on commit dbc0030

Please sign in to comment.