Skip to content

Commit

Permalink
adding missing translation logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultAndreis committed Oct 13, 2023
1 parent 4850c48 commit 9771bd2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ export const translate: Translations.Translate = ({
let text = (translations[locale] || {})[key];

if (fallbackLocale && text === undefined) {
logger.warn(`No translation provided for '${key}' key in locale '${locale}'. Trying fallback '${fallbackLocale}'`);
text = (translations[fallbackLocale] || {})[key];
}

if (rest.hasOwnProperty('fallbackValue') && text === undefined) {
return rest.fallbackValue;
if (text === undefined) {
logger.warn(`No translation provided for '${key}' key in fallback '${fallbackLocale}'.`);
if (rest.hasOwnProperty('fallbackValue') ) {
return rest.fallbackValue;
}
}

return parser.parse(text, params, locale, key);
Expand Down

0 comments on commit 9771bd2

Please sign in to comment.