Localize language names (#33402)
parent
839a4e27a9
commit
f9582bcfc3
|
@ -38,7 +38,7 @@ class TranslateButton extends PureComponent {
|
|||
|
||||
if (translation) {
|
||||
const language = preloadedLanguages.find(lang => lang[0] === translation.get('detected_source_language'));
|
||||
const languageName = language ? language[2] : translation.get('detected_source_language');
|
||||
const languageName = language ? language[1] : translation.get('detected_source_language');
|
||||
const provider = translation.get('provider');
|
||||
|
||||
return (
|
||||
|
|
|
@ -115,11 +115,22 @@ export const trendsAsLanding = getMeta('trends_as_landing_page');
|
|||
export const useBlurhash = getMeta('use_blurhash');
|
||||
export const usePendingItems = getMeta('use_pending_items');
|
||||
export const version = getMeta('version');
|
||||
export const languages = initialState?.languages;
|
||||
export const criticalUpdatesPending = initialState?.critical_updates_pending;
|
||||
export const statusPageUrl = getMeta('status_page_url');
|
||||
export const sso_redirect = getMeta('sso_redirect');
|
||||
export const termsOfServiceEnabled = getMeta('terms_of_service_enabled');
|
||||
|
||||
const displayNames = Intl.DisplayNames && new Intl.DisplayNames(getMeta('locale'), {
|
||||
type: 'language',
|
||||
fallback: 'none',
|
||||
languageDisplay: 'standard',
|
||||
});
|
||||
|
||||
export const languages = initialState?.languages?.map(lang => {
|
||||
// zh-YUE is not a valid CLDR unicode_language_id
|
||||
return [lang[0], displayNames?.of(lang[0].replace('zh-YUE', 'yue')) || lang[1], lang[2]];
|
||||
});
|
||||
|
||||
/**
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue