Simplified Chinese Solaris User's Guide

Chapter 5 Code Table Input Method Interface

Introduction

The Simplified Chinese Solaris software provides code table interface for adding new input methods. In a plain text file, you can create a list Chinese words or phrases along with the key strokes you have selected to create them.

Creating a Code Table

  1. Create and edit code table source file:

    First create a plain text file, which contains a list Chinese words or phrases along with the key strokes, then convert it to binary format that the codetable input method interface can recognized, then user can add it into system.

    There are several sections in codetable file:


    #
    # Description
    # Comment
    # Key_Prompt
    # Function_Key
    # Phrase
    # Single
    # Options
    #

    The following figure shows an example source file:

    Graphic
  2. Enter the Description

    This section specifies attributes of the codetable, such as encoding, name, valid characters,the maximum number of codes for one input items, and wild characters.

    1. Name: specify the name of this codetable.

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

    3. WildChar: specify the wild character for input codes.

    4. UsedCodes: specify the valid characters to input.

    5. MaxCodes: specify the maximum number of input codes for one items.

  3. Enter the Comment

    This section can be used to keep the codetable writer's comments or explanations.

  4. Enter the Key_Prompt

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

  5. Enter the Function_Key

    This section specifies the key definations of some function keys, such as: Page UP key to scroll the candidate items up, Page Down key to scroll the candidate items down, BackSpace Key to delete an input code, and the ClearAll key to clear all input areas, such as the preedit area and the lookup area.

    This section has following entry items:

    1. "PageUp:"

    2. "PageDown:"

    3. "BackSpace:"

    4. "ClearAll:"

  6. Enter Options

    This section specify the options of the codetable input method, such as: whether to display help information for each candidate items, or whether to display the prompt string of the input key in preedit area, whether to display the lookup candidates key by key or only display the lookup candidates when user input space key, whether to commit the candidate when there is only one lookup result, and the select key modes: Number mode, Lower case mode or Upper case mode.

    The Options section has following entry items:

    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. "SelectKey_Mode:" Value: "Number", "Lower" or "Upper"

  7. Enter the Single Section

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

    The format of every line as follows:

    eystroke_sequence Characterlist

    CharacterList is a list of Chinese characters with no separate spaces.

  8. Enter the Phrase Section

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

    The format of every line is as follows:

    keystroke_sequence word1 word2 word3 ...

Converting the Source Codetable File from Text Format to Binary Format or from Binary Format to Text Format:

Use the utility tools txt2bin to convert a text codetable file to binary file. and bin2txtto convert binary format file to text format file.

bin2txt and txt2bin are under directory: /usr/lib/im/locale/zh_CN/common.

The command syntax is:


 # /usr/lib/im/locale/zh_CN/common/txt2bin    
source_codetable_file   
binary_codetable_file 
  # /usr/lib/im/locale/zh_CN/common/bin2txt    
binary_codetable_file   
source_codetable_file 

Creating a new codetable input method

  1. Create and edit 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 user wants to have associated. The words are separated by spaces.

    You need to 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 the user types a Chinese character, all the words associated with it in the dictionary will be shown for a 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_CN/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 input method specification file:

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

    The "sysime.cfg" file requires the following information: Input method name

    For example: If your new codetable binary file is newim.data, then add a line newim to the input method specification file sysime.cfg: Once the sysime.cfg file is updated, the Simplified Chinese Solaris operating environment can interpret the input method.

  4. Restart the input method server (htt) or relogin system so that your new input method can be recognized.

    To restart the htt server, login as root, and run:

    # /etc/init.d/IIim stop

    # /etc/init.d/IIim start

    Then logout from the CDE desktop and relogin. The new input method will be ready for use.