OSWikiHK: 請協力 GPLv3 的中文翻譯工作。
Create input method with scim-make-table
OSWikiHK,自由中文開源知識庫
目录 |
[编辑]
建立輸入法表
[编辑]
輸入法表範本
先到 http://scim.cvs.sourceforge.net/scim/scim-tables/tables/ 抓取你要的 table 原碼 如 廣東拼音是http://scim.cvs.sourceforge.net/scim/scim-tables/tables/zh/Cantonese.txt.in?revision=1.3&view=markup
用任何 text editor 改改個 table 原碼檔
先將所有 @SCIM_ICONDIR@ 改成 /usr/share/scim/icons
以下是一個很典型的輸入法表範本
### File header must not be modified ### This file must be encoded into UTF-8. ### This file comes from http://www.chinesecj.com SCIM_Generic_Table_Phrase_Library_TEXT VERSION_1_0 ### Begin Table definition. BEGIN_DEFINITION ### An unique id to distinguish this table among others. ### Use uuidgen to generate this kind of id. UUID = 95af07bc-3fee-4541-ac74-c53e9a5fe342 ### A unique number indicates the version of this file. ### For example the last modified date of this file. ### This number must be less than 2^32. SERIAL_NUMBER = 2007051101 ICON = /usr/share/scim/icons/CangJie3.png ### The default name of this table NAME = CangJie 3 ### The local names of this table NAME.zh_CN = 仓颉第三代 NAME.zh_TW = 倉頡第三代 NAME.zh_HK = 倉頡第三代 ### The author of this table AUTHOR = J. Random <jrandom@example.com> ### Supported languages of this table LANGUAGES = zh_CN,zh_HK,zh_SG,zh_TW ### Prompt string to be displayed in the status area. STATUS_PROMPT = 中 ### The Keyboard Layout used by this table. Unset or set to "Unknown" to accept any kind of layouts. KEYBOARD_LAYOUT = US_Default ### If true then the first candidate phrase ### will be selected automatically during inputing. AUTO_SELECT = TRUE ### If true then a multi wildcard will be appended ### at the end of inputing string automatically. AUTO_WILDCARD = FALSE ### If true then the result string will be committed to client automatically. ### This should be used with AUTO_SELECT = TRUE. AUTO_COMMIT = FALSE ### If true then the key will be splitted during inputing automatically. AUTO_SPLIT = TRUE ### If true then the phrases' frequencies will be adjusted dynamically. DYNAMIC_ADJUST = FALSE ### If true then the preedit area will be filled up by the current candidate phrase automatically. AUTO_FILL = FALSE ### If true then the lookup table will always be shown if there is any candidate phrase. ### Otherwise the lookup table won't be shown unless the user requires it by moving the preedit caret left. ALWAYS_SHOW_LOOKUP = TRUE ### Use full width punctuation by default DEF_FULL_WIDTH_PUNCT = FALSE ### Use full width letter by default DEF_FULL_WIDTH_LETTER = FALSE ### The maxmium length of a key. MAX_KEY_LENGTH = 5 ### Show key prompt if true SHOW_KEY_PROMPT = TRUE ### Discard invalude key if true DISCARD_INVALID_KEY = FALSE ### Valid input chars. VALID_INPUT_CHARS = abcdefghijklmnopqrstuvwxyz ### Single wildcard char, can have multiple chars. ### SINGLE_WILDCARD_CHAR = ? ### Multi wildcard char. MULTI_WILDCARD_CHAR = * ### The key strokes to split inputted string. ### SPLIT_KEYS = quoteright ### The key strokes to commit the convert result to client. COMMIT_KEYS = space ### The keys to forward the inputted string to client. ### FORWARD_KEYS = Return ### The key strokes to select phrases SELECT_KEYS = 1,2,3,4,5,6,7,8,9 ### The key strokes to page up the lookup table. PAGE_UP_KEYS = Shift+less,Page_Up,comma,minus ### The key strokes to page down. PAGE_DOWN_KEYS = Shift+greater,Page_Down,period,equal,space ### Define the prompts of each valid input char. BEGIN_CHAR_PROMPTS_DEFINITION a 日 b 月 c 金 d 木 e 水 f 火 g 土 h 竹 i 戈 j 十 k 大 l 中 m 一 n 弓 o 人 p 心 q 手 r 口 s 尸 t 廿 u 山 v 女 w 田 x 難 y 卜 z 重 END_CHAR_PROMPTS_DEFINITION END_DEFINITION ### Begin Table data. BEGIN_TABLE END_TABLE
[编辑]
輸入法選項
- DYNAMIC_ADJUST - 這個功能會記錄相同輸入碼的字你選用的次數,下次將你常用的字放前一點。
[编辑]
輸入法對照表
BEGIN_TABLE 下面 就係輸入碼同字既對照表,可以有三欄 (你可以參考下 倉頡個表 ), 例如以下是cantonese.txt 的表
BEGIN_TABLE fan 瞓 fun 瞓 ngam 啱 .... fai 鐨 fai 廢 fai 徽 fai 輝 fai 煇 fai 沸
- 第一欄 (e.g. fan, fun, ngam) 就是輸入碼
- 第二欄 (e.g. 瞓, 啱, 鐨) 就是對應字
- 第三欄可有可無, 有的話就必定是一個數目字表示呢個字的預設選擇次數, 數字越大, 個字會排得前 d
例如你想打 fai 時 "癈" 排前過 "鐨", 你可以在兩字後家上數字 , 如下:
fai 鐨 495 fai 廢 500
只要"癈" 的數字大過 "鐨" 那個, 那"癈"就會排前
[编辑]
轉換輸入法表
搞定後用 scim-make-table 將個 table 轉戈成 binary format
scim-make-table Cantonese.txt -b -o Cantonese.bin
[编辑]
安裝輸入法
然後把 Cantonese.bin 抄至 /usr/share/scim/tables
登出後再登入就 ok 了
[编辑]

