Japanese Services : documentation

This information is also available in the read me file included with the download.

Contents of this document

  1. Installation
  2. Use
  3. Configuration
  4. Revision History
  5. About

1. Installation

Double click the preference pane to install it. System Preferences should open and ask you where you want to install the preference pane.

You can choose to install the preference pane only for your user account or for all users of the computer. if you're uncertain which to do, just install it for yourself.

Once you've installed the preference pane and it loads, you will be asked to install the service provider. This copies the program that provides the service into the correct location in your user library folder.

Click install to install it. (note: if you already have an old version of Japanese Services installed, you may see a slightly different message.) You should receive a message telling you installation was successful:

That's it! The program is now installed. Note, however, that you may need to quit and re-open running applications before newly added services are available in those applications.

2. Use

There are three services installed by default. Using the installed services, you can look up words in online dictionaries by selecting the text and either pressing the shortcut key, or selecting the service manually from the Services menu.

You will need to select the service from the menu if your application defines a shortcut that conflicts with the shortcut key you have assigned to the service. Alternatively, if you are using Mac OS 10.5 or later and have the contextual menu plugin enabled, you can right-click (or hold down the control key and click) on the selected text and choose the services from the "Japanese Services" menu that comes up there.

The text you select to look up can either be in English, or in Japanese. For dictionaries that are both Japanese-English and English-Japanese, this will perform the appropriate search based on whether or not the selected text contains Japanese characters. (this means you can't look up romanized Japanese, as this will appear to be an English search key).

3. Configuration

Note: ALC has changed their URL scheme, which is not reflected in this portion of the tutorial.

Japanese Services 2 adds the ability to add your own custom services. Let's add a new service to look up words in the Space ALC dictionary. Open up the Japanese Services Preference Pane in System Preferences. Click the "Add" button next to the list of services, and type in a name and shortcut key for the new service.

Setting up the name for the new service

Next, we need to know what the URL for searching for English and Japanese keys on the ALC dictionary looks like. Go to http://www.alc.co.jp/ and look up any English word (for example, "test".) The URL of the page that you get to will look something like this:

http://www2.alc.co.jp/ejr/index.php?word_in=test&word_in2=%82%A0%82%A2%82%A4%82%A6%82%A8&word_in3=PVawEWi72JXCKoa0Je

Change your search to "testy" and search again, and you'll get this URL.

http://www2.alc.co.jp/ejr/index.php?word_in=testy&word_in2=%82%A9%82%AB%82%AD%82%AF%82%B1&word_in3=PVawEWi72JXCKoa0Je

Change your search to "testing" and search again, and you'll get this URL.

http://www2.alc.co.jp/ejr/index.php?word_in=testing&word_in2=%82%A9%82%AB%82%AD%82%AF%82%B1&word_in3=PVawEWi72JXCKoa0Je

The word you searched for shows up in the URL each time after the "word_in." The part after "word_in2" only changed on your second search, so it appears to be tracking which page you started the search from. The part after "word_in3" is constant, so perhaps it specifies what sort of action to perform. Let's test this hypothesis by constructing a new URL and seeing if it works to look up the word, "address":

http://www2.alc.co.jp/ejr/index.php?word_in=address&word_in3=PVawEWi72JXCKoa0Je

If you test this link, you'll find we get to the page we wanted. So, we've got the URL. Let's type it in:

We replace the place where the search key should go with the special string "\key". This will be substituted with the actual key when the services is used. (if you want to use a normal backslash in a URL, you need to type two backslashes, \\, for every one you want to actually include. This ensures that you can type in any URL, even if it includes backslashes)

Click the test button to be sure the URL is correct.

The procedure for setting up the Japanese URL is similar. After a little experimentation, you'll find that the Japanese URL is formatted identically for ALC, so copy and paste the English URL into the Japanese URL box. Even when the URLs are the same, you must provide both URLs.

Next, we need to be sure that the key encoding is set correctly. In this case, UTF-8 works fine. ALC actually supports many different encodings, but UTF-8 has the advantage of being able to be displayed as a normal string rather than a series of escape sequences (which will look like something like "%CC%F5%A4%B9") in the URL. If the site you're using doesn't use UTF-8, experiment with other encodings by selecting them from the "Key Encoding" menu, and pressing the "Test" button until you find one that works.

4. Revision History

2.1 - May 8, 2008

2.0 - August 4, 2007

5. About

This program was written by Grant Miller, so let me know if you run into any trouble using it by e-mailing me.

Back