| 1 | <h2>Comments</h2> |
| 2 | <pre><code>c This is a comment</code></pre> |
| 3 | |
| 4 | <h2>Strings, numbers and characters</h2> |
| 5 | <pre><code>"'this' is a string" |
| 6 | 'and so is "this"' |
| 7 | U+0041 d65 x41 c these are all the letter A |
| 8 | </code></pre> |
| 9 | |
| 10 | <h2>Prefixes and Virtual Keys</h2> |
| 11 | |
| 12 | <pre><code> |
| 13 | c Match RAlt+E on desktops, Ctrl+Alt+E on web because L/R Alt not consistently supported in browsers. |
| 14 | $KeymanOnly: + [RALT K_E] > "€" |
| 15 | $KeymanWeb: + [CTRL ALT K_E] > "€" |
| 16 | </code></pre> |
| 17 | |
| 18 | <h2>Example Code</h2> |
| 19 | |
| 20 | <pre><code>c =====================Begin Identity Section=================================================== |
| 21 | c |
| 22 | c Mnemonic input method for Amharic script on US-QWERTY |
| 23 | c keyboards for Keyman version 7.1, compliant with Unicode 4.1 and later. |
| 24 | c |
| 25 | |
| 26 | store(&VERSION) '9.0' |
| 27 | store(&Name) "Amharic" |
| 28 | c store(&MnemonicLayout) "1" |
| 29 | store(&CapsAlwaysOff) "1" |
| 30 | store(&Copyright) "Creative Commons Attribution 3.0" |
| 31 | store(&Message) "This is an Amharic language mnemonic input method for Ethiopic script that requires Unicode 4.1 support." |
| 32 | store(&WINDOWSLANGUAGES) 'x045E x045E' |
| 33 | store(&LANGUAGE) 'x045E' |
| 34 | store(&EthnologueCode) "amh" |
| 35 | store(&VISUALKEYBOARD) 'gff-amh-7.kvk' |
| 36 | store(&KMW_EMBEDCSS) 'gff-amh-7.css' |
| 37 | HOTKEY "^%A" |
| 38 | c |
| 39 | c =====================End Identity Section===================================================== |
| 40 | |
| 41 | c =====================Begin Data Section======================================================= |
| 42 | |
| 43 | c ---------------------Maps for Numbers--------------------------------------------------------- |
| 44 | store(ArabOnes) '23456789' |
| 45 | store(ones) '፪፫፬፭፮፯፰፱' |
| 46 | store(tens) '፳፴፵፶፷፸፹፺' |
| 47 | store(arabNumbers) '123456789' |
| 48 | store(ethNumbers) '፩፪፫፬፭፮፯፰፱፲፳፴፵፶፷፸፹፺፻፼' |
| 49 | store(arabNumbersWithZero) '0123456789' |
| 50 | store(ColonOrComma) ':,' |
| 51 | store(ethWordspaceOrComma) '፡፣' |
| 52 | c ---------------------End Numbers-------------------------------------------------------------- |
| 53 | |
| 54 | c =====================End Data Section========================================================= |
| 55 | |
| 56 | c =====================Begin Functional Section================================================= |
| 57 | c |
| 58 | store(&LAYOUTFILE) 'gff-amh-7_layout.js' |
| 59 | store(&BITMAP) 'amharic.bmp' |
| 60 | store(&TARGETS) 'any windows' |
| 61 | begin Unicode > use(main) |
| 62 | group(main) using keys |
| 63 | |
| 64 | c ---------------------Input of Numbers--------------------------------------------------------- |
| 65 | |
| 66 | c Special Rule for Arabic Numerals |
| 67 | c |
| 68 | c The following attempts to auto-correct the use of Ethiopic wordspace and |
| 69 | c Ethiopic comma within an Arabic numeral context. Ethiopic wordspace gets |
| 70 | c used erroneously in time formats and Ethiopic commas as an order of thousands |
| 71 | c delimiter. The correction context is not known until numerals appear on _both_ |
| 72 | c sides of the punctuation. |
| 73 | c |
| 74 | any(arabNumbersWithZero) any(ethWordspaceOrComma) + any(arabNumbers) > index(arabNumbersWithZero,1) index(ColonOrComma,2) index(arabNumbers,3) |
| 75 | |
| 76 | c Ethiopic Numerals |
| 77 | |
| 78 | "'" + '1' > '፩' |
| 79 | "'" + any(ArabOnes) > index(ones,2) |
| 80 | |
| 81 | c special cases for multiples of one |
| 82 | '፩' + '0' > '፲' |
| 83 | '፲' + '0' > '፻' |
| 84 | '፻' + '0' > '፲፻' |
| 85 | '፲፻' + '0' > '፼' |
| 86 | '፼' + '0' > '፲፼' |
| 87 | '፲፼' + '0' > '፻፼' |
| 88 | '፻፼' + '0' > '፲፻፼' |
| 89 | '፲፻፼' + '0' > '፼፼' |
| 90 | '፼፼' + '0' > context beep c do not go any higher, we could beep here |
| 91 | |
| 92 | c upto the order of 100 million |
| 93 | any(ones) + '0' > index(tens,1) |
| 94 | any(tens) + '0' > index(ones,1) '፻' c Hundreds |
| 95 | any(ones) '፻ '+ '0' > index(tens,1) '፻' c Thousands |
| 96 | any(tens) '፻' + '0' > index(ones,1) '፼' c Ten Thousands |
| 97 | any(ones) '፼' + '0' > index(tens,1) '፼' c Hundred Thousands |
| 98 | any(tens) '፼' + '0' > index(ones,1) '፻፼' c Millions |
| 99 | any(ones) '፻፼' + '0' > index(tens,1) '፻፼' c Ten Millions |
| 100 | any(tens) '፻፼' + '0' > index(ones,1) '፼፼' c Hundred Millions |
| 101 | |
| 102 | c enhance this later, look for something that can copy a match over |
| 103 | any(ethNumbers) + any(arabNumbers) > index(ethNumbers,1) index(ethNumbers,2) |
| 104 | c ---------------------End Input of Numbers----------------------------------------------------- |
| 105 | |
| 106 | c =====================End Functional Section=================================================== |
| 107 | </code></pre> |