rename langauge_key_texts to locale_key_texts

This commit is contained in:
Helium314 2024-05-02 16:20:49 +02:00
parent da3a7dd854
commit 691ae017bc
81 changed files with 7 additions and 7 deletions

View file

@ -238,9 +238,9 @@ fun addLocaleKeyTextsToParams(context: Context, params: KeyboardParams, popupKey
private fun createLocaleKeyTexts(context: Context, params: KeyboardParams, popupKeysSetting: Int): LocaleKeyboardInfos {
val lkt = LocaleKeyboardInfos(getStreamForLocale(params.mId.locale, context), params.mId.locale)
if (popupKeysSetting == POPUP_KEYS_MORE)
lkt.addFile(context.assets.open("$LANGUAGE_TEXTS_FOLDER/all_popup_keys.txt"))
lkt.addFile(context.assets.open("$LOCALE_TEXTS_FOLDER/all_popup_keys.txt"))
else if (popupKeysSetting == POPUP_KEYS_ALL)
lkt.addFile(context.assets.open("$LANGUAGE_TEXTS_FOLDER/more_popup_keys.txt"))
lkt.addFile(context.assets.open("$LOCALE_TEXTS_FOLDER/more_popup_keys.txt"))
params.mSecondaryLocales.forEach { locale ->
if (locale == params.mId.locale) return@forEach
lkt.addFile(getStreamForLocale(locale, context))
@ -250,11 +250,11 @@ private fun createLocaleKeyTexts(context: Context, params: KeyboardParams, popup
private fun getStreamForLocale(locale: Locale, context: Context) =
try {
if (locale.toLanguageTag() == SubtypeLocaleUtils.NO_LANGUAGE) context.assets.open("$LANGUAGE_TEXTS_FOLDER/more_popup_keys.txt")
else context.assets.open("$LANGUAGE_TEXTS_FOLDER/${locale.toLanguageTag()}.txt")
if (locale.toLanguageTag() == SubtypeLocaleUtils.NO_LANGUAGE) context.assets.open("$LOCALE_TEXTS_FOLDER/more_popup_keys.txt")
else context.assets.open("$LOCALE_TEXTS_FOLDER/${locale.toLanguageTag()}.txt")
} catch (_: Exception) {
try {
context.assets.open("$LANGUAGE_TEXTS_FOLDER/${locale.language}.txt")
context.assets.open("$LOCALE_TEXTS_FOLDER/${locale.language}.txt")
} catch (_: Exception) {
null
}
@ -335,4 +335,4 @@ const val POPUP_KEYS_ALL = 2
const val POPUP_KEYS_MORE = 1
const val POPUP_KEYS_NORMAL = 0
const val LANGUAGE_TEXTS_FOLDER = "language_key_texts"
private const val LOCALE_TEXTS_FOLDER = "locale_key_texts"

View file

@ -54,7 +54,7 @@ Some special key labels will be implemented, most are already working in the (cu
* `KeyboardLayoutSet` in `android:imeSubtypeExtraValue` must be set to the name of your layout file (without file ending)
* `android:subtypeId` must be set to a value that is unique in this file (please use the same length as for other layouts)
* If you add a layout to an existing language, add a string with the layout name to use instead of `subtype_generic`. The new string should be added to default [`strings.xml`](/app/src/main/res/values/strings.xml), and optionally to other languages. `%s` will be replaced with the language.
* If you add a new language, you might want to provide a [language_key_texts](/app/src/main/assets/language_key_texts) file
* If you add a new language, you might want to provide a [locale_key_texts](/app/src/main/assets/locale_key_texts) file
* `[popup_keys]` section contains popup keys that are similar to the letter (like `a` and `ä` or `य` and `य़`)
* Such forms should _not_ be in the layout. They will apply to all layouts of that language, even custom ones.
* The popup keys will be added to the "_Language_" popup key group (relevant for setting popup key order).