macOS Sierra: Create and use your own input source

Create and use your own input source

macOS comes with default input sources for languages, such as Pinyin for Chinese. You can create and add your own input source for any language. To do so, you need a rule file that maps what you type on the keyboard to the characters that are shown.

Create a custom input source

  1. Open TextEdit or another text editor.

  2. Create your rule file using the sample file below as a guideline.

    The file must be a plain text file. If you use TextEdit, choose Format > Make Plain Text.

  3. Save the file (the name will appear in the Input menu and the Input Sources pane), with an extension such as “.inputplugin.”

  4. Double-click the saved file.

    Your custom input source is added to the Input menu in the menu bar, and to the list of input sources in the Input Sources pane of Keyboard preferences. To see it, choose Apple menu > System Preferences, click Keyboard, then click Input Sources.

macOS also supports .cin format. If you use a .cin file, the file encoding can be UTF-16 or UTF-8.

Sample rule file

# (c) Apple Inc. 2017

# Sample plug-in input source rule file.

# The # character is used to indicate comments.

# The file format must be plain text. The file encoding must be Unicode (UTF-16) with or without an initial BOM (Byte Order Mark).

# 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 plug-in.

# 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 sources appear as Unicode input sources in the Input Sources pane of Keyboard preferences.

#

ENCODE: TC

#

# PROMPT: This is the name of the plug-in, shown in the Input Sources pane of Keyboard preferences and the Input menu.

#

PROMPT: Sample_En

#

# DELIMITER: This defines the delimiter for characters or phrases with the same input code.

# In this case, we are using the comma character.

#

DELIMITER: ,

#

# VERSION: This is used to indicate the version number of your 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:

# ...

# 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

Delete a custom input source

  1. Choose Apple menu > System Preferences, click Keyboard, then click Input Sources.

  2. Select your input source, then click the Remove button .

  3. Keep the disabled plug-in file (you can add your input source again to the list of input sources), or move it to the trash to delete it.

Published Date: Mar 28, 2017
Helpful?