Merge remote-tracking branch 'origin/master'
This commit is contained in:
32
ui/src/i18n/languages.js
Normal file
32
ui/src/i18n/languages.js
Normal file
@@ -0,0 +1,32 @@
|
||||
export const DEFAULT_LOCALE = 'tr'
|
||||
|
||||
export const SUPPORTED_LOCALES = ['tr', 'en', 'de', 'it', 'es', 'ru', 'ar']
|
||||
|
||||
export const UI_LANGUAGE_OPTIONS = [
|
||||
{ label: 'Türkçe', value: 'tr', short: 'TUR', flag: '🇹🇷' },
|
||||
{ label: 'English', value: 'en', short: 'ENG', flag: '🇬🇧' },
|
||||
{ label: 'Deutsch', value: 'de', short: 'DEU', flag: '🇩🇪' },
|
||||
{ label: 'Italiano', value: 'it', short: 'ITA', flag: '🇮🇹' },
|
||||
{ label: 'Español', value: 'es', short: 'ESP', flag: '🇪🇸' },
|
||||
{ label: 'Русский', value: 'ru', short: 'RUS', flag: '🇷🇺' },
|
||||
{ label: 'العربية', value: 'ar', short: 'ARA', flag: '🇸🇦' }
|
||||
]
|
||||
|
||||
export const BACKEND_LANG_MAP = {
|
||||
tr: 'TR',
|
||||
en: 'EN',
|
||||
de: 'DE',
|
||||
it: 'IT',
|
||||
es: 'ES',
|
||||
ru: 'RU',
|
||||
ar: 'AR'
|
||||
}
|
||||
|
||||
export function normalizeLocale(value) {
|
||||
const locale = String(value || '').trim().toLowerCase()
|
||||
return SUPPORTED_LOCALES.includes(locale) ? locale : DEFAULT_LOCALE
|
||||
}
|
||||
|
||||
export function toBackendLangCode(locale) {
|
||||
return BACKEND_LANG_MAP[normalizeLocale(locale)] || BACKEND_LANG_MAP[DEFAULT_LOCALE]
|
||||
}
|
||||
Reference in New Issue
Block a user