Mac OS X 10.6: Creating and using your own input method
Mac OS X comes with some standard input methods for languages such as Chinese. You can add your own custom input method for any language.
To add an input method, you need a “rule file,” a text file that maps what you type on the keyboard to the characters that are shown. You can save the file with either the Apple format “.inputplugin” or the “.cin” format, commonly used by other open source systems. A sample input method rule file is at the end of this page.
To create a rule file for your own input method:
-
Open TextEdit or another text editor.
-
Create your rule file using the sample text below as a guideline.
-
Save the file with a name for your input method and the extension “.inputplugin” or “.cin”.
-
Drag the file to the Input Methods folder in the Library folder at the top level of your hard disk, or to the Input Methods folder in the Library folder in your home folder.
-
Choose Apple menu > System Preferences, click Language & Text, and then click Input Sources. Select the checkbox for your input method.
-
Log out and then log in again.
Your custom input method appears in the Input menu.
If you don’t want to use a custom input method any more, remove the rule file you created from the Library folder where you placed it.
Below is a sample format you can use:
#
# (c) Apple Inc. 2007
# Sample plug-in input method rule file.
# The # character is used to indicate comments.
# The file format can be plain text or .cin. If plain text, the file encoding must be Unicode (UTF-16) with or without an initial BOM (Byte Order Mark). For .cin, the file encoding can be UTF-16 or UTF-8.
# The file consists of a number of tags, in uppercase ending with a colon, followed by the content of the tag.
#
# METHOD: This is the first entry in the file, defining the method used to implement the plugin.
# The only method currently supported is "TABLE".
#
METHOD: TABLE
#
# ENCODE: This indicates whether the target is Traditional Chinese ("TC"), Simplified Chinese ("SC"), or Unicode ("Unicode"). All plug-in input methods appear as Unicode input methods in the Input Sources pane of Language & Text preferences.
#
ENCODE: TC
#
# PROMPT: This is the name of the plugin, shown in the Input Sources pane of Language & Text preferences.
#
PROMPT: SampleIM
#
# DELIMITER: This defines the delimiter for characters or phrases with same input code.
# In this case, we are using the comma character.
#
DELIMITER: ,
#
# VERSION: This is used to indicate the version number of the plug-in.
#
VERSION: 1.0
#
# MAXINPUTCODE: The limit of the number of characters that can be input for a single conversion.
# There is no limit unless you specify one.
#
MAXINPUTCODE: 8
#
# VALIDINPUTKEY: The set of characters that can be used for input strings. These are case-insensitive but must be entered as one complete set.
#
VALIDINPUTKEY: 0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
#
# BEGINCHARACTER: This tag begins the definitions for the mappings and is required.
# The format for each mapping is:
# [input string] [TAB] [output string1] [DELIMITER] [output string2] ... [DELIMITER] [output stringN]
# Blank lines and characters are ignored.
# The delimiter between output strings is that defined above by the DELIMITER tag.
# Indicate that the mapping definitions have ended with the
ENDCHARACTER tag.
#
BEGINCHARACTER
aardvark 土豚
abacus 算盤
abalone 鮑魚,鰒魚
apple 蘋果
#
# ENDCHARACTER: This terminates the mapping definitions and is the last character in the file.
#
ENDCHARACTER