NAME
|
ktrans – language transliterator |
SYNOPSIS
|
ktrans [ –G ] [ –l lang ] [ kbdtap ] |
DESCRIPTION
|
Ktrans transliterates a stream of keyboard events. Without any
arguments, ktrans reads events from standard input and writes
out converted events to stdout. If a kbdtap file is given, it
is used for both input and output instead. By default ktrans starts
in passthrough mode, echoing out the input with no conversions.
The initial language is set with the –l flag. After operation has
begun, the language may be changed by either typing a control
sequence and/or through the plumber. The following table provides
the control sequence and lang strings accepted for each supported
language respectfully. English (Passthrough).
|
CONVERSION
|
Conversion is done in two layers, an implicit layer for unambiguous
mappings, and an explicit layer for selecting one match out of
a list of ambiguous matches. The following control characters
are used for conversion instructions. ctl–\
Input is always passed along, when a match is found Ktrans will emit backspaces to clear the input sequence and replace it with the matched sequence. Once ctl–\ has been used to start the selection of an explicit match, the up and down arrow keys may be used to thumb around the options. |
DISPLAY
|
Ktrans will provide a graphical display of current explicit conversion
candidates as implicit conversion is done. Candidates are highlighted
as a user cycles through them. At the bottom of the list is an
exit button for quitting the program. Keyboard input typed in
to the window is transliterated but discarded, providing a
scratch input space. The mouse may be used to scroll through and
select candidates, but it requires that ktrans is started using
rio(1)'s –k flag.
The –G flag disables the graphical display entirely. |
KEY MAPPING
For convenience, the control characters used by ktrans can be
mapped directly to physical keys through modifications of the
kbmap (see kbdfs(8)). The /sys/lib/kbmap/jp mapping will turn
language input keys present on Japanese A01/106/109(A) in to control
sequences matching their label:
Henkan
|
DICTIONARIES
|
All implicit and explicit matching dictionaries are provided as
plain text files within /lib/ktrans. The formats of which are
specified within ktrans(6). Additionally, dictionaries located
in $home/lib/ktrans/ will be merged on top of the system dictionaries.
Merging is done at a list level only; Keys that appear
replace all values of the previous definition.
For backwards compatibility the jisho and zidian environment variables
may also be set to pick alternate system dictionaries for Japanese
and Chinese respectfully. |
LANGUAGES
|
JAPANESE Capital Latin input is used for hinting. For adjectives and verbs, a single capital is used as an Okurigana hint. For example, 動かす is typed as 'ugoKasu[^\]'. The hint serves two purposes, it is provided as part of the explicit sequence for Kanji lookup and denotes that the following runes are Okurigana.
For particles, the entire Kana may be input in upper case. This
similarly denotes the end of the Kanji portion of the sequence,
but is not used as part of the lookup sequence itself. So to write
私の猫 the user types "watashiNO[^\]neko[^\]". Note that in both cases
we have successfully communicated to ktrans when to
reset the explicit match buffer without needing to explicitly
give a ctl–l character. CHINESE VIETNAMESE KOREAN |
EXAMPLES
|
To type the following Japanese text: 私は毎日35分以上歩いて、 更に10分電車に乗って学校に通います。
watashiHA[^\]mainichi[^\]35[^l]fun[^\]ijou[^\]aruIte,[^\] saraNI[^\]10[^l]fun[^\]denshaNI[^\]noTte[^\]gakkouNI[^\] kayoImasu.[\n]kenkouNO[^\]ijiNImo[^\]yakuDAtteimasuga,[^\] nakanakatanoshiImonodesu.[\n] where [^\] and [^l] indicate 'ctl–\' and 'ctl–l', respectively. |
SOURCE
|
/sys/src/cmd/ktrans |
SEE ALSO
|
ktrans(6), rio(4), kbdfs(8) |
BUGS
|
There is no hint from rio when the user moves the cursor, as such
moving it is unlikely to result in what the user expects.
Plan 9 lacks support for rendering combinational Unicode sequences,
limiting the use of some code ranges. |
HISTORY
|
Ktrans was originally written by Kenji Okamoto in August of 2000
for the 2nd edition of Plan 9. It was imported in to 9front in
July of 2022, with patches by several contributors. It was towed
inside the environment during the 2022 9front hackathon. |