These are the basic steps to test the sample and return
a response in German using servlet list filtering:
Step 1: Set up your browser to
request that responses be in German.
Step 2: Install the necessary
Machine Translation modules.
Step 3: Configure MTFilter as
a WAS servlet.
Step 4: Set up servlet list
filtering to allow the simpleJSP servlet output to be processed
through the MTFilter servlet.
Step 5: Run the
sample to demonstrate automatic translation.
Once you have completed steps 1 through 3, you can use servlet list
filtering (described in Step 4) to automatically translate the output
of other servlets.
Once you have MTFilter installed (step 3), you can also use it to
automatically translate pages by MIME type.
Note: The instructions assume that you did a custom install,
creating the Application Server named "Default Server" which
contains the Web Application named "example." The "example"
Web application contains a number of servlets (including simpleJSP)
that will be used to show automatic translation. The actual files
associated with "example" are in the <was_root>/hosts/default_host/examples
directory.
|
Step 1: Set up your browser to request that responses be in German
In this step, you make a temporary change to your browser settings.
Be sure to change it back after you run the sample.
For Netscape:
- From the Edit menu, select Preferences.
- Open the Navigator tree and click Languages.
- Add German to the list and make it the first item
on the list.
For Microsoft Internet Explorer:
- From the View menu, select Internet Options.
- On the General tab, click Languages.
- Add German to the list and make it the first item
on the list.
This will let the HTTP server (and the WebSphere Application Server)
know that your browser prefers a German response if possible.
Step 2: Install the necessary Machine Translation modules
The Machine Translation modules that you need are included with the
IBM HTTP Server. If you did not install the IBM HTTP Server when you
installed WebSphere Application Server, do not worry. You can install
these modules without installing the rest of the HTTP server, and
you can install them at any time. The Machine Translation modules
are used by WebSphere Application Server and will not conflict with
any other HTTP server you are using.
- Insert the IBM HTTP Server CD-ROM.
- When prompted to specify the components to install,
select only Machine Translation. Leave the remaining components
unselected.
- Be sure to select the MT module, but deselect
the MT Server.
- Select the specific language dictionaries you
want. Currently, German, simplified Chinese, and Traditional Chinese
are available. To run this sample you must select German. Install
the other languages if you wish.
- Follow the instructions to complete the installation.
When you complete the install, you will have the directory <ihs_root>/Mt
which will contain other directories with Java class files, language
dictionaries, and machine translation executables.
Step 3: Configure MTFilter as a WAS servlet.
In this step, you perform some configuration to make the servlet
available for servlet list filtering and MIME-based filtering.
- Locate the MTFilter Java source and class files
in the <was_root>/hosts/default_host/examples/Mt directory.
This is where MTFilter.java and MTFilter.class are located.
- Add the MTFilter Java class file to the Default
Server classpath:
- Start the Console GUI
- On Topology tab, expand the tree and select Default Server.
- On the General tab (right side of the Console), add the following
as a Command line arguments property:
-classpath <was_root>/hosts/default_host/examples/Mt
This will add the MTFilter Java class file to the current
Default Server classpath. Be sure to replace <was_root>
with the proper directory structure for your installation, and
use "/" or "\" as appropriate for your file
separator.
- In a similar fashion, add the machine translation
Java classes to the Default Server classpath:
- Start the Console GUI
- On Topology tab, expand the tree and select Default Server.
- On the General tab (right side of the Console), add the following
to the classpath in the Command line arguments property:
<ihs_root>/Mt
- The classpath should now look like (all on one line);
-classpath <was_root>/hosts/default_host/examples/Mt:<ihs_root>/Mt
This will add the Machine Translation Java classes to
the current Default Server classpath. Be sure to use "/"
or "\" as appropriate for your file separator, and
the appropriate path separator (; or :).
- Add the machine translation executables to your
system PATH:
- Add <ihs_root>/Mt to your system PATH environmental
variable, with the considerations noted in the previous steps
about <ihs_root> and the "/" or "\" file separators.
- Perform any additional steps needed on your operating system
to make the PATH change available to your system.
- Open a "Create Servlet" window:
- In your Console, expand the Default Server tree.
- Expand the servletEngine tree.
- Right-click the examples Web Application.
- Select create, and then servlet, opening the "Create Servlet"
window.
- On the General tab of the "Create Servlet" window,
enter the following values:
Servlet Name: MTFilter (this value will be used for the
sample)
Web Application: examples
Description: MTFilter (or any description you prefer)
Servlet Class Name: MTFilter (necessary to point to MTFilter.class)
- Specify the Web Path List:
- Click Add on the "Create Servlet" window, opening the "Add
Web Path to Servlet" window.
- Enter /webapp/examples/MTFilter
Note: You must use "/" in your entry, regardless of
your operating system.
- Click OK.
- Specify initialization parameters:
- Back in the "Create Servlet" window, select the Advanced tab.
- Enter the following:
Init Parm Name: mtPath
Init Parm Value: <ihs_root>/Mt
(As in earlier steps, enter <ihs_root>/Mt following the
requirements for your system.)
- Optionally, you can specify an additional parameter
to force translation to a specific language, regardless of the settings
on the user's browser. In step 1, you changed your browser language
to German so this current step is not necessary. But, to force German
translation, you would enter:
- Init Parm Name: useLang
- Init Parm Value: de
- In the "Create Servlet" window, click Create to
complete the configuration.
The MTFilter servlet is now added to your examples Web Application.
You can use this servlet for servlet list filtering or MIME-based
filtering.
Note: MTFilter.class can support translation to the following
languages as their dictionaries become available:
- "cn" Simplified Chinese
- "da" Danish
- "de" German
- "es" Spanish
- "fr" French
- "it" Italian
- "jp" Japanese
- "kr" Korean
- "nl" Dutch
- "pl" Portuguese
- "ru" Russian
- "tw" Traditional Chinese
Step 4: Set up servlet list filtering
In this step, you will create a new servlet to run the output of
the simpleJSP servlet through the MTFilter servlet. (The simpleJSP
servlet is found in the examples Web Application.)
- Open a "Create Servlet" window:
- In your Console, expand the Default Server tree.
- Expand the servletEngine tree.
- Right-click examples.
- Select create, and then servlet.
- On the General tab of the "Create Servlet"
window, enter the following values:
Servlet Name: simpleJSPmt (this value will be used for
the sample)
Web Application: examples
Description: simpleJSP through MT (or any description you
prefer)
Servlet Class Name: com.ibm.websphere.servlet.filter.ChainerServlet
(this is a servlet that will allow us to link our simpleJSP and
MTFilter servlets together)
- Specify the Web Path List:
- Click Add.
- Enter /webapp/examples/simpleJSPmt
Note: You must use "/" in your entry, regardless of
your operating system.
- Click OK.
- Specify initialization parameters:
- In the "Create Servlet" window, select the Advanced tab.
- Enter the following:
Init Parm Name: chainer.pathlist
Init Parm Value: /simpleJSP /MTFilter (Note: you must
have a space between "/simpleJSP" and "/MTFilter"
and, as before, you must use "/" in your entry, regardless
of your operating system.)
- In the "Create Servlet" window, click Create to
complete the configuration.
The simpleJSPmt servlet is now added to your examples Web Application
and is ready to run.
Step 5: Run the sample
Use your browser (the one that you set to German) to request the
simpleJSPmt servlet:
- Start the Default Server, or stop it and restart
if it was already running.
- Enter: http://yourserver/webapp/examples/simpleJSPmt
in the browser's URL field.
When you press Enter, the English version of the response is translated
and returned to you in German.
To see this same request returned in English:
- Completely remove German from your browser language
list and make English your browser default.
- Enter: http://yourserver/webapp/examples/simpleJSPmt
in the browser's URL field.
When you press Enter, the English version of the response is NOT
translated and returned to you in English.
This demonstrates that one servlet can return responses in different
languages. (To run this test, make sure that MIME-based
filtering is not enabled for your examples Web Application.)
|