diff options
Diffstat (limited to 'modern/src/common/components/LocalizationProvider.jsx')
-rw-r--r-- | modern/src/common/components/LocalizationProvider.jsx | 120 |
1 files changed, 64 insertions, 56 deletions
diff --git a/modern/src/common/components/LocalizationProvider.jsx b/modern/src/common/components/LocalizationProvider.jsx index 6bc64831..a6a14859 100644 --- a/modern/src/common/components/LocalizationProvider.jsx +++ b/modern/src/common/components/LocalizationProvider.jsx @@ -64,62 +64,62 @@ import zhTW from '../../resources/l10n/zh_TW.json'; import usePersistedState from '../util/usePersistedState'; const languages = { - af: { data: af, name: 'Afrikaans' }, - ar: { data: ar, name: 'العربية' }, - az: { data: az, name: 'Azərbaycanca' }, - bg: { data: bg, name: 'Български' }, - bn: { data: bn, name: 'বাংলা' }, - ca: { data: ca, name: 'Català' }, - cs: { data: cs, name: 'Čeština' }, - de: { data: de, name: 'Deutsch' }, - da: { data: da, name: 'Dansk' }, - el: { data: el, name: 'Ελληνικά' }, - en: { data: en, name: 'English' }, - es: { data: es, name: 'Español' }, - fa: { data: fa, name: 'فارسی' }, - fi: { data: fi, name: 'Suomi' }, - fr: { data: fr, name: 'Français' }, - gl: { data: gl, name: 'Galego' }, - he: { data: he, name: 'עברית' }, - hi: { data: hi, name: 'हिन्दी' }, - hr: { data: hr, name: 'Hrvatski' }, - hu: { data: hu, name: 'Magyar' }, - id: { data: id, name: 'Bahasa Indonesia' }, - it: { data: it, name: 'Italiano' }, - ja: { data: ja, name: '日本語' }, - ka: { data: ka, name: 'ქართული' }, - kk: { data: kk, name: 'Қазақша' }, - ko: { data: ko, name: '한국어' }, - km: { data: km, name: 'ភាសាខ្មែរ' }, - lo: { data: lo, name: 'ລາວ' }, - lt: { data: lt, name: 'Lietuvių' }, - lv: { data: lv, name: 'Latviešu' }, - ml: { data: ml, name: 'മലയാളം' }, - mn: { data: mn, name: 'Монгол хэл' }, - ms: { data: ms, name: 'بهاس ملايو' }, - nb: { data: nb, name: 'Norsk bokmål' }, - ne: { data: ne, name: 'नेपाली' }, - nl: { data: nl, name: 'Nederlands' }, - nn: { data: nn, name: 'Norsk nynorsk' }, - pl: { data: pl, name: 'Polski' }, - pt: { data: pt, name: 'Português' }, - ptBR: { data: ptBR, name: 'Português (Brasil)' }, - ro: { data: ro, name: 'Română' }, - ru: { data: ru, name: 'Русский' }, - si: { data: si, name: 'සිංහල' }, - sk: { data: sk, name: 'Slovenčina' }, - sl: { data: sl, name: 'Slovenščina' }, - sq: { data: sq, name: 'Shqipëria' }, - sr: { data: sr, name: 'Srpski' }, - sv: { data: sv, name: 'Svenska' }, - ta: { data: ta, name: 'தமிழ்' }, - th: { data: th, name: 'ไทย' }, - tr: { data: tr, name: 'Türkçe' }, - uk: { data: uk, name: 'Українська' }, - uz: { data: uz, name: 'Oʻzbekcha' }, - vi: { data: vi, name: 'Tiếng Việt' }, - zh: { data: zh, name: '中文' }, - zhTW: { data: zhTW, name: '中文 (Taiwan)' }, + af: { data: af, countryCode: 'ZA', name: 'Afrikaans' }, + ar: { data: ar, countryCode: 'AE', name: 'العربية' }, + az: { data: az, countryCode: 'AZ', name: 'Azərbaycanca' }, + bg: { data: bg, countryCode: 'BG', name: 'Български' }, + bn: { data: bn, countryCode: 'IN', name: 'বাংলা' }, + ca: { data: ca, countryCode: 'ES', name: 'Català' }, + cs: { data: cs, countryCode: 'CZ', name: 'Čeština' }, + de: { data: de, countryCode: 'DE', name: 'Deutsch' }, + da: { data: da, countryCode: 'DK', name: 'Dansk' }, + el: { data: el, countryCode: 'GR', name: 'Ελληνικά' }, + en: { data: en, countryCode: 'US', name: 'English' }, + es: { data: es, countryCode: 'ES', name: 'Español' }, + fa: { data: fa, countryCode: 'IR', name: 'فارسی' }, + fi: { data: fi, countryCode: 'FI', name: 'Suomi' }, + fr: { data: fr, countryCode: 'FR', name: 'Français' }, + gl: { data: gl, countryCode: 'ES', name: 'Galego' }, + he: { data: he, countryCode: 'IL', name: 'עברית' }, + hi: { data: hi, countryCode: 'IN', name: 'हिन्दी' }, + hr: { data: hr, countryCode: 'HR', name: 'Hrvatski' }, + hu: { data: hu, countryCode: 'HU', name: 'Magyar' }, + id: { data: id, countryCode: 'ID', name: 'Bahasa Indonesia' }, + it: { data: it, countryCode: 'IT', name: 'Italiano' }, + ja: { data: ja, countryCode: 'JP', name: '日本語' }, + ka: { data: ka, countryCode: 'GE', name: 'ქართული' }, + kk: { data: kk, countryCode: 'KZ', name: 'Қазақша' }, + ko: { data: ko, countryCode: 'KR', name: '한국어' }, + km: { data: km, countryCode: 'KH', name: 'ភាសាខ្មែរ' }, + lo: { data: lo, countryCode: 'LA', name: 'ລາວ' }, + lt: { data: lt, countryCode: 'LT', name: 'Lietuvių' }, + lv: { data: lv, countryCode: 'LV', name: 'Latviešu' }, + ml: { data: ml, countryCode: 'IN', name: 'മലയാളം' }, + mn: { data: mn, countryCode: 'MN', name: 'Монгол хэл' }, + ms: { data: ms, countryCode: 'MY', name: 'بهاس ملايو' }, + ne: { data: ne, countryCode: 'NP', name: 'नेपाली' }, + nl: { data: nl, countryCode: 'NL', name: 'Nederlands' }, + nb: { data: nb, countryCode: 'NO', name: 'Norsk bokmål' }, + nn: { data: nn, countryCode: 'NO', name: 'Norsk nynorsk' }, + pl: { data: pl, countryCode: 'PL', name: 'Polski' }, + pt: { data: pt, countryCode: 'PT', name: 'Português' }, + ptBR: { data: ptBR, countryCode: 'BR', name: 'Português (Brasil)' }, + ro: { data: ro, countryCode: 'RO', name: 'Română' }, + ru: { data: ru, countryCode: 'RU', name: 'Русский' }, + si: { data: si, countryCode: 'LK', name: 'සිංහල' }, + sk: { data: sk, countryCode: 'SK', name: 'Slovenčina' }, + sl: { data: sl, countryCode: 'SI', name: 'Slovenščina' }, + sq: { data: sq, countryCode: 'AL', name: 'Shqipëria' }, + sr: { data: sr, countryCode: 'RS', name: 'Srpski' }, + sv: { data: sv, countryCode: 'SE', name: 'Svenska' }, + ta: { data: ta, countryCode: 'IN', name: 'தமிழ்' }, + th: { data: th, countryCode: 'TH', name: 'ไทย' }, + tr: { data: tr, countryCode: 'TR', name: 'Türkçe' }, + uk: { data: uk, countryCode: 'UA', name: 'Українська' }, + uz: { data: uz, countryCode: 'UZ', name: 'Oʻzbekcha' }, + vi: { data: vi, countryCode: 'VN', name: 'Tiếng Việt' }, + zh: { data: zh, countryCode: 'CN', name: '中文' }, + zhTW: { data: zhTW, countryCode: 'TW', name: '中文 (Taiwan)' }, }; const getDefaultLanguage = () => { @@ -186,3 +186,11 @@ export const useTranslationKeys = (predicate) => { const { data } = context.languages[context.language]; return Object.keys(data).filter(predicate); }; + +export const getFlagEmoji = (countryCode) => { + const codePoints = countryCode + .toUpperCase() + .split('') + .map((char) => 127397 + char.charCodeAt()); + return String.fromCodePoint(...codePoints); +}; |