Skip to content

Commit 4f926ea

Browse files
authored
Merge pull request #219 from telextractor/turkish-fix
Fixed Turkish Q layout
2 parents bbcf3de + ffe7b05 commit 4f926ea

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/services/SimpleKeyboardIME.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import com.simplemobiletools.keyboard.interfaces.OnKeyboardActionListener
3636
import com.simplemobiletools.keyboard.views.MyKeyboardView
3737
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_holder
3838
import kotlinx.android.synthetic.main.keyboard_view_keyboard.view.keyboard_view
39+
import java.util.Locale
3940

4041
// based on https://www.androidauthority.com/lets-build-custom-keyboard-android-832362/
4142
class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, SharedPreferences.OnSharedPreferenceChangeListener {
@@ -211,7 +212,11 @@ class SimpleKeyboardIME : InputMethodService(), OnKeyboardActionListener, Shared
211212
val originalText = inputConnection.getExtractedText(ExtractedTextRequest(), 0)?.text
212213

213214
if (Character.isLetter(codeChar) && keyboard!!.mShiftState > ShiftState.OFF) {
214-
codeChar = Character.toUpperCase(codeChar)
215+
if (baseContext.config.keyboardLanguage == LANGUAGE_TURKISH_Q) {
216+
codeChar = codeChar.toString().uppercase(Locale.forLanguageTag("tr")).single()
217+
} else {
218+
codeChar = Character.toUpperCase(codeChar)
219+
}
215220
}
216221

217222
// If the keyboard is set to symbols and the user presses space, we usually should switch back to the letters keyboard.

app/src/main/kotlin/com/simplemobiletools/keyboard/views/MyKeyboardView.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,11 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
473473
private fun adjustCase(label: CharSequence): CharSequence? {
474474
var newLabel: CharSequence? = label
475475
if (!newLabel.isNullOrEmpty() && mKeyboard!!.mShiftState != ShiftState.OFF && newLabel.length < 3 && Character.isLowerCase(newLabel[0])) {
476-
newLabel = newLabel.toString().uppercase(Locale.getDefault())
476+
if (context.config.keyboardLanguage == LANGUAGE_TURKISH_Q) {
477+
newLabel = newLabel.toString().uppercase(Locale.forLanguageTag("tr"))
478+
} else {
479+
newLabel = newLabel.toString().uppercase(Locale.getDefault())
480+
}
477481
}
478482
return newLabel
479483
}

0 commit comments

Comments
 (0)