Files
koreader/frontend/ui/data/keyboardlayouts/ja_keyboard_keys.lua
Aleksa Sarai cdae66a661 keyboard: japanese: switch to 12-key flick layout
This layout is far more commonly used on mobile devices, and allows for
much easier typing. The keyboard primarily functions through gestures in
the four cardinal directions to select which vowel kana to select. In
addition, users can cycle through each kana row by tapping the key
within a 2-second window (this is the equivalent to T9 input for
Japanese phone keyboards).

This also resolves the long-standing issue that the old keyboard did not
correctly handle dakuten (there was a standalone dakuten key which added
a stray dakuten mark, and the umlat mode which added dakuten to all of
the keys it could) and could not input handakuten characters at all.

In order to allow adding dakuten and cycling through the various
modifiers for the previous kana, we need to wrap the input-box (similar
to korean) but luckily we don't need any state machine magic since we
just need to modify the last character in the character buffer. However
because the tap timeout for T9-like-cycling needs to be reset after any
non-tap key we need to add some basic wrappers around a few other
input-box methods.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2021-11-07 19:23:56 +01:00

340 lines
16 KiB
Lua
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--- @note This file was generated with tools/ja_keyboard_generate.py.
-- DO NOT EDIT THIS FILE MANUALLY. Instead, edit and re-run the script.
-- These values are displayed to users when they long-press on the modifier
-- key, so make them somewhat understandable (変換 is not the best word to use
-- for the cycle button because it's fairly generic and in IMEs it usually
-- indicates cycling through the IME suggestions but I couldn't find any
-- documentation about the 12-key keyboard that uses a more specific term).
local MODIFIER_CYCLIC = "変換"
local MODIFIER_DAKUTEN = "◌゙"
local MODIFIER_HANDAKUTEN = "◌゚"
local MODIFIER_SMALLKANA = ""
local MODIFIER_SHIFT = ""
return {
-- Keypad definitions.
h_a = { "", west = "", north = "", east = "", south = "" },
hKa = { "", west = "", north = "", east = "", south = "" },
hSa = { "", west = "", north = "", east = "", south = "" },
hTa = { "", west = "", north = "", east = "", south = "" },
hNa = { "", west = "", north = "", east = "", south = "" },
hHa = { "", west = "", north = "", east = "", south = "" },
hMa = { "", west = "", north = "", east = "", south = "" },
hYa = { alt_label = "",
"", west = "", north = "", east = "", south = "" },
hRa = { "", west = "", north = "", east = "", south = "" },
hWa = { alt_label = "ー〜",
"", west = "", north = "", east = "", south = "" },
h_P = { alt_label = "。?!…",
"", west = "", north = "", east = "", south = "" },
k_a = { "", west = "", north = "", east = "", south = "" },
kKa = { "", west = "", north = "", east = "", south = "" },
kSa = { "", west = "", north = "", east = "", south = "" },
kTa = { "", west = "", north = "", east = "", south = "" },
kNa = { "", west = "", north = "", east = "", south = "" },
kHa = { "", west = "", north = "", east = "", south = "" },
kMa = { "", west = "", north = "", east = "", south = "" },
kYa = { alt_label = "",
"", west = "", north = "", east = "", south = "" },
kRa = { "", west = "", north = "", east = "", south = "" },
kWa = { alt_label = "ー〜",
"", west = "", north = "", east = "", south = "" },
k_P = { alt_label = "。?!…",
"", west = "", north = "", east = "", south = "" },
l_1 = { label = "@-_/", alt_label = "",
"@", west = "-", north = "_", east = "/", south = "" },
l_2 = { label = "abc", alt_label = "",
"a", west = "b", north = "c", east = "" },
l_3 = { label = "def", alt_label = "",
"d", west = "e", north = "f", east = "" },
l_4 = { label = "ghi", alt_label = "",
"g", west = "h", north = "i", east = "" },
l_5 = { label = "jkl", alt_label = "",
"j", west = "k", north = "l", east = "" },
l_6 = { label = "mno", alt_label = "",
"m", west = "n", north = "o", east = "" },
l_7 = { label = "pqrs", alt_label = "",
"p", west = "q", north = "r", east = "s", south = "" },
l_8 = { label = "tuv", alt_label = "",
"t", west = "u", north = "v", east = "" },
l_9 = { label = "wxyz", alt_label = "",
"w", west = "x", north = "y", east = "z", south = "" },
l_0 = { label = "'\":;", alt_label = "",
"'", west = "\"", north = ":", east = ";", south = "" },
l_P = { label = ",.?!",
",", west = ".", north = "?", east = "!" },
s_1 = { alt_label = "☆♪",
"1", west = "", north = "" },
s_2 = { alt_label = "¥$€",
"2", west = "¥", north = "$", east = "" },
s_3 = { alt_label = "%゜#",
"3", west = "%", north = "", east = "#" },
s_4 = { alt_label = "○*・",
"4", west = "", north = "*", east = "" },
s_5 = { alt_label = "+×÷",
"5", west = "+", north = "×", east = "÷" },
s_6 = { alt_label = "<=>",
"6", west = "<", north = "=", east = ">" },
s_7 = { alt_label = "「」:",
"7", west = "", north = "", east = ":" },
s_8 = { alt_label = "〒々〆",
"8", west = "", north = "", east = "" },
s_9 = { alt_label = "^|\\",
"9", west = "^", north = "|", east = "\\" },
s_0 = { alt_label = "~…@",
"0", west = "~", north = "", east = "@" },
s_b = { label = "()[]",
"(", west = ")", north = "[", east = "]" },
s_p = { label = ".,-/",
".", west = ",", north = "-", east = "/" },
-- Cycle lookup table for keitai (multi-tap) keypad input.
KEITAI_TABLE = {
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = " ", [" "] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
[""] = { [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", [""] = "", },
["@"] = { ["@"] = "-", ["-"] = "_", ["_"] = "/", ["/"] = "", [""] = "@", },
["a"] = { ["a"] = "b", ["b"] = "c", ["c"] = "A", ["A"] = "B", ["B"] = "C", ["C"] = "", [""] = "a", },
["d"] = { ["d"] = "e", ["e"] = "f", ["f"] = "D", ["D"] = "E", ["E"] = "F", ["F"] = "", [""] = "d", },
["g"] = { ["g"] = "h", ["h"] = "i", ["i"] = "G", ["G"] = "H", ["H"] = "I", ["I"] = "", [""] = "g", },
["j"] = { ["j"] = "k", ["k"] = "l", ["l"] = "J", ["J"] = "K", ["K"] = "L", ["L"] = "", [""] = "j", },
["m"] = { ["m"] = "n", ["n"] = "o", ["o"] = "M", ["M"] = "N", ["N"] = "O", ["O"] = "", [""] = "m", },
["p"] = { ["p"] = "q", ["q"] = "r", ["r"] = "s", ["s"] = "P", ["P"] = "Q", ["Q"] = "R", ["R"] = "S", ["S"] = "", [""] = "p", },
["t"] = { ["t"] = "u", ["u"] = "v", ["v"] = "T", ["T"] = "U", ["U"] = "V", ["V"] = "", [""] = "t", },
["w"] = { ["w"] = "x", ["x"] = "y", ["y"] = "z", ["z"] = "W", ["W"] = "X", ["X"] = "Y", ["Y"] = "Z", ["Z"] = "", [""] = "w", },
["'"] = { ["'"] = "\"", ["\""] = ":", [":"] = ";", [";"] = "", [""] = "'", },
[","] = { [","] = ".", ["."] = "?", ["?"] = "!", ["!"] = ",", },
},
-- Special keycodes for the cyclic keys.
MODIFIER_KEY_CYCLIC = MODIFIER_CYCLIC,
MODIFIER_KEY_DAKUTEN = MODIFIER_DAKUTEN,
MODIFIER_KEY_HANDAKUTEN = MODIFIER_HANDAKUTEN,
MODIFIER_KEY_SMALLKANA = MODIFIER_SMALLKANA,
MODIFIER_KEY_SHIFT = MODIFIER_SHIFT,
-- Modifier lookup table.
MODIFIER_TABLE = {
[MODIFIER_CYCLIC] = {
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "",
[""] = "", [""] = "", [""] = "",
[""] = "", [""] = "",
},
[MODIFIER_DAKUTEN] = {
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
},
[MODIFIER_HANDAKUTEN] = {
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
},
[MODIFIER_SMALLKANA] = {
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
[""] = "",
},
[MODIFIER_SHIFT] = {
["a"] = "A", ["A"] = "a",
["b"] = "B", ["B"] = "b",
["c"] = "C", ["C"] = "c",
["d"] = "D", ["D"] = "d",
["e"] = "E", ["E"] = "e",
["f"] = "F", ["F"] = "f",
["g"] = "G", ["G"] = "g",
["h"] = "H", ["H"] = "h",
["i"] = "I", ["I"] = "i",
["j"] = "J", ["J"] = "j",
["k"] = "K", ["K"] = "k",
["l"] = "L", ["L"] = "l",
["m"] = "M", ["M"] = "m",
["n"] = "N", ["N"] = "n",
["o"] = "O", ["O"] = "o",
["p"] = "P", ["P"] = "p",
["q"] = "Q", ["Q"] = "q",
["r"] = "R", ["R"] = "r",
["s"] = "S", ["S"] = "s",
["t"] = "T", ["T"] = "t",
["u"] = "U", ["U"] = "u",
["v"] = "V", ["V"] = "v",
["w"] = "W", ["W"] = "w",
["x"] = "X", ["X"] = "x",
["y"] = "Y", ["Y"] = "y",
["z"] = "Z", ["Z"] = "z",
},
},
}