|
1 | 1 | package to.bitkit.models |
2 | 2 |
|
| 3 | +import androidx.annotation.StringRes |
3 | 4 | import kotlinx.serialization.Serializable |
| 5 | +import to.bitkit.R |
4 | 6 | import java.util.Locale |
5 | 7 |
|
6 | 8 | @Serializable |
7 | 9 | enum class Language( |
8 | | - val displayName: String, |
| 10 | + @StringRes val displayNameResId: Int? = null, |
| 11 | + val nativeName: String? = null, |
9 | 12 | val languageCode: String, |
10 | 13 | val countryCode: String? = null, |
11 | 14 | val isSystemDefault: Boolean = false, |
12 | 15 | ) { |
13 | 16 | SYSTEM_DEFAULT( |
14 | | - displayName = "System Default", |
| 17 | + displayNameResId = R.string.settings__language_system_default, |
15 | 18 | languageCode = "system", |
16 | 19 | countryCode = null, |
17 | 20 | isSystemDefault = true |
18 | 21 | ), |
19 | | - ARABIC("العربية", "ar"), |
20 | | - CATALAN("Català", "ca"), |
21 | | - CZECH("Čeština", "cs"), |
22 | | - DUTCH("Nederlands", "nl"), |
23 | | - ENGLISH("English", "en", "US"), |
24 | | - FRENCH("Français", "fr", "FR"), |
25 | | - GERMAN("Deutsch", "de"), |
26 | | - GREEK("Ελληνικά", "el"), |
27 | | - ITALIAN("Italiano", "it"), |
28 | | - POLISH("Polski", "pl"), |
29 | | - PORTUGUESE("Português", "pt", "BR"), |
30 | | - RUSSIAN("Русский", "ru"), |
31 | | - SPANISH("Español", "es", "ES"), |
32 | | - SPANISH_LATIN_AMERICA("Español (Latinoamérica)", "es", "419"); |
| 22 | + ARABIC(nativeName = "العربية", languageCode = "ar"), |
| 23 | + CATALAN(nativeName = "Català", languageCode = "ca"), |
| 24 | + CZECH(nativeName = "Čeština", languageCode = "cs"), |
| 25 | + DUTCH(nativeName = "Nederlands", languageCode = "nl"), |
| 26 | + ENGLISH(nativeName = "English", languageCode = "en", countryCode = "US"), |
| 27 | + FRENCH(nativeName = "Français", languageCode = "fr", countryCode = "FR"), |
| 28 | + GERMAN(nativeName = "Deutsch", languageCode = "de"), |
| 29 | + GREEK(nativeName = "Ελληνικά", languageCode = "el"), |
| 30 | + ITALIAN(nativeName = "Italiano", languageCode = "it"), |
| 31 | + POLISH(nativeName = "Polski", languageCode = "pl"), |
| 32 | + PORTUGUESE(nativeName = "Português", languageCode = "pt", countryCode = "BR"), |
| 33 | + RUSSIAN(nativeName = "Русский", languageCode = "ru"), |
| 34 | + SPANISH(nativeName = "Español", languageCode = "es", countryCode = "ES"), |
| 35 | + SPANISH_LATIN_AMERICA(nativeName = "Español (Latinoamérica)", languageCode = "es", countryCode = "419"); |
33 | 36 |
|
34 | 37 | companion object { |
35 | 38 | fun fromLanguageCode(languageCode: String, countryCode: String? = null): Language? { |
|
0 commit comments