mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-20 08:50:25 +00:00
use constant to define "good" language match
This commit is contained in:
parent
159fd55695
commit
58f98e3024
2 changed files with 3 additions and 1 deletions
|
@ -56,6 +56,8 @@ object LocaleUtils {
|
||||||
// The compared locales are fully identical. This is the best match level.
|
// The compared locales are fully identical. This is the best match level.
|
||||||
private const val LOCALE_FULL_MATCH = 30
|
private const val LOCALE_FULL_MATCH = 30
|
||||||
|
|
||||||
|
const val LOCALE_GOOD_MATCH = LOCALE_LANGUAGE_MATCH_COUNTRY_DIFFER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return how well a tested locale matches a reference locale.
|
* Return how well a tested locale matches a reference locale.
|
||||||
*
|
*
|
||||||
|
|
|
@ -76,7 +76,7 @@ fun createDictionaryTextHtml(message: String, locale: Locale, context: Context):
|
||||||
// ideally the repo would switch to language tag, but not sure how this is handled in the dictionary header
|
// ideally the repo would switch to language tag, but not sure how this is handled in the dictionary header
|
||||||
// further, the dicts in the dictionaries repo should be compatible with other AOSP-based keyboards
|
// further, the dicts in the dictionaries repo should be compatible with other AOSP-based keyboards
|
||||||
val dictLocale = localeString.constructLocale()
|
val dictLocale = localeString.constructLocale()
|
||||||
if (LocaleUtils.getMatchLevel(locale, dictLocale) < 3) return@forEachLine
|
if (LocaleUtils.getMatchLevel(locale, dictLocale) < LocaleUtils.LOCALE_GOOD_MATCH) return@forEachLine
|
||||||
val rawDictString = "$type: ${dictLocale.getDisplayName(context.resources.configuration.locale())}"
|
val rawDictString = "$type: ${dictLocale.getDisplayName(context.resources.configuration.locale())}"
|
||||||
val dictString = if (experimental.isEmpty()) rawDictString
|
val dictString = if (experimental.isEmpty()) rawDictString
|
||||||
else context.getString(R.string.available_dictionary_experimental, rawDictString)
|
else context.getString(R.string.available_dictionary_experimental, rawDictString)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue