diff options
author | Jamie Guthrie <jamie.guthrie@gmail.com> | 2023-08-19 12:50:32 +0200 |
---|---|---|
committer | Jamie Guthrie <jamie.guthrie@gmail.com> | 2023-08-19 12:50:32 +0200 |
commit | 45e6a28fdb4aea85896783d4b8aa3298e4e98953 (patch) | |
tree | 5d3b11335b1257ae23bb2627b96a7285d96e8688 /modern/src | |
parent | f97f41ca860f262ce51fce481b1d4817e9ae9bfb (diff) | |
download | trackermap-web-45e6a28fdb4aea85896783d4b8aa3298e4e98953.tar.gz trackermap-web-45e6a28fdb4aea85896783d4b8aa3298e4e98953.tar.bz2 trackermap-web-45e6a28fdb4aea85896783d4b8aa3298e4e98953.zip |
Add country flags
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/common/components/LocalizationProvider.js | 112 | ||||
-rw-r--r-- | modern/src/login/LoginPage.js | 11 |
2 files changed, 65 insertions, 58 deletions
diff --git a/modern/src/common/components/LocalizationProvider.js b/modern/src/common/components/LocalizationProvider.js index 6bc64831..e1bafd09 100644 --- a/modern/src/common/components/LocalizationProvider.js +++ b/modern/src/common/components/LocalizationProvider.js @@ -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: 'GB', 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 = () => { diff --git a/modern/src/login/LoginPage.js b/modern/src/login/LoginPage.js index 54fd09fb..8a64bebf 100644 --- a/modern/src/login/LoginPage.js +++ b/modern/src/login/LoginPage.js @@ -3,6 +3,7 @@ import moment from 'moment'; import { useMediaQuery, InputLabel, Select, MenuItem, FormControl, Button, TextField, Link, Snackbar, IconButton, Tooltip, LinearProgress, } from '@mui/material'; +import ReactCountryFlag from 'react-country-flag'; import makeStyles from '@mui/styles/makeStyles'; import CloseIcon from '@mui/icons-material/Close'; import LockOpenIcon from '@mui/icons-material/LockOpen'; @@ -50,7 +51,7 @@ const LoginPage = () => { const t = useTranslation(); const { languages, language, setLanguage } = useLocalization(); - const languageList = Object.entries(languages).map((values) => ({ code: values[0], name: values[1].name })); + const languageList = Object.entries(languages).map((values) => ({ code: values[0], countryCode: values[1].countryCode, name: values[1].name })); const [failed, setFailed] = useState(false); @@ -209,7 +210,13 @@ const LoginPage = () => { <FormControl fullWidth> <InputLabel>{t('loginLanguage')}</InputLabel> <Select label={t('loginLanguage')} value={language} onChange={(e) => setLanguage(e.target.value)}> - {languageList.map((it) => <MenuItem key={it.code} value={it.code}>{it.name}</MenuItem>)} + {languageList.map((it) => ( + <MenuItem key={it.code} value={it.code}> + <ReactCountryFlag countryCode={it.countryCode} /> + + {it.name} + </MenuItem> + ))} </Select> </FormControl> )} |