File tree Expand file tree Collapse file tree
app/src/main/kotlin/com/vrem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,14 +77,11 @@ fun findByCountryCode(countryCode: String): Locale =
7777
7878fun allCountries (): List <Locale > = countriesLocales.values.toList()
7979
80- fun supportedLanguages (): List <Locale > =
81- (baseSupportedLocales + currentLocale).distinct()
80+ fun supportedLanguages (): List <Locale > = (baseSupportedLocales + currentLocale).distinct()
8281
83- fun supportedLanguageTags (): List <String > =
84- listOf (" " ) + baseSupportedLocales.map { it.toLanguageTag() }
82+ fun supportedLanguageTags (): List <String > = listOf (" " ) + baseSupportedLocales.map { it.toLanguageTag() }
8583
86- private fun normalizeLanguageTag (languageTag : String ): String =
87- languageTag.replace(' _' , ' -' ).trim()
84+ private fun normalizeLanguageTag (languageTag : String ): String = languageTag.replace(' _' , ' -' ).trim()
8885
8986fun findByLanguageTag (languageTag : String ): Locale {
9087 val normalizedLanguageTag = normalizeLanguageTag(languageTag)
@@ -106,5 +103,4 @@ fun currentLanguageTag(): String = currentLocale.toLanguageTag()
106103
107104fun toLanguageTag (locale : Locale ): String = locale.toLanguageTag()
108105
109- fun Locale.toSupportedLocaleTag (): String =
110- findByLanguageTag(this .toLanguageTag()).toLanguageTag()
106+ fun Locale.toSupportedLocaleTag (): String = findByLanguageTag(this .toLanguageTag()).toLanguageTag()
Original file line number Diff line number Diff line change @@ -28,5 +28,4 @@ fun String.specialTrim(): String = this.trim { it <= ' ' }.replace(" +".toRegex(
2828
2929fun String.toCapitalize (locale : Locale ): String = this .replaceFirstChar { word -> word.uppercase(locale) }
3030
31- fun String.titlecaseFirst (locale : Locale ): String =
32- replaceFirstChar { it.titlecase(locale) }
31+ fun String.titlecaseFirst (locale : Locale ): String = replaceFirstChar { it.titlecase(locale) }
Original file line number Diff line number Diff line change @@ -119,10 +119,11 @@ class MainActivity :
119119 val languageKey = getString(R .string.language_key)
120120 if (key == languageKey) {
121121 val languageTag = sharedPreferences.getString(languageKey, " " )
122- val locales = languageTag
123- ?.takeIf { it.isNotEmpty() }
124- ?.let (LocaleListCompat ::forLanguageTags)
125- ? : LocaleListCompat .getEmptyLocaleList()
122+ val locales =
123+ languageTag
124+ ?.takeIf { it.isNotEmpty() }
125+ ?.let (LocaleListCompat ::forLanguageTags)
126+ ? : LocaleListCompat .getEmptyLocaleList()
126127
127128 AppCompatDelegate .setApplicationLocales(locales)
128129 }
Original file line number Diff line number Diff line change @@ -29,8 +29,7 @@ class MainReload(
2929 var connectionViewType: ConnectionViewType
3030 private set
3131
32- fun shouldReload (settings : Settings ): Boolean =
33- themeChanged(settings) || connectionViewTypeChanged(settings)
32+ fun shouldReload (settings : Settings ): Boolean = themeChanged(settings) || connectionViewTypeChanged(settings)
3433
3534 private fun connectionViewTypeChanged (settings : Settings ): Boolean {
3635 val currentConnectionViewType = settings.connectionViewType()
Original file line number Diff line number Diff line change @@ -70,8 +70,7 @@ class Settings(
7070
7171 fun countryCode (): String = repository.string(R .string.country_code_key, currentCountryCode())
7272
73- fun appLocale (): Locale =
74- findByLanguageTag(AppCompatDelegate .getApplicationLocales().toLanguageTags())
73+ fun appLocale (): Locale = findByLanguageTag(AppCompatDelegate .getApplicationLocales().toLanguageTags())
7574
7675 fun syncLanguage () {
7776 val appLocaleTag = appLocale().toSupportedLocaleTag()
You can’t perform that action at this time.
0 commit comments