Skip to content

Commit

Permalink
Merge pull request #1069 from JGreenlee/fix-merge-translations
Browse files Browse the repository at this point in the history
🌐 i18n: fix merge translations if structure differs
  • Loading branch information
shankari authored Oct 29, 2023
2 parents 7338c18 + 9be110d commit 56014a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions www/js/i18nextInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ const mergeInTranslations = (lang, fallbackLang) => {
if (__DEV__) {
if (typeof value === 'string') {
lang[key] = `🌐${value}`
} else if (typeof value === 'object') {
} else if (typeof value === 'object' && typeof lang[key] === 'object') {
lang[key] = {};
mergeInTranslations(lang[key], value);
}
} else {
lang[key] = value;
}
} else if (typeof value === 'object') {
} else if (typeof value === 'object' && typeof lang[key] === 'object') {
mergeInTranslations(lang[key], fallbackLang[key])
}
});
Expand Down

0 comments on commit 56014a5

Please sign in to comment.