-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard for Arabic and languages with Arabic script, initial release #5569
Conversation
On which system is that? You can use the extracted AppImage (for just testing Lua stuff) or the Docker image to have a tailored build environment, see https://github.com/koreader/koreader/blob/master/doc/Building.md#setting-up-a-build-environment-for-koreader Also on systems other than Android it's generally simple to just change a few Lua files. |
I'm building on desktop Linux. |
You still need to add it to this table: koreader/frontend/ui/widget/virtualkeyboard.lua Lines 526 to 535 in f1f75c5
|
Sort of. As long as you have the libraries in place that should be fine, but it's normally faster and easier to just overwrite the couple of Lua files you edited. |
@Frenzie I did that ... KOReader now crashes. Why is that? |
@@ -60,7 +60,7 @@ local alef = ar_popup.alef | |||
local baa = ar_popup.baa | |||
local jeem = ar_popup.jeem | |||
local daal = ar_popup.daal | |||
local h-aa = ar_popup.h-aa | |||
local haa2 = ar_popup.haa2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incidentally, underscore (_
) is fine in a variable name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Frenzie I know, but I removed them in order to isolate an issue. I'll return them in the next round of cleanups. But for now, the keyboard as is would crash KOReader for some reason.
I have no idea, because all you've got here is two completely independent files that literally can't affect anything at all. ^_^ The crash.log will tell you more if you want to find out, or you can just overwrite the whole thing with the latest nightly from http://build.koreader.rocks/download/nightly/v2019.10-33-gf1f75c5_2019-11-06/ so you've got a working copy. |
Anyway, I can push a few fix-up commits to your branch if you like. |
It would be great if you do! |
@WaseemAlkurdi See the two individual commits for the (minor) changes. |
@@ -377,6 +377,7 @@ function VirtualKeyPopup:init() | |||
virtual_key.onHoldReleaseKey = function() | |||
virtual_key:onTapSelect(true) | |||
UIManager:close(self) | |||
return true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I didn't mean to commit this line but that's okay. This solves the worst part of #5555.
See your crash.log, you should have a stack trace that will tell you (or us) why it crashes, and what must have happened for it to crash even if your lua files are error-free (truncated transfer, other file touched...) About AppImage: https://github.com/koreader/koreader/wiki/Installation-on-desktop-linux Also, we'll have to think about these HE/AR keyboards: is it fine that you start with querty, and you have to it the little Globa icon key to have the HE/AR keys? Or should we start with these, and get qwerty with that Globe icon key instead. See #5414 (comment) and around. |
@poire-z Not lost, that's at the top of https://github.com/koreader/koreader/blob/master/doc/Building.md#setting-up-a-build-environment-for-koreader |
@WaseemAlkurdi Now you'll need to |
-- fourth row | ||
{ | ||
{ "Sym", "Sym", "ABC", "ABC", "Sym", "رمز", "رمز", "رمز", "Sym", "Sym", "ABC", "ABC", | ||
width = 1.5}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could try reducing this width to = 1 to not have these keys overflow the keyboard :)
The original build error vaguely looks like you haven't pulled the submodules? One kodev step should take care of that, see the docs ;). Otherwise, I'm going to need more context. Also, I've posted the one-liner I use to scp updated files to my devices a couple of times around. I'm unfortunately not on my desktop right now, but it's basically based on the list that |
A |
}, | ||
-- third row | ||
{ -- 1 2 3 4 5 6 7 8 9 10 11 12 | ||
{ label = "بَدِّل", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you need to leave it as "Shift" for it to work.
{ ",", ",", "’", "↓", "ֽ ", waw, "Ю", "ю", "Ç", "ç", "…", "¨", }, | ||
{ ".", ".", "’", "↓", "ֽ ", zay, "Ю", "ю", "Ç", "ç", "…", "¨", }, | ||
{ "/", "/", "’", "↓", "ֽ ", thaa, "Ю", "ю", "Ç", "ç", "…", "¨", }, | ||
{ label = "مَسح", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: must stay Backspace (that's not what displayed, the icon= takes precedence, but I guess the label (albeit displayed if no icon) serves as recognizing it should do shift or backspace.
}, | ||
-- fourth row | ||
{ | ||
{ "Sym", "Sym", "ABC", "ABC", "Sym", "رمز", "رمز", "رمز", "Sym", "Sym", "ABC", "ABC", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like these رمز", "رمز", "رمز"
(raaah, so hard to cut and paste and wrap, bidi hell!) need to be added to:
symbolmode_keys = {["Sym"] = true, ["ABC"] = true, ["رمز"] = true},
on line 91, for them to work.
(That's going to be my new swear word : that bidi-mary is bidi disgusting on this bidi sunday :)
{ diacritic_tanween_damm, qaf, "#", "3", }, | ||
{ "ﻹ", fah, "+", _eq, }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might keep them all aligned the same way with the 1 2 3 4
, for readability :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poire-z Can I do that from the web interface, or do I have to push again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poire-z Turns out that I can, but it would be considered another commit. Not a problem!
{ "ﻹ", fah, "+", _eq, }, | ||
{ "إ", ghayn, "€", "(", }, | ||
{ "`", ayin, "‰", ")", }, | ||
-- h_aa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can indent that comment (including the --
) up to where the {"ه", label="ه"}
(I assume it says what's that thing is :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poire-z Fixing that!
"ز", | ||
north = "ژ", | ||
}, | ||
ha = { -- الحاء |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could translate that arabic word to english -- الحاء (english translation)
if that means something other than "ha" :) so we don't have to wonder if we're missing something, and to improve the culture of non arabic readers :)
(I wonder the same above for h_aa, but it's shorter, so it would just be h_aa in arabic :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poire-z I didn't know how to "transcribe" the two letters, so I used 'h_aa' for هـ and 'ha' for ح. Honestly, this could be improved, and I myself mix up the two "transciptions".
Please do listen to the first 5 seconds of this YouTube video: https://www.youtube.com/watch?v=YeyVjaWD6-U. The first letter that the announcer pronounces is 'هـ' (my 'h_aa') and the second letter is 'ح' (my ha).
Edit: Had them in reverse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word 'الحاء' is simply the name of the letter, roughly meaning "the letter ha". like how "double u" is sort of a name of the letter W in English.
-- الحركات | ||
diacritics = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that arabic word means "diacritics" :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poire-z Precisely.
|
Fixed the two missing variables by moving the `label=` part from the main keyboard to this file.
- Removed the label. - Fixed the hardcoded labels (and the two missing variables).
Translated label.
Fixed the missing variables ... for good?
Regarding the trick with the zero-width-joiner/non-joiner stuff mentionned in #5569 (comment) : |
@poire-z Sheesh, I've mistyped it while moving. It was supposed to have a ZWJ, but the ZWJ isn't directly accessible on the keyboard, unlike a non-zero width joiner (an easy Shift-J away). Will fix this instant. |
Replaced the non-zero width joiner with a zero width joiner.
GitHub's web UI, at least here on Firefox on Linux, uses a red dot to indicate it instead of the shaped character. |
No, these (from what I see here: https://en.wikipedia.org/wiki/Arabic_Presentation_Forms-A) are the Arabic characters used by non-Arabic languages with Arabic scripts, which are not "legal Arabic". Something like how some French and German characters, while using Latin script, are not "legal Latin". |
Replaced the two letters that have a non-zero width joiner with their preformed ligature forms as per @poire-z's suggestion. Really neat.
Replaced as per your suggestion. It's a much neater solution, having the whole thing as one character, instead of bothering with invisible characters. A small note though. The Wikipedia article (https://en.wikipedia.org/wiki/Arabic_Presentation_Forms-B) says:
Does this mean that these might be deprecated? If so, wouldn't this be a "hack" that might stop working with unpredictable consequences? |
And in B ? :) Isn't it this one:
from https://unicode-search.net/unicode-namesearch.pl?term=HEH |
Oh, allright, you found it :) Is it ok that it does not look the same in GH UI ? |
Stil the alignment with |
- Fixed keyboard row spacing ... should be more organized now. - Added a couple of labels to explain some Arabic strings and transliteration choices.
Done! Should look really tidy now. |
Fixed the missing space
What's a space between friends? :-D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100% conform to my knowledge of Arabic ! (which would give 0, but hey, approved anyway :)
-- Diacritics (al-Harakat الحركات) | ||
diacritics = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last nitpick: have the comment indented as what follows it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@poire-z Done.
Indented a comment.
I'd possibly have gone with IPA for those latest (interesting!) comments, but that's just me ;). |
No, I definitely would've gone with IPA. But I didn't know IPA prior to the university, so I wouldn't really expect anybody else to unless they had a degree in something language-related. |
This is an Arabic character keyboard layout. It is based in part on the PC keyboard layout, and in part on the Google keyboard.
I have had to add some keys to the first and second rows.
I haven't tested this, because attempting to compile the build from source results in an error:
Diacritic marks haven't been added, but they could be added in a couple of minutes, should this be tested and proven to work.
This change is