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:
- 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:
In this structure place localized versions of files that you want to import into a web application.
Pages differentiated by language_COUNTRY directory:
Note: The differentiator in the path names is the Language or Language_COUNTRY key.
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.
Add a Localized Resource builder call and specify the default value for the Language or Language_COUNTRY key input.
Profile-Enable the language and country code inputs (click the button) to the corresponding entries in the com.bowstreet.profiles.SimpleLocaleValues profile set.
Add an Imported Page builder call for each page of which you want to import a localized version and specify the path to the default non-localized page (e.g. specify /pages/myImportedPage.htm for a page translated to /pages/de/myImportedPage.htm )
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.
The Imported Page builder will automatically choose the page in the directory for the selected profile, based on the language and country codes supplied to the web application by the Localized Resource builder.
About localizing content
You can localize pages in your web application by using the Imported Page and Localized Resource builders.
Parent topic: Localizing applications
About setting the profile selection handler