Skip to content

Commit

Permalink
fix(i18n): Correctly load OTP-UI's Chinese (simplified) files.
Browse files Browse the repository at this point in the history
  • Loading branch information
binh-dam-ibigroup committed Oct 18, 2023
1 parent fc57cad commit b3d1313
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/util/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ async function loadOtpUiLocaleData(matchedLocale) {
*/
export async function loadLocaleData(matchedLocale, customMessages) {
let messages
let otpUiLocale = matchedLocale
switch (matchedLocale) {
case 'es': // Spanish translation is not specific to a region
messages = await import('../../i18n/es.yml')
Expand All @@ -130,15 +131,18 @@ export async function loadLocaleData(matchedLocale, customMessages) {
case 'vi': // Vietnamese translation is not specific to a region
messages = await import('../../i18n/vi.yml')
break
case 'zh': // Chinese translation is not specific to a region
case 'zh': // Chinese (Simplified) translation is not specific to a region
messages = await import('../../i18n/zh.yml')
// The OTP-UI files for Chinese (Simplified) are (correclty) named `zh_Hans`.

Check failure on line 136 in lib/util/i18n.js

View workflow job for this annotation

GitHub Actions / Check for spelling errors

correclty ==> correctly
// TODO: Rename this repo's zh files to zh_Hans
otpUiLocale = 'zh_Hans'
break
default:
messages = await import('../../i18n/en-US.yml')
break
}

const otpUiMessages = await loadOtpUiLocaleData(matchedLocale)
const otpUiMessages = await loadOtpUiLocaleData(otpUiLocale)

// Merge custom strings into the standard language strings.
const mergedMessages = {
Expand Down

0 comments on commit b3d1313

Please sign in to comment.