-
Notifications
You must be signed in to change notification settings - Fork 503
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
enhance(l10n): localize en-US link title #11011
Changes from 5 commits
d9f84a5
a9de3e3
e6be311
264750f
d73040e
8f33cc6
580c0a0
3ae5d78
8f0236c
ca64e36
307d53a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
type Locale = | ||
| "en-US" | ||
| "es" | ||
| "fr" | ||
| "ja" | ||
| "ko" | ||
| "pt-BR" | ||
| "ru" | ||
| "zh-CN" | ||
| "zh-TW"; | ||
type TranslatedLocale = Exclude<Locale, "en-US">; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I imagine these will be useful to use elsewhere, perhaps we export them already to save the code change later? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 8f33cc6. |
||
type Strings = { | ||
"en-US": string; | ||
} & Record<TranslatedLocale, string>; | ||
caugner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
function localString(strings: Strings) { | ||
caugner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return (locale: string) => strings[locale] ?? strings["en-US"]; | ||
} | ||
|
||
export const ONLY_AVAILABLE_IN_ENGLISH = localString({ | ||
"en-US": "This page is currently only available in English", | ||
es: "Esta página está disponible solo en inglés", | ||
fr: "Cette page est actuellement disponible uniquement en anglais", | ||
ja: "このページは現在、英語のみで利用可能です。", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mdn/yari-content-ja Can you please check this translation? 🙏 |
||
ko: "이 페이지는 현재 영어로만 제공됩니다", | ||
"pt-BR": "Esta página está disponível apenas em inglês no momento", | ||
ru: "В настоящее время эта страница доступна только на английском языке", | ||
"zh-CN": "此页面目前仅提供英文版本", | ||
"zh-TW": "此頁面目前僅提供英文版本", | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.