Skip to content

Commit

Permalink
Fix Chinese language code mapping (#653)
Browse files Browse the repository at this point in the history
  • Loading branch information
streamer45 committed Mar 8, 2024
1 parent 6eb61b4 commit d21f4da
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions webapp/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,18 @@ export function getTranslations(locale: string) {
try {
logDebug(`loading translations file for locale '${locale}'`);

// Remapping some language codes to their actual file.
// This is needed as Mattermost product uses different codes for
// certain languages such as simplified and traditional Chinese.
switch (locale) {
case 'zh-CN':
locale = 'zh_Hans';
break;
case 'zh-TW':
locale = 'zh_Hant';
break;
}

// synchronously loading all translation files from bundle (MM-50811).
// eslint-disable-next-line global-require
return require(`../i18n/${locale}.json`);
Expand Down

0 comments on commit d21f4da

Please sign in to comment.