Helium314 / HeliBoard

Customizable and privacy-conscious open-source keyboard
Apache License 2.0
2.36k stars 93 forks source link

Please add Korean (Hangeul) support #99

Closed eylenburg closed 1 year ago

eylenburg commented 1 year ago

I'd love to have support for Korean. Korean uses the Hangeul alphabet, which in itself it quite simple with only 24 letters, however where it gets more complex is that these letters can be combined into syllable blocks. For example, for the Korean word for "honeybee" (kkulbeol) you would type the letters ㄲㅜㄹㅂㅓㄹ but it is the two syllables are then combined into two characters and is written as 꿀벌.

I think there was an attempt to bring Korean to Openboard before: https://github.com/Lee0701/openboard/tree/hangul

There's also a Korean keyboard layout in Florisboard, another FOSS Android keyboard: https://github.com/florisboard/florisboard

And there's this Apache licensed Korean keyboard app: https://github.com/RivMt/Openwnn-korean-custom

Helium314 commented 1 year ago

I think there was an attempt to bring Korean to Openboard before: https://github.com/Lee0701/openboard/tree/hangul

Did you try whether this works? I lack the knowledge and the time for implementing this type of layout, but if the linked version works I can try merging it.

eylenburg commented 1 year ago

Hi,

I have built this app myself to test it. I think it's working well. I'm not a native Korean speaker so I can't really tell the subtle differences to e.g. Gboard or Samsung Keyboard, but it works absolutely fine for my needs, including correct combination of letters into syllable characters and sensible word suggestions.

Here is a video of me typing in Korean: https://files.catbox.moe/2hsa6t.mp4

This is the APK for testing it out: https://github.com/eylenburg/openboard-korean/releases/tag/release Note that the APK is based on an older version of Openboard as I simply compiled Lee0701's fork.

It would be great if you could merge this!

Helium314 commented 1 year ago

@Lee0701 you added the support for Korean language. Do you think this is ready to get implemented, or is it still missing something?

Helium314 commented 1 year ago

I did some updating and created PR #160 If you want to test it, here is a debug APK: openboard_1.4.5-debug.zip (based on a slightly outdated version, somewhere between v6 and v7)

eylenburg commented 1 year ago

I tested it and it works very well. Can't see any difference to the Samsung keyboard (which I'd assume is the best Korean keyboard)!

Helium314 commented 1 year ago

Alright, then I'll check out the changes in more detail, fix some issues (see #160) and merge it.

joopdo commented 1 year ago

Thank you! Korean typing works well

eylenburg commented 1 year ago

Amazing thanks! That was so quick

Helium314 commented 1 year ago

Ah, still not sure whether it will be working 100%. But in the current state it does not affect non-Hangul keyboards any more, so merging it should be fine.

The Hangul combiner (for combining keys to symbols) caused some issues when it should just do nothing (e.g. inputting numbers). I solved this by disabling the Hangul combiner in some situations, but that might not be working properly for the spell checker.

joopdo commented 1 year ago

Question: i have swiping enabled for English. If there is a .dict file for Korean, would that enable swiping for Hangeul keyboard as well?

Helium314 commented 1 year ago

In the debug build above, a dictionary is included. I removed it from the PR, because I don't want to include too many dictionaries (will remove more). If you don't use that version but built the current state yourself, you can use this.

joopdo commented 1 year ago

Oh, since you asked for feedback: I found a potential issue which I met before with openboard:

https://github.com/Helium314/openboard/assets/1182449/c5b532a0-433d-4e33-ad18-ae24c26f3fc4

Observed behavior: I type a word (any word) for example: 한글. Then I want to put input in front of that word, which is not allowed, the cursor skips back to the end of the word.

Helium314 commented 1 year ago

which I met before with openboard

Do you mean on original OpenBoard, or just in this fork?

joopdo commented 1 year ago

I currently have two versions of OpenBoard. Since the official one (from F-Droid) doesn't have Korean, you can still confirm this as follows:

OpenBoard 1.4.5 (F-Droid)

  1. type: 'ord'
  2. hit space
  3. Navigate back to in front of the word
  4. add a 'w'
  5. End Result: 'word '

'OpenBoard Debug' 1.4.5 (from here)

  1. type: 'ord'
  2. hit space
  3. Navigate back to in front of the word
  4. add a 'w'
  5. Result: 'ordw '

Let me know if I can test or log something for you.

Helium314 commented 1 year ago

I can't reproduce this. It may be that it depends on the input type provided by the input field, or possibly on the Android version.

joopdo commented 1 year ago

Thanks for checking. I guess it's a good sign if it doesn't happen elsewhere.

Some more details:

  1. I'm testing with the address bar of Chromium, but observe the same behavior in other input fields.
  2. I just removed all storage and cache for 'OpenBoard debug' and found that the issue persists with vanilla settings.

Android version: 13, CalyxOS 4.12.0. Confirmed on two phones with same specs, OS and similar settings.

Helium314 commented 1 year ago

I guess it's a good sign if it doesn't happen elsewhere.

I don't know. It's definitely good for the users who aren't affected, but bad for devs with old Android versions trying to reproduce the issue.

Let me know if I can test or log something for you.

Thanks! I have some very rough idea where to start checking what goes wrong (LatinIME.onUpdateSelection), but first need to understand what's going on in InputLogic.onUpdateSelection, so know what should be logged.

Helium314 commented 1 year ago

@joopdo I was able to reproduce this when breaking word detection, and added a fix that helps for me. Does it work for you with openboard_1.4.5-debug.zip?

eylenburg commented 1 year ago

With that version it works fine in English, but with Korean it still has the bug where it adds a letter at the beginning of the word (annoying but acceptable), but now it DELETES the word after a space for me. Edit: This wasnt the case in the previous debug version you posted here

joopdo commented 1 year ago

In English the bug is resolved! Unfortunately, with Korean I see the same behavior, whole word gets deleted.

Helium314 commented 1 year ago

That was quite tricky to locate, but should be fixed now: openboard_1.4.5-debug.zip

joopdo commented 1 year ago

Thank you.

testing the latest debug build, at first I observed the same behavior:

type: '글'
hit space
Navigate back to in front of the word
add a '한'
Result: '글한 ', not '한글 '

I reset the settings just in case. same. then start turning off auto correct settings. bingo. 'show correction suggestion' toggle OFF leads to the desired result:

type: '글'
hit space
Navigate back to in front of the word
add a '한'
Result: '한글 '

ill have more time to test tomorrow. I can also check of this solves the issue in the earlier build as well, as I never tried this before. honestly I'm not sure what that toggle does.... thanks for your work!

eylenburg commented 1 year ago

I can confirm this

eylenburg commented 1 year ago

Actually I found one more bug when you try to use backspace while typing a word.

Buggy behaviour: Type a word, use backspace key while still "in the word" (underlined) -> no effect, no letter gets deleted. Then type space key -> whole word gets deleted and replaced with a space.

vs Correct behaviour: Type a word, "exit word" with space key. Editing works as expected, adding letters, deleting letters with backspace etc all good.

edit: this is with 'show correction suggestion' toggle OFF. with the toggle ON the problem remains but ALSO it's not possible to use backspace in the middle of a word, you can only use it to delete the whole word from the end.

joopdo commented 1 year ago

just tried with the latest release and it doesn't work as expected.

reproduce, with all spell check off: type: 보냈어요 (in this order: ㅂ ㅗ ㄴ ㅐ ㅆ (shift ㅅ ) at this point, you can observe the previous two completed syllable's disappear.

hard to explain, adding video: https://github.com/Helium314/openboard/assets/1182449/8a132630-da78-4409-a73e-09d36164c8f1

eylenburg commented 1 year ago

I can confirm

Helium314 commented 1 year ago

Could you open a new issue about this? I likely won't have time to fix it (need to dive into the implementation details first), but a separate issue is definitely a better reminder than a comment here.

eylenburg commented 1 year ago

Done in #214