Portlet Factory, Version 6.1.2
Import localized pages into my application
You can import pages according to the locale of a user by using a Localized Resource builder call in conjunction with the Imported Page builder call. The URL to the pages consists of the following items:
- Localized Base URL – From the Imported Page builder.
- Language or Language_COUNTRY identifier – From the Localized Resource builder.
- Page to Import value – From the Imported Page builder.
IBM® WebSphere Portlet Factory automatically combines these three elements to access localized pages and content. To import pages based on the user's locale into the web application:
- Create the directory structure illustrated below.
Pages differentiated by language-only directory:
- /pages/sp/index.htm
- /pages/ru/index.htm
- /pages/ja/index.htm
Pages differentiated by language_COUNTRY directory:
- /pages/ru_RU/imported.htm
- /pages/ja_JA/imported.htm
- /pages/sp_SP/imported.htm
Note: The differentiator in the path names is the Language or Language_COUNTRY key.
- In this structure place localized versions of files that you want to import into a web application. Keep in mind that the directory structure or file names should be differentiated by the possible values of the Language or Language_COUNTRY in the Localized Resource builder call. The Imported Page builder will insert the value of the Language or Language_COUNTRY between the Localized Base URL and the Page to Import values to build the URL to the page to import.
- Add Localized Resource builder call and specify the default value for the Language or Language_COUNTRY key input.
- Profile-Enable this input (click the
button) and create a profile set (or use the default).
- Create a profile for each Language or Language_COUNTRY.
- Specify a value for the Language or Language_COUNTRY entry.
This locale will be used to determine the path to an imported page.
For example, for the directory and file names used in the example in Step 1, you can create a profile set called "Language" and create three profiles named "Spanish", "Russian", and "Japanese", with a value for the Language entry being "sp", "ru", and "ja", respectively.
- Add an Imported Page builder call for each page of which you want to import a localized version.
The Imported Page builder will automatically choose the page in the directory for the selected profile, based on the Localized Resource builder.
Parent topic: About localizing content
Library | Support |