Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(i18n): Correctly load OTP-UI's Chinese (simplified) files. #1040

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 (correctly) named `zh_Hans`.
// 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
Loading