When entering Chinese text, users have the option of entering individual characters and words or a string that identifies a phrase. Chinese phrase input is supported by a phrase database and one of the following:
The Software Input Method (SIM) service
This service, which is enabled
through the
-adec
option of the
stty
command, extends support of phrase input to other Asian terminals in the VT382
series.
The SIM service loads phrases dynamically to the terminal; therefore,
the size of the phrase database is not limited by memory restrictions of terminal
hardware.
When using a terminal supported by the SIM service, you press a
user-defined key sequence to toggle in and out of phrase input mode.
Entering
phrase input mode shifts the site of user input to the 26th line of the terminal
screen where you are prompted to enter phrase codes.
The phrase input mechanism available in the desktop environment
Terminal emulation windows do not implement the 26th line of a terminal screen, so the SIM service does not work correctly in these windows. In a windows desktop environment, phrase input, along with other kinds of input methods, is supported by the input method server for the Chinese and Korean languages. Therefore, you enter phrases by invoking the Input Method application and selecting the phrase item.
The VT382-D Traditional Chinese terminal
A phrase database is loaded in its entirety to this terminal. Memory limitations restrict the size of the database to 100 phrases. The last line on the screen (line 26) is reserved for different input methods, phrase input being one of them, and users are prompted to enter phrase codes on this line.
The
phrase
utility allows you to create and maintain
a phrase database and, when using the VT382-D terminal, to load the database
to the terminal.
Table C-1 lists and describes basic terms associated with phrase input.
Table C-1: Chinese Phrase Input Definitions
Term | Description |
phrase | The string for the phrase that the user wants to retrieve. Each phrase is a string of any characters in the codeset of the current locale and can be a maximum of 80 bytes in length. |
phrase code | The keyword entered by the user to retrieve a phrase. Each phrase code is a string of up to 8 ASCII alphanumeric characters. |
class | A group of logically related phrases. Each class has an identifier that is a string of up to 8 ASCII characters. |
database | A set of two files: the phrase data
file
There are two types of phrase databases: system and user. The system database is shared by all users on the system and is maintained by the system administrator. User databases are defined and maintained by individual users. Pathnames for
the system and user phrase database directories are set in the
Phrase database files are locale specific and reside in locale directories subordinate to the default path. For example, an individual user might create and maintain the following sets of files to support two different locales: $HOME/.sim/zh_TW.big5/phrase.dat $HOME/.sim/zh_TW.big5/class.dat $HOME/.sim/zh_TW.dechanyu/phrase.dat $HOME/.sim/zh_TW.dechanyu/class.dat
|
Table C-2
lists and describes the
stty
command options that enable
and set certain characteristics for Chinese phrase input through the VT382
series of Asian terminals.
These options do not apply to terminal emulation
windows, for which phrase input is supported using mechanisms other than SIM.
Table C-2: The stty Options Used for the SIM Service
stty Option | Description |
sim |
Enables the SIM service. |
-sim |
Disables the SIM service. |
simkey
key |
Sets the toggle key for entering phrase input mode. |
simclass
class |
Sets the current class name for locating
the appropriate phrase in the phrase database.
Classes identify subsets of
information in the phrase database and are defined by using the
phrase
utility. |
simdb
path |
Sets the path for the phrase database. |
simall |
Displays current SIM service settings. |
C.2 Creating and Maintaining a Chinese Phrase Database
You can create or maintain a phrase database
by using the
phrase
utility.
On workstations, you invoke
this utility with the following command:
%
phrase
The command assumes that you are using a private phrase database if you are a nonprivileged user and the systemwide phrase database if you are superuser. You can change these defaults by using the utility's menu interface.
If you are working on a VT382-D traditional Chinese terminal, you can
include one of the options described in
Table C-3.
These options allow you to use the hardware phrase input method supported
by your terminal.
Table C-3: The phrase Options for the VT382-D Terminal
phrase Option | Description |
-user
class_name |
Downloads the phrase definitions for the specified class from your private phrase database to the terminal. |
-system
class_name |
Downloads the phrase definitions for the specified class from the systemwide phrase database to the terminal. |
On startup, the
phrase
utility
displays a full-screen, menu-driven interface like the one in
Figure C-1.
Figure C-1: User Interface Screen of the phrase Utility
Take the following steps to change the language of messages and other text on the user interface to English:
Press the L key.
This action displays items on the LANGUAGE menu.
Press the E key.
This action specifies English for the user interface.
The
phrase
utility is a
curses
application.
To navigate the
phrase
utility user interface, use the following guidelines:
Select a menu and menu items without activating them by using the arrow keys.
Press either Return or the space bar to activate the selected menu or menu item.
To select and activate in one operation, press the key for the underlined letter in the name of a menu or menu item, depending on your current level in the menu hierarchy.
Press Ctrl-x to return to a higher level of the menu hierarchy without activating a selection.
Pressing Ctrl-x when a menu is not activated causes the
phrase
utility to exit.
The
phrase
user interface screen includes:
A menu bar (upper-left corner of the screen)
An area that specifies the current phrase database and class (to the right of the menu bar)
Two lines for warning and informational messages (bottom of screen)
A large area for menu expansion and user dialog (center of screen)
The different menus allow you to perform the following operations:
FILE menu
Override the default path for the phrase database with which you want to work
Load phrases to a VT382D terminal
Exit from the
phrase
utility and save any
changes made to the database
CLASS menu
Create a class
View phrases in the selected class
Rename a class
Delete a class
Select (change) the current class
PHRASE menu
Create a phrase within the selected class
If you do not explicitly select a class, class DEFAULT is assumed.
Modify a phrase
Delete a phrase
LANGUAGE menu
Choose English or Chinese as the language in which screen text and messages appear
The following guidelines and restrictions apply to the phrase-management operations that you can perform:
Creating and maintaining phrases
Phrases are always manipulated within the context of a phrase class. If you do not explicitly select a class, the phrase is assumed to be in class DEFAULT. Otherwise, the phrase applies to the last class name you explicitly selected.
When you choose options that manipulate phrase definitions, a two-part window appears. The left side displays phrase codes while the right side displays phrases.
You input phrase names and definitions in an area below the two-part display window. Choose your phrase name carefully. This is the code used to invoke the phrase later. You cannot modify the phrase name without deleting and reentering the entire phrase definition.
Phrase names must be unique within a given class, but you can use the same phrase name in different phrase classes.
The phrase itself can contain up to 80 bytes of data, which
correspond roughly to 80 columns on the screen.
All 80 bytes of data appear
in the user input area; however, the display window provides fewer than 80
columns to display the phrase.
As a result, long phrase definitions are truncated
at the right boundary of the display window.
In such cases, the right angle
bracket (>
) appears in the rightmost position to indicate
that the phrase definition contains more data.
This truncation is a restriction
of the display window and does not apply to the phrase when it is invoked.
Creating and maintaining classes
Classes are created and maintained within the context of a particular database. If you have not explictly specified a database, the class operation applies to your default database.
Class names must be unique within a database.
Creating a new class causes that class to be the selected class and then automatically invokes the function to create new phrases for the class.
The hardware phrase input method used on the VT382D terminal can load up to 100 phrases in a class. Keep this limitation in mind if you use one of these terminals or are maintaining a database accessed by others who log in through terminals.
There are no restrictions on the number of phrases in a class when phrases are retrieved through other Asian terminals in the VT382 series or through the Input Method window in the CDE environment.
Using multiple phrase databases
Phrase databases are locale specific.
You cannot invoke the
phrase utility without setting the
LANG
environment variable
to a locale; however, you can create phrase databases for any locale.
Be sure
that the
LANG
environment variable is set to the locale
you want to create phrases for before invoking the
phrase
utility.
Otherwise, you will be working with (or creating) phrase databases
for a locale different from the one you want.
You can copy phrase definitions to your private database from the systemwide database and from databases of other users (assuming their file protections allow you read access). If you choose to copy phrases from another user's database, you are prompted for the absolute path of the database from which you want to copy. If the specified database is accessible to you, all its phrase definitions are listed and you select the ones you want to copy.
You must own a database to create, delete, or modify classes in that database. Unprivileged users can perform write operations on their private databases. Only the superuser can perform write operations on the systemwide database.
C.3 Using a Chinese Phrase Database
How you use a phrase database depends on whether you are using the hardware input method or the SIM service. You can use either the hardware input method or SIM service on a VT382D Traditional Chinese terminal. For other terminals in the VT382 series of Asian terminals or for a terminal emulation window on a workstation, you use the SIM service.
If you are using the hardware input method with a VT382D Traditional
Chinese terminal, refer to your terminal user guide for phrase input instructions.
C.3.1 Phrase Input Supported Through the SIM Service
ž
x location: e Ÿ
Before you can use a phrase database, you use the
stty
command to:
Enable the SIM service:
%
stty sim
To enable the SIM service, make sure your locale is set to one that
supports the Hanzi, Hanyu, or Korean codeset and that your terminal line discipline
is set to
adec
.
Define the key sequence for toggling in and out of phrase input mode
The following example sets this key sequence to be Ctrl-b:
%
stty simkey [Ctrl-b]
When you define the key sequence to toggle in and out of phrase mode, pick one that you do not already use at the command line or in other applications. For example, do not define the key sequence to be Ctrl-c (abort operation) or Ctrl-z (suspend operation).
If you do not want to use phrases from the class DEFAULT or from your
default phrase database, use the
stty
command to:
Specify the phrase class that the SIM service or specialized terminal software will use to interpret phrase codes:
%
stty simclass CORP
Specify the database that specialized terminal software will access
The SIM service always searches your private phrase database first for a phrase name and, if the name is not found, then searches the systemwide phrase database. However, terminals that support the hardware phrase input method can load phrases from only one database at a time. Therefore, a nonprivileged user using the terminal hardware input method might enter the following command:
%
stty simdb /var/i18n/sim
When the terminal setup is complete, you can perform the following actions to retrieve a phrase:
Press the key sequence specified for the
simkey
option of the
stty
command, for example Ctrl-b.
At the bottom of your screen, you are prompted to enter a phrase code.
Type the phrase code and press either Return or the space bar.
The phrase is returned to the screen or, if the phrase code was not found, an error message is displayed.
When you want to exit from phrase input mode, press the
simkey
key sequence again.
While in phrase input mode, the characters that you enter are subject to the following rules:
Lowercase alphanumeric characters, which are valid characters for phrase codes, are converted to uppercase.
A space or Return character entered when the phrase code buffer is empty is sent directly to the application from which you entered phrase input mode.
This behavior means that you do not have to exit from phrase mode to enter a space or newline between phrases.
If you enter printable characters other than alphanumeric ones, the bell rings to signal that they are invalid characters for a phrase code.
Control key sequences other than the one used to toggle in and out of phrase mode are sent directly to the application from which you entered phrase input mode.
This behavior means that control sequences such as Ctrl-z and Ctrl-c are handled as you would expect for the system command line, editor, or other application where the phrases are being entered.
Pressing a function or arrow key produces undefined results.
C.3.2 Phrase Input from the Input Options Application
When phrase input is supported by your language setting and the associated input method server is running, your desktop environment includes an Input Options window. Click on the Options button in this window to:
Select the phrase database (user or system)
Select the phrase class within the database
Start phrase input
To start phrase input, select Input Method Customization from the Input Options menu and, in the pop-up dialog box, select Phrase.