Traditional Chinese Solaris User's Guide

CodeTable Input Method Interface

Introduction

Solaris 9 provides a codetable input method interface which allows Chinese users to add new input methods into their system.

Creating a CodeTable
  1. First create a plain text file, in which contain a list Chinese words or phrases along with the key strokes.

    Codetable Format:

    The codetable file contains the following sections:

    • [Description]

    • [Comment]

    • [Key_Prompt]

    • [Function_Key]

    • [Phrase]

    • [Single]

    • [Options]

    • For section "[Description]"

      This section describes attributes of the codetable, such as encoding, name, valid characters, the maximum number of codes for one input items, and wild characters. The Description contains the following entries:

      1. "Name:" specifies the name of this codetable.

      2. Encode:" specifies the encoding of this codetable, can be UTF-8, GB, GB2312, GBK, BIG5.

      3. WildChar:" specifies the wild character for input codes.

      4. "UsedCodes:" specifies the valid characters to input.

      5. "MaxCodes:" specifies the maximum number of input codes for one item.

    • For section "[Key_Prompt]"

      This section specifies the prompt string of a input key. The prompt string will be displayed on the Preedit Area of the application software.

    • For section "[Function_Key]"

      This section specifies the key definition of some function keys, such as Page UP to scroll up the selection items, Page Down to scroll down the selection items, BackSpace to delete a input code, and ClearAll to clear all the input areas, such as preedit area, lookup area. This section contains the following entries:

      1. PageUp

      2. PageDown

      3. BackSpace

      4. ClearAll

    • For section "[Options]":

      This section specifies the options of the codetable input method. The Options section contains the following entries:

      1. HelpInfo_Mode: Value: "ON" or "OFF"

      2. KeyByKey_Mode: Value: "ON" or "OFF"

      3. KeyPrompt_Mode: Value: "ON" or "OFF"

      4. AutoSelect_Mode: Value: "ON" or "OFF"

      5. SlectKey_Mode: Value: "Number", "Lower" or "Upper"

    • For section "[Single]":

      This section specifies the input codes and its corresponding single Chinese characters. These Chinese characters must not be separated by the space key.

      The format of every line as follows: keystroke_sequence Characterlist

    • For section "[Phrase]":

      This section specifies the input codes and its corresponding phrase words. These Chinese phrase words must be separated by the space key.

      The format of every line as follows: keystroke_sequence word1 word2 word3 ...

    Example of a codetable file:

    Graphic
  2. Convert the file to binary format that the codetable input method interface can recognize

    Use the utility tools "txt2bin" to convert a text codetable file to binary file, and "bin2txt" to convert binary format file to text format file as follows:

    1. bin2txt and txt2bin are under the directory: /usr/lib/im/locale/zh_TW/common/

      The command syntax is:

      # /usr/lib/im/locale/zh_TW/common/txt2bin source_codetable_file
      binary_codetable_file 
      # /usr/lib/im/locale/zh_TW/common/bin2txt binary_codetable_file
      source_codetable_file 
  3. Save the file to the system.

Creating a new codetable input method
  1. Create and edit the code table source file

    Prepare the code table source file to present the new input method. This dictionary file is a plain text file that contains the words a user wants to have defined. The words are separated by spaces.

    List characters, words, or phrases and the corresponding key strokes required to create them. Each row defines the mapping between one Chinese word and its input key stroke. Thus, when a Chinese character is typed, all the words associated with it in the dictionary will be shown for selection.

  2. Convert the source codetable file to binary format

    Use the utility tools "txt2bin" to convert the prepared text codetable file to binary file.

    The command syntax is:

     # /usr/lib/im/locale/zh_TW/common/txt2bin source_codetable_file
    binary_codetable_file 
  3. Add the code table into the input method specification file.

    After the binary codetable file is ready, the input method can be added to the system by updating the input method specification file:

    /usr/lib/im/locale/zh_TW/sysime.cfg 

    The sysime.cfg file requires the following information:

    For Example: if your new codetable binary file is newim.data, then add a line newim into the input method specification file sysime.cfg. Once the sysime.cfg file is updated, the Traditional Chinese Solaris operating environment can interpret the input method.

  4. Restart the input method server (htt) and relogin to the system to enable the new input method. To restart the input method server (htt), you need to run the following command as root.

     # /etc/init.d/IIim stop 
    # /etc/init.d/IIim start

    The new input method will be ready to use after you relogin.