Spring 2017/Making a keyboard layout

From LING073
Revision as of 20:15, 21 January 2017 by Jwashin1 (talk | contribs) (Development cycle)

Jump to: navigation, search

Classroom activities

Using a keyboard already on your system

The desktop environment that the virtual machines logs in to is Cinnamon, which is based on Gnome2. The instructions here will assume that this is what you're using, though there are a number of other linux desktop environments out there, where these instructions may need to be tweaked a bit.

  1. Open keyboard settings. One way to do this is to right click on an empty part of the panel/bar at the bottom of the screen and click "All Settings"; then find "Keyboard". (Alternatively, just click the "Menu" button at the bottom left and type "Keyboard" and press enter.)
  2. Go to the "Keyboard layouts" tab and add ("+" button) a layout of your choice. Something obviously different from the US English layout (like Russian or Hebrew) might be good for testing.
  3. Set up three keys: an Alt-Gr / 3rd level key (recommended: right ‹Alt›), a compose key (recommended: left Windows key), and a layout-switching key (recommended: ‹Caps Lock› OR left ‹Alt›+‹Shift›). In the Keyboard layouts window, click "Options..." (bottom right), and find the following (respectively): "Key to choose 3rd level", "Position of Compose key", and "Switching to another layout".
  4. Test your keys in a text editor.
    • You can preview your keyboard to see if 3rd-level options exist (they're to the left of the normal key values), and if they don't, you can try adding a keyboard layout like "Russian (Kazakhstan, with Kazakh). Then ‹Alt-Gr› + ‹f› should print "ә" (Cyrillic [æ] letter).
    • Using an English keyboard layout, you can test your Compose key as follows: press ‹Compose› once, press ‹e› twice; this should print "ə" (Latin-alphabet schwa letter). Try other combinations, like ‹Compose› + ‹t› + ‹h›, or ‹Compose› + ‹=› + ‹E›.

Adding an existing xkb layout to your system

For this exercise, you're going to download and install a Latin-alphabet layout I made that supports several Turkic languages as well as quite a bit of IPA.

  1. Download the tks file listed in my keyboard repo on github. You can click on the file, and the click raw, and save that, or you can simply use a terminal by typing something like wget https://raw.githubusercontent.com/jonorthwash/keyboards/master/xkb/tks.
  2. Put the tks file in /usr/share/X11/xkb/symbols. You can use the cp command to do it, and you'll probably need to use sudo too. E.g. sudo cp tks /usr/share/X11/xkb/symbols/
  3. Add a layout entry in the /usr/share/X11/xkb/rules/evdev.xml file for the layout. To do this, edit that file with your favourite text editor (again, you'll probably need sudo), and search for the end of the layoutList section by searching for </layoutList> in the file. Copy a simple layout block from above that line, paste it in as a new layout block (between the last </layout> and </layoutList>and modify it for this layout. You can use something like this:
        <layout>
          <configItem>
            <name>tks</name>
            <shortDescription>tks</shortDescription>
            <description>Jonathan's Turkic and IPA layout</description>
            <languageList><iso639Id>eng</iso639Id><iso639Id>tur</iso639Id></languageList>
          </configItem>
        </layout>
    
  4. Save the file, exit the editor, and restart cinnamon. The quickest way to do this is to run cinnamon --replace on the command line.
  5. Go back to your keyboard layout settings, and you should be able to find the layout under "Jonathan's Turkic and IPA layout" in the list.
  6. Note: now when you switch layouts, you'll notice that this layout has no flag associated with it in the keyboard selector on the bottom panel. Since flags are not languages (and certainly aren't keyboard layouts), this is kind of silly, and might be good to disable. To do this, simply right click on the keyboard layout selector, click "Configure..." and uncheck "Use flags to display keyboard layouts".

Issues to consider

Technical issues

  • Many-character input (e.g., kana)
  • Compose key versus

Design issues

  • What to base your input method on
    • Is there a layout used in the region that already has all the characters available? Or is one character short?
  • Use of other languages

What not to do

  • Which of these xkb keyboard layouts do you think Kazakh speakers in Kazakhstan prefer to use to type Kazakh, and why? The "Russian" layout is the modern standard Russian keyboard layout, and the "Kazakh" layout has been available in Windows for at least 15 years or so. Almost all Kazakh speakers in Kazakhstan also speak Russian (but not all Russian speakers in Kazakhstan also speak Kazakh).
Kazakh
Kazakh (with Russian)
Russian


Russian (Kazakhstan, with Kazakh)


The Assignment

Create an xkb keyboard layout for your language in linux.

Where to submit

You will submit this assignment in a new git repository titled ling073-xyz-keyboard, where xyz is the three-letter ISO code of your language. You will also be asked to put some things on a wiki page titled Language/Keyboard, where Language is the name of your language—a page which should already exist, and to which you should add a link to the Keyboard page.

Justification

For ease of use, it might make sense to base the layout on something likely to be common in the area. However, this can fail in several different ways, as seen with the Kazakh example above:

  • It could seem like the less-well-resourced language is being thought of as "derived from" or a "variant of" the better-resourced language.
  • It could become difficult to type on the new layout because of awkward placement of symbols:
    • "extra" symbols placed on e.g., number row
    • "extra" symbols placed on third row (Alt-Gr)
    • characters of the original layout are replaced with symbols of the new layout (and removed or rearranged)
    • symbols of the original layout are rearranged (!)
  • While it could be useful to maintain support on the same keyboard layout for other languages speakers might use (e.g., a larger language in the area or English), it isn't necessarily crucial: speakers can always just use an alternate keyboard layout.

Document your justification for each decision you made. Include this in a file entitled README in your new repository, and in a section called "Justification" on the wiki page (see #Where to submit above).

Development cycle

For xkb layouts, the steps to develop a keyboard are generally something like this:

TODO

Other things to document

  • Document the steps needed to install your keyboard layout. It might be good to test this on a VM on one of the other workstations in the classroom. Write up the steps in an INSTALL file in the repository and under an "Installation" section on the wiki (write it up in one place and transfer it over—i.e., try to keep them in sync).
  • Add an AUTHORS file in the repository and put your name (or alias) and email address there.
  • Decide on an open-source license for your keyboard layout and include the text of the license in a LICENSE file in the repo. Add a mention of how it's licensed on the wiki page.

Extra steps

If designing your keyboard layout involves only minor changes to an existing layout (such as adding one or two letters to 3rd-level positions), then also do one of the following:

  • Make a "transcription" layout that includes most phonetic symbols needed to transcribe your language. This should include IPA symbols and any symbols used in academic transcriptions of the language.
  • Set up some Compose-key combinations for your language. E.g., for Kazakh, ‹-› could compose with ‹о›, ‹ү›, and ‹г› to result in ‹ө›, ‹ұ›, and ‹ғ›, respectively, while ‹,› could compose with ‹к› and ‹н› to result in ‹қ› and ‹ң›, respectively. (There are only three more letters in Kazakh that aren't in Russian too: ‹ә›, ‹і›, ‹һ›.) Don't forget upper-case characters too (if relevant)!
  • Make your keyboard capable of being used to type not just your language, but a range of related languages, or other languages spoken in the area. You can do this in part using the compose key idea above, so that with the Kazakh example above, ‹,› could combine with ‹х› to create the Uzbek and Tajik letter ‹ҳ›, with ‹ч› for the Tajik letter ‹ҷ›, with ‹с› and ‹з› for the Bashqort and Chuvash letter ‹ҫ› and the Bashqort letter ‹ҙ›. You could also do something similar with dead keys or combining diacritical marks, which are like using Compose combinations except that you don't need Compose (though dead key strategies aren't easily implemented in xkb for non-Latin orthographies). You may try another input options, such as iBus, for things like this, though that requires a certain amount more effort. If you just use xkb, make sure you support the full orthography of at least two other languages besides your language and the larger language whose keyboard you're basing this on.

Add what you did to the README file and the "Justification" section on the wiki"