Add localized language label for the locale dropdown

This commit is contained in:
Joao Victor 2022-12-14 10:21:44 -03:00
parent d87839bae1
commit 561345dd8d
2 changed files with 77 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
const DEFAULT_VALUE = 'select';
const DEFAULT_KEY = -1;
@ -46,7 +47,7 @@ class LocalesDropdown extends PureComponent {
render() {
const {
value, handleChange, elementId, selectMessage,
value, handleChange, elementId, selectMessage, intl,
} = this.props;
const defaultLocale = value || DEFAULT_VALUE;
@ -61,11 +62,18 @@ class LocalesDropdown extends PureComponent {
<option disabled key={DEFAULT_KEY} value={DEFAULT_VALUE}>
{selectMessage}
</option>
{availableLocales.map((localeItem) => (
<option key={localeItem.locale} value={localeItem.locale}>
{localeItem.name}
</option>
))}
{availableLocales.map((localeItem) => {
const localizedName = localeItem.locale !== value && intl.formatMessage({
id: `app.submenu.application.localeDropdown.${localeItem.locale}`,
defaultMessage: ``,
});
return (
<option key={localeItem.locale} value={localeItem.locale}>
{localeItem.name}{localizedName && ` - ${localizedName}`}
</option>
);
})}
</select>
);
}
@ -74,4 +82,4 @@ class LocalesDropdown extends PureComponent {
LocalesDropdown.propTypes = propTypes;
LocalesDropdown.defaultProps = defaultProps;
export default LocalesDropdown;
export default injectIntl(LocalesDropdown);

View File

@ -455,6 +455,68 @@
"app.submenu.application.paginationEnabledLabel": "Video pagination",
"app.submenu.application.layoutOptionLabel": "Layout type",
"app.submenu.application.pushLayoutLabel": "Push layout",
"app.submenu.application.localeDropdown.af": "Afrikaans",
"app.submenu.application.localeDropdown.ar": "Arabic",
"app.submenu.application.localeDropdown.az": "Azerbaijani",
"app.submenu.application.localeDropdown.bg-BG": "Bulgarian",
"app.submenu.application.localeDropdown.bn": "Bengali",
"app.submenu.application.localeDropdown.ca": "Catalan",
"app.submenu.application.localeDropdown.cs-CZ": "Czech",
"app.submenu.application.localeDropdown.da": "Danish",
"app.submenu.application.localeDropdown.de": "German",
"app.submenu.application.localeDropdown.dv": "Dhivehi",
"app.submenu.application.localeDropdown.el-GR": "Greek (Greece)",
"app.submenu.application.localeDropdown.en": "English",
"app.submenu.application.localeDropdown.eo": "Esperanto",
"app.submenu.application.localeDropdown.es": "Spanish",
"app.submenu.application.localeDropdown.es-419": "Spanish (Latin America)",
"app.submenu.application.localeDropdown.es-ES": "Spanish (Spain)",
"app.submenu.application.localeDropdown.es-MX": "Spanish (Mexico)",
"app.submenu.application.localeDropdown.et": "Estonian",
"app.submenu.application.localeDropdown.eu": "Basque",
"app.submenu.application.localeDropdown.fa-IR": "Persian",
"app.submenu.application.localeDropdown.fi": "Finnish",
"app.submenu.application.localeDropdown.fr": "French",
"app.submenu.application.localeDropdown.gl": "Galician",
"app.submenu.application.localeDropdown.he": "Hebrew",
"app.submenu.application.localeDropdown.hi-IN": "Hindi",
"app.submenu.application.localeDropdown.hr": "Croatian",
"app.submenu.application.localeDropdown.hu-HU": "Hungarian",
"app.submenu.application.localeDropdown.hy": "Armenian",
"app.submenu.application.localeDropdown.id": "Indonesian",
"app.submenu.application.localeDropdown.it-IT": "Italian",
"app.submenu.application.localeDropdown.ja": "Japanese",
"app.submenu.application.localeDropdown.ka": "Georgian",
"app.submenu.application.localeDropdown.km": "Khmer",
"app.submenu.application.localeDropdown.kn": "Kannada",
"app.submenu.application.localeDropdown.ko-KR": "Korean (Korea)",
"app.submenu.application.localeDropdown.lo-LA": "Lao",
"app.submenu.application.localeDropdown.lt-LT": "Lithuanian",
"app.submenu.application.localeDropdown.lv": "Latvian",
"app.submenu.application.localeDropdown.ml": "Malayalam",
"app.submenu.application.localeDropdown.mn-MN": "Mongolian",
"app.submenu.application.localeDropdown.nb-NO": "Norwegian (bokmal)",
"app.submenu.application.localeDropdown.nl": "Dutch",
"app.submenu.application.localeDropdown.oc": "Occitan",
"app.submenu.application.localeDropdown.pl-PL": "Polish",
"app.submenu.application.localeDropdown.pt": "Portuguese",
"app.submenu.application.localeDropdown.pt-BR": "Portuguese (Brazil)",
"app.submenu.application.localeDropdown.ro-RO": "Romanian",
"app.submenu.application.localeDropdown.ru": "Russian",
"app.submenu.application.localeDropdown.sk-SK": "Slovak (Slovakia)",
"app.submenu.application.localeDropdown.sl": "Slovenian",
"app.submenu.application.localeDropdown.sr": "Serbian",
"app.submenu.application.localeDropdown.sv-SE": "Swedish",
"app.submenu.application.localeDropdown.ta": "Tamil",
"app.submenu.application.localeDropdown.te": "Telugu",
"app.submenu.application.localeDropdown.th": "Thai",
"app.submenu.application.localeDropdown.tr": "Turkish",
"app.submenu.application.localeDropdown.tr-TR": "Turkish",
"app.submenu.application.localeDropdown.uk-UA": "Ukrainian",
"app.submenu.application.localeDropdown.vi": "Vietnamese",
"app.submenu.application.localeDropdown.vi-VN": "Vietnamese",
"app.submenu.application.localeDropdown.zh-CN": "Chinese Simplified (China)",
"app.submenu.application.localeDropdown.zh-TW": "Chinese Traditional (Taiwan)",
"app.submenu.notification.SectionTitle": "Notifications",
"app.submenu.notification.Desc": "Define how and what you will be notified.",
"app.submenu.notification.audioAlertLabel": "Audio Alerts",