mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-06 10:25:09 +01:00
Localize language names
This commit is contained in:
parent
8770905186
commit
d79a75c3cc
@ -38,7 +38,7 @@ class TranslateButton extends PureComponent {
|
|||||||
|
|
||||||
if (translation) {
|
if (translation) {
|
||||||
const language = preloadedLanguages.find(lang => lang[0] === translation.get('detected_source_language'));
|
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');
|
const provider = translation.get('provider');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -115,11 +115,22 @@ export const trendsAsLanding = getMeta('trends_as_landing_page');
|
|||||||
export const useBlurhash = getMeta('use_blurhash');
|
export const useBlurhash = getMeta('use_blurhash');
|
||||||
export const usePendingItems = getMeta('use_pending_items');
|
export const usePendingItems = getMeta('use_pending_items');
|
||||||
export const version = getMeta('version');
|
export const version = getMeta('version');
|
||||||
export const languages = initialState?.languages;
|
|
||||||
export const criticalUpdatesPending = initialState?.critical_updates_pending;
|
export const criticalUpdatesPending = initialState?.critical_updates_pending;
|
||||||
export const statusPageUrl = getMeta('status_page_url');
|
export const statusPageUrl = getMeta('status_page_url');
|
||||||
export const sso_redirect = getMeta('sso_redirect');
|
export const sso_redirect = getMeta('sso_redirect');
|
||||||
export const termsOfServiceEnabled = getMeta('terms_of_service_enabled');
|
export const termsOfServiceEnabled = getMeta('terms_of_service_enabled');
|
||||||
|
|
||||||
|
const 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}
|
* @returns {string | undefined}
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user