Language support
Overview
Portal can serve portal views in a user's preferred language.
Some back-level versions of browsers used might have difficulty representing specific languages, depending on the defined character set. To fix, define the same preferred language for the browser and the portal it accesses.
WebSphere Portal has already been translated into a number of languages.
The names for directories containing language-dependent resources follow the ISO 639 naming convention.
Support a new language
To support a new language add resource bundles and JSPs. Some JSPs use resource bundles; others, such as help JSPs, are translated directly. To update the list of available languages we use...
xmlaccess CreateLanguage.xml
We can also xmlaccess to remove an existing language. The new language is then listed in the language selection menu boxex available in administration portlets, or for example, in Edit My Profile, Preferred language.
The new language will be available only to portlets that we add to the portal, if these portlets support the newly added language and if you make the required language files available. None of the WebSphere Portal user interface or messages will be translated to the new language.
Add resource bundles for a new language
Resource bundles are used to store text displayed in JSPs or text used in Java code. In WebSphere Portal, resource bundles are located in the JAR files wp.ui.jar and wp.theme.customizer.ext.jar in the nls directory inside the file.
The JAR file wp.ui.jar is located in:
PORTAL_HOME/ui/wp.ui/shared/app
The JAR file wp.theme.customizer.ext.jar is located in:
PORTAL_HOME/theme/wp.theme.customizer.ext/shared/app
To add new resource bundles for additional languages, place them in:
WP_PROFILE/PortalServer/config/nls
The naming convention for resource bundles is [bundle]_[language]_[country]_[variant].properties . The ISO standard ISO-639 is used for the language codes of most languages. For Hebrew the old language code iw is used. The ISO standard ISO-3166 is used for the country/region codes. WebSphere Portal supports the use of [variant], although resource bundles supplied with the portal do not use it.
If the portal configuration includes Lotus Collaborative Services, add a new CSRes_language.properties file for each additional language to the following directory:
WP_PROFILE/PortalServer/config/nls
WebSphere Portal uses properties files called by the Java class java.util.ResourceBundle to store text rendered in JSPs. The Java mechanism searches for the resource bundles in the following order:
- [bundle]_[language]_[country]_[variant].properties
- [bundle]_[language]_[country].properties
- [bundle]_[language].properties
- [bundle].properties
In WebSphere Portal, the default bundles [bundle].properties are in English.
It is requires that all WebSphere Portal defined languages have resource bundles defined as well for the themes to function correctly. IBM recommends that after a language is installed, the resource bundles located within wp.ui.jar and wp.theme.customizer.ext.jar are processed through the procedure outlined later in this topic.
To add a resource bundle, proceed with the following steps:
- Copy all existing resource bundles into WP_PROFILE/PortalServer/config/nls directory.
- Name it according to the naming convention for resource bundles using locale code for the language(s) installed.
- Translate the resource bundle files.
- Convert it into Unicode with the Native-to-ASCII converter native2ascii which comes as part of JDK. For more detail on native2ascii see the Java documentation native2ascii - Native-to-ASCII Converter.
- Restart Portal so that the new resource bundles can be recognized.
Add JSPs for a new language
Some JSPs containing mostly text, such as help JSPs, are translated directly which means that the text is contained in the JSP and not in a resource bundle. For JSPs that do not use resource bundles, you need to copy and translate an existing JSP and store it in the appropriate location.
The location of JSPs can be, for example, jsp/[mime-type]/[language]/[country]/[variant]/files.jsp. For instance, existing help JSPs are already translated in WebSphere Portal and placed in the relevant [language]and [country] subdirectories. When deciding where to store new JSPs, you need to consider how the portal locates a JSP for rendering its content.
The following is an example of the order in which directories are searched, where path1 is a user-defined path, ie5 is the markup version (here: Internet Explorer 5), and the locale is en_US:
- /html/path1/ie5/en_US/mytemplate.jsp
- /html/path1/ie5/en/mytemplate.jsp
- /html/path1/ie5/mytemplate.jsp
- /html/path1/en_US/mytemplate.jsp
- /html/path1/en/mytemplate.jsp
- /html/path1/mytemplate.jsp
- /html/en_US/mytemplate.jsp
- /html/en/mytemplate.jsp
- /html/mytemplate.jsp
- /mytemplate.jsp
This means that if the user language is not supported, the portal will choose the file in the locale independent location, which in the example is the English file.
National language support for People Finder fields
All fields of the People Finder portlet must have associated language strings defined in each language property file, PeopleFinderUI_language_code.properties. The field names are the names of the corresponding attributes in Member Manager.
For each People Finder field, three strings are required:
- One string for the field's name, which is the attribute name
- One string for the field's long name
- One string for the field's description as it appears in the tasks of People Finder configuration mode
Example:
displayName = Name displayName_Long = Preferred Name displayName_Desc = Display name
The resource key for each field refers to the appropriate language property file, /nls/PeopleFinderUI_language_code.properties. Foreign language translations of People Finder fields must be stored in the appropriate language property file.
Language properties files are in the following location on the WebSphere Portal server (nnnnnnn represents a random number generated by the installation process when the lwppeoplefinder.jar file is installed):
PortalServer_root/people/people.impl/peoplefinder/portlet/nnnnnnn.ear/lwp_peoplefinder_war.ear/lwp.peoplefinder.jsr168.war/WEB-INF/lib
- XML samples for creating or removing language definitions
You can modify these XML samples and use them to create or remove language definitions from the portal.
Parent: Language support
Related:
Set the language fallback filter
Related:
Dynamically changing the language during the session
Related reference:
Sample XML configuration files
XML samples for creating or removing language definitions
Related:
Change the character set for a language
Set the the languagenative2ascii - Native-to-ASCII Converter
XML samples for creating or removing language definitions
We can modify these XML samples and use them to create or remove language definitions from the portal.
The following XML sample shows how we use xmlaccess.sh to create Japanese language in the portal:
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="update" xsi:noNamespaceSchemaLocation="PortalConfig_8.0.0.xsd"> <portal action="locate"> <language action="update" domain="rel" locale="ja"> </language> </portal> </request>The following XML sample shows how we use xmlaccess.sh to remove Japanese language in the portal:<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="update" xsi:noNamespaceSchemaLocation="PortalConfig_8.0.0.xsd"> <portal action="locate"> <language action="delete" domain="rel" locale="ja"> </language> </portal> </request>
Parent: Support a new languageChange the character set for a language
The character set is stored in the database. This is the character set used for the response to the user. We can change the character set for a language.
To change the character set for a language, use the Supported Markups portlet. Proceed as follows:
For details about how to perform these tasks refer to the Supported Markups portlet help.
- Click Administration > Portal settings > Supported markups.
- Select the markup for which to change the character set.
- Click Edit selected markup.
- Click Set locale-specific settings.
- Select the language for which to make the change.
- Click Edit setting for selected language.
- Change the character set for the selected language in the selected markup.
- Click OK to save the changes, or click Cancel to return without saving.
- Again, on the panel with the list of languages and on the panel for editing the markup, click OK to save your changes, or click Cancel to return without saving.
For a portlet to be rendered correctly, the language of the portlet must be supported by the character set of the portal.
To help the user's browser to render content correctly, the used character set is written to the HTTP header of the response stream. The default encoding is UTF-8. If it set to another encoding, we can force the default encoding by setting the JVM parameter as follows default.client.encoding=UTF-8 .
Parent: Language support
Related:
Set the language fallback filter
Related:
Dynamically changing the language during the session
Related:
Support a new language
Set the the languageDynamically changing the language during the session
Allow users to change the language during their session.
If you want the users to be able to change the language during the session, use the following command provided by IBM WebSphere Portal:
<portal-navigation:url command="ChangeLanguage"> <portal-navigation:urlParam name="locale" value="language"/> </portal-navigation:url>...where... language is the two character code for the required language, such as en, de, or fr. For a list of the available languages and their two character codes refer to Language support.
For users to be able to dynamically change the language for the session, add a link to the portal theme with the following text and link reference:
- The text displayed with the link specifies the language to change to.
- The link reference calls the command described previously with the locale parameter corresponding to the specified language.
Users can then click this link to change to the language specified by the locale parameter with the command. To make more than one language available to users, you create a separate link for each language.
Example: To create links for English and German, add the lines shown in the following example to the banner area of the theme:
<!-- add these lines --> <a href="http://setgetweb.com/p/portal80/<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale" value="en"/></portal-navigation:url>">English</a> <a href="http://setgetweb.com/p/portal80/<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale" value="de"/></portal-navigation:url>">Deutsch</a> <%-- logout button --%>The banner area can be defined in different files, depending on the different themes. Themes in recent portal versions commonly define the banner area within the Default.jsp, whereas older themes can include a separate JSP, such as banner_toolbar.jsp. For more information about locating the files for the themes refer to the topic about the Location of theme resources.
- The changed setting applies only for the duration of the current session. When the user logs out and back in again, the portal applies the default language as determined by the steps described under Selecting and changing the language.
- The previous examples use the portal: prefix to designate JSP tags from the portal tag library in portal.tld. Your custom JSPs might use a different tag prefix. Refer to Tags used by the portal JSPs for more information.
- Important for every operating system: Touch the Default.jsp file after editing any JSP files and before any restart. This updates the timestamp on the file to the current time and will signal a recompile of Default.jsp to incorporate the edit changes from other JSP files. Enter:
touch Default.jspAn alternative is to edit (open and save) Default.jsp, which has the same effect as the touch command. After updating theme JSPs, you must restart WebSphere Portal unless JSP reloading is enabled.
Parent: Language support
Related:
Set the language fallback filter
Related reference:
Location of theme resources
Related:
Support a new language
Change the character set for a language
Set the the language
Tags used by the portal JSPsSelect the language
We can control the multiple language-specific settings within the portal.
Change the default portal language
After the installation we can change the default language of the portal. To do this, use the Global Settings portlet. Select Administration, Portal settings, Global Settings. From the pull down list, select the required default language for the portal. This can be, for example, en for English. For a list of languages supported by the portal refer to the topic about Language support.
The Global Settings portlet does not work in portal cluster configurations. For portal clusters set the portal default language in the portal Localizer service using the WAS admin console. For details about how to set the language refer to the topic about Setting service configuration properties.
Portlets
A portlet can support one or more locales. All portlets must have their own default language specified in the deployment descriptors. Otherwise the portlet cannot be installed.
Change titles for pages
We can edit titles for pages in the portlet for Managing Pages using the configure option for the locale specific settings. Select Administration, Portal User Interface, Manage pages. Click the Edit Page Properties icon, expand the Advanced options, and select the option for setting page titles and descriptions. We can enter a different title for each available language.
Language selection by the user
The user can select the preferred language for rendering portal content during the enrollment process. The user can select from a list of available languages. If required, the user can later change the selected language in the self care portlet by selecting Edit My Profile. The selection list shown to the user for choosing a language shows all available portal languages.
The user's language selection does not become effective until after the user has logged in.
Language determined by the portal
The portal determines the language for rendering the portal content by a search process along the following sequence at login time:
- The language encoded in the URL takes highest priority. The portal does not encode a locale into the URL by default. However, we can add code to the JSPs to support dynamic language selection. For details about this refer to Dynamically changing the language during the session.
- If the user has logged in, the portal displays in the preferred language selected and stored in the user repository by the user.
- If no preferred user language can be found, the portal looks for the language defined in the user's browser. If the portal supporto that language, it displays the content is that language. If the browser has more than one language defined, the portal uses the first language in the list to display the content.
- If no browser language can be found, for example if the browser used does not send a language or if the portal does not support the language set in the browser, the portal resorts to its own default language.
- If the user has a portlet that does not support the languagthat was determined by the previous stepso that portlet is shown in its own default language.
This sequence describes the language selection process that is applied for each user at logon time. For pages viewed by anonymous users only the last three steps for determining the language apply. This applies, for example, before login and after log off.
The language determined by this selection process is applied to the complete portal. If the portal or one component does not find the appropriate resources for the language as selected by this sequence, it tries to find the resources in a similar language.
For example, if the determined language was US English (en_US), the next closest option is English (en).
This search sequence applies to all portal components individually down to portlets.
For example, if a portlet does not support the language selected by the portal, it is shown in default language of the portlet. This way, the portal can show individual portlets in different languages.
If a page does not support any of the languages determined by the steps given in the preceding list, then the navigation displays the object ID of the page rather than the page title. Such an object ID can be, for example, 7_0_5T .
Parent: Language support
Related:
Set the language fallback filter
Related:
Dynamically changing the language during the session
Related:
Support a new language
Change the character set for a languageSet the language fallback filter
We can set the language fallback servlet filter to perform fallback for the entries in the browser locale list. This changes the way by which the portal determines the language for rendering portlets.
By default portal v8.0 recognizes whether a general language code is secondary or farther down in the browser priority list and ignores all regional variations that do not directly match a language defined by the portal.
For example, if the browser locale list specifies "ja-JP", "de", "ja", the portal ignores the entry "ja-JP" and falls back to the second entry of "de", as it recognizes that "ja-JP" does not have a match among the portal defined locales and that the more generic version "ja" of this locale is further down in the list behind "de". This behavior conforms to the HTTP specification.
If you turn the filter on, the portal performs a fallback for all entries and removes duplicates of the fallback localethat appear later in the list. In the example browser locale list of "ja-JP", "de", "ja" as given before, the portal recognizes that "ja-JP" does not match any of the portal defined locales, but performs a fallback to the portal defined locale "ja". It uses "ja" as the locale of choice and ignores the 3rd entry "ja" from the list. The resulting locale list used by the portal is "ja", "de". This bypasses strict adherence to the HTTP specification of accepting and displaying languages and uses the fallback option instead. This also makes the WebSphere Portal v8.0 behave the same way as earlier portal versions.
You set this filter in web.xml . This file is located in the directory WP_PROFILE/config/cells/node-name/applications/wps.ear/deployments/wps/wps.war/WEB-INF. By default the portal is set to use the extended locale filter as follows:
<filter> <filter-name>Locale Filter</filter-name> <filter-class>com.ibm.wps.engine.ExtendedLocaleFilter</filter-class> </filter>To switch to the language fallback servlet filter, replace the extended locale filter by the sorting locale filter as follows:<filter> <filter-name>Locale Filter</filter-name> <filter-class>com.ibm.wps.engine.SortingLocaleFilter</filter-class> </filter>After you set filters, restart the portal for the change to take effect.Example: Assumthat the browser sends the Accept-Language header "DE_de, en". The user prefers German as spoken in Germany as first priority, then English, but not German in general. In a portal scenario, this would result in serving resources in "en", even though "de" would be supported (but is not acceptable according to the header). Using the ExtendedLocaleFilter adds all fallback locales to the header, preserving the relative order of the original locales in the header. The result would be "DE_de, en, de", with the fallback to "de" appearing after "en" to match the user preference.
In contrast, com.ibm.wps.engine.SortingLocaleFilter gives fallbacks precedence over the original order of locales in the header. For "DE_de, en" the filter would generate "DE_de, de, en", giving all fallbacks for "DE_de" the same relative priority as "DE_de".
We can write our own filters and apply our own locale fallback logic. WebSphere Portal uses the value of the Accept-Language header for further processing.
- If we remove a language from the portal, both filters rely on the localethat were defined last.
For example, if we remove Japanese ( "ja-JP" , "ja" ) from the locales defined in the portal, then the browser locale list specifies "ja-JP,de,ja" . In this case the portal recognizes that "ja-JP" and "ja" do not have a match among the portal defined locales. Therefore it ignores these entries "ja-JP" and "ja". Instead it falls back to the second entry named "de" .
- IBM Web Content Manager does not use portlets and can therefore not apply the filter that the portal uses for portlets. If the portal installation includes Web Content Manager, set the filter in the Web Content Manager web.xml under the directory location WP_PROFILE/config/cells/node-name/applications/wcm.ear/deployments/wcm/ilwwcm.war/WEB-INF/. Replace the extended filter by the sorting locale filter as shown previously and restart the portal.
If we use servlet delivery instead of portlet delivery, then you need to edit web.xml under the directory location...
WP_PROFILE/config/cells/node-name/applications/PA_WCM_Authoring_UI.ear/deployments/PA_WCM_Authoring_UI/ilwwcm-authoring.war/WEB-INF/
Parent: AdministeringLanguage support
To reach as many users as possible, WebSphere Portal supports different languages for different locations. For instance, a large, international corporation might address users in different countries or regions through multilingual Web sites. In this context the portal can concurrently serve portal views to large numbers of users, each in the user's preferred language.
If necessary, the portal can support portlets that are shown in different languages. If portlets do not support a requested language, the portal tries to match the user's language preference as well as possible.
For example, if a page for a Japanese user shows several portlets in Japanese and a portlet is added that only supports English, then the page shows the new portlet in English but still shows the other portlets in Japanese.
Some back-level versions of browsers and browserthat are not commonly used might have difficulty representing specific languages, depending on the defined character set. In these cases, in order for the language to be rendered correctly, it might be necessary to define the same preferred language for the browser and the portal it accesses.
WebSphere Portal has already been translated into a number of languages.
WebSphere Portal uses the ISO 639 Codes for the Representation of Names of Languages to represent localized resources. The names for directories containing language-dependent resources follow the ISO 639 naming convention (see Directories for languages).
This section has the following topics:
- Support a new language
To support a new language to IBM WebSphere Portal we add resource bundles and, where applicable, JSPs for the new language.- Change the character set for a language
The character set is stored in the database. This is the character set used for the response to the user. We can change the character set for a language.- Dynamically changing the language during the session
Allow users to change the language during their session.- Set the the language
We can control the multiple language-specific settings within the portal.- Set the language fallback filter
We can set the language fallback servlet filter to perform fallback for the entries in the browser locale list. This changes the way by which the portal determines the language for rendering portlets.
Parent: Administering
Related reference:
Directory structureSupport a new language
To support a new language to IBM WebSphere Portal we add resource bundles and, where applicable, JSPs for the new language.
Some JSPs use resource bundles; others, such as help JSPs, are translated directly. Then you update the list of available languages by adding the new language to the portal. You do this using xmlaccess.sh. Use the example XML script CreateLanguage.xml to add the new language for the portal. We can also use it to remove an existing language from the portal. The new language is then listed in the language selection menu boxeavailable in administration portlets, or for example, in Edit My Profile, Preferred language.
The new language will be available only to portlets that we add to the portal, if these portlets support the newly added language and if you make the required language files available. None of the WebSphere Portal user interface or messages will be translated to the new language.
Add resource bundles for a new language
Resource bundles are used to store text displayed in JSPs or text used in Java code. In WebSphere Portal, resource bundles are located in the JAR files wp.ui.jar and wp.theme.customizer.ext.jar in the nls directory inside the file.
The JAR file wp.ui.jar is located in:
PORTAL_HOME/ui/wp.ui/shared/app
The JAR file wp.theme.customizer.ext.jar is located in:
PORTAL_HOME/theme/wp.theme.customizer.ext/shared/app
- z/OS: PORTAL_HOME/theme/wp.theme.customizer.ext/shared/app
To add new resource bundles for additional languages, place them in:
WP_PROFILE/PortalServer/config/nls
- z/OS: WP_PROFILE/PortalServer/config/nls
The naming convention for resource bundles is [bundle]_[language]_[country]_[variant].properties . The ISO standard ISO-639 is used for the language codes of most languages. For Hebrew the old language code iw is used. The ISO standard ISO-3166 is used for the country/region codes. WebSphere Portal supports the use of [variant], although resource bundles supplied with the portal do not use it.
If the portal configuration includes Lotus Collaborative Services, add a new CSRes_language.properties file for each additional language to the following directory:
WP_PROFILE/PortalServer/config/nls
- z/OS: WP_PROFILE/PortalServer/config/nls
WebSphere Portal uses properties files called by the Java class java.util.ResourceBundle to store text rendered in JSPs. The Java mechanism searches for the resource bundles in the following order:
- [bundle]_[language]_[country]_[variant].properties
- [bundle]_[language]_[country].properties
- [bundle]_[language].properties
- [bundle].properties
In WebSphere Portal, the default bundles [bundle].properties are in English.
It is requires that all WebSphere Portal defined languages have resource bundles defined as well for the themes to function correctly. IBM recommends that after a language is installed, the resource bundles located within wp.ui.jar and wp.theme.customizer.ext.jar are processed through the procedure outlined later in this topic.
To add a resource bundle, proceed with the following steps:
- Copy all existing resource bundles into WP_PROFILE/PortalServer/config/nls directory.
- Name it according to the naming convention for resource bundles using locale code for the language(s) installed.
- Translate the resource bundle files.
- Convert it into Unicode with the Native-to-ASCII converter native2ascii which comes as part of JDK. For more detail on native2ascii see the Java documentation native2ascii - Native-to-ASCII Converter.
- Restart Portal so that the new resource bundles can be recognized.
Add JSPs for a new language
Some JSPs containing mostly text, such as help JSPs, are translated directly which means that the text is contained in the JSP and not in a resource bundle. For JSPs that do not use resource bundles, you need to copy and translate an existing JSP and store it in the appropriate location.
The location of JSPs can be, for example, jsp/[mime-type]/[language]/[country]/[variant]/files.jsp. For instance, existing help JSPs are already translated in WebSphere Portal and placed in the relevant [language]and [country] subdirectories. When deciding where to store new JSPs, you need to consider how the portal locates a JSP for rendering its content.
The following is an example of the order in which directories are searched, where path1 is a user-defined path, ie5 is the markup version (here: Internet Explorer 5), and the locale is en_US:
- /html/path1/ie5/en_US/mytemplate.jsp
- /html/path1/ie5/en/mytemplate.jsp
- /html/path1/ie5/mytemplate.jsp
- /html/path1/en_US/mytemplate.jsp
- /html/path1/en/mytemplate.jsp
- /html/path1/mytemplate.jsp
- /html/en_US/mytemplate.jsp
- /html/en/mytemplate.jsp
- /html/mytemplate.jsp
- /mytemplate.jsp
This means that if the user language is not supported, the portal will choose the file in the locale independent location, which in the example is the English file.
National language support for People Finder fields
All fields of the People Finder portlet must have associated language strings defined in each language property file, PeopleFinderUI_language_code.properties. The field names are the names of the corresponding attributes in Member Manager.
For each People Finder field, three strings are required:
- One string for the field's name, which is the attribute name
- One string for the field's long name
- One string for the field's description as it appears in the tasks of People Finder configuration mode
Example:
displayName = Name displayName_Long = Preferred Name displayName_Desc = Display name
The resource key for each field refers to the appropriate language property file, /nls/PeopleFinderUI_language_code.properties. Foreign language translations of People Finder fields must be stored in the appropriate language property file.
Language properties files are in the following location on the WebSphere Portal server (nnnnnnn represents a random number generated by the installation process when the lwppeoplefinder.jar file is installed):
PortalServer_root/people/people.impl/peoplefinder/portlet/nnnnnnn.ear/lwp_peoplefinder_war.ear/lwp.peoplefinder.jsr168.war/WEB-INF/lib
- XML samples for creating or removing language definitions
You can modify these XML samples and use them to create or remove language definitions from the portal.
Parent: Language support
Related:
Set the language fallback filter
Related:
Dynamically changing the language during the session
Related reference:
Sample XML configuration files
XML samples for creating or removing language definitions
Related:
Change the character set for a language
Set the the languagenative2ascii - Native-to-ASCII Converter
XML samples for creating or removing language definitions
We can modify these XML samples and use them to create or remove language definitions from the portal.
The following XML sample shows how we use xmlaccess.sh to create Japanese language in the portal:
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="update" xsi:noNamespaceSchemaLocation="PortalConfig_8.0.0.xsd"> <portal action="locate"> <language action="update" domain="rel" locale="ja"> </language> </portal> </request>The following XML sample shows how we use xmlaccess.sh to remove Japanese language in the portal:<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="update" xsi:noNamespaceSchemaLocation="PortalConfig_8.0.0.xsd"> <portal action="locate"> <language action="delete" domain="rel" locale="ja"> </language> </portal> </request>
Parent: Support a new languageChange the character set for a language
The character set is stored in the database. This is the character set used for the response to the user. We can change the character set for a language.
To change the character set for a language, use the Supported Markups portlet. Proceed as follows:
For details about how to perform these tasks refer to the Supported Markups portlet help.
- Click Administration > Portal settings > Supported markups.
- Select the markup for which to change the character set.
- Click Edit selected markup.
- Click Set locale-specific settings.
- Select the language for which to make the change.
- Click Edit setting for selected language.
- Change the character set for the selected language in the selected markup.
- Click OK to save the changes, or click Cancel to return without saving.
- Again, on the panel with the list of languages and on the panel for editing the markup, click OK to save your changes, or click Cancel to return without saving.
For a portlet to be rendered correctly, the language of the portlet must be supported by the character set of the portal.
To help the user's browser to render content correctly, the used character set is written to the HTTP header of the response stream. The default encoding is UTF-8. If it set to another encoding, we can force the default encoding by setting the JVM parameter as follows default.client.encoding=UTF-8 .
Parent: Language support
Related:
Set the language fallback filter
Related:
Dynamically changing the language during the session
Related:
Support a new language
Set the the languageDynamically changing the language during the session
Allow users to change the language during their session.
If you want the users to be able to change the language during the session, use the following command provided by IBM WebSphere Portal:
<portal-navigation:url command="ChangeLanguage"> <portal-navigation:urlParam name="locale" value="language"/> </portal-navigation:url>...where... language is the two character code for the required language, such as en, de, or fr. For a list of the available languages and their two character codes refer to Language support.
For users to be able to dynamically change the language for the session, add a link to the portal theme with the following text and link reference:
- The text displayed with the link specifies the language to change to.
- The link reference calls the command described previously with the locale parameter corresponding to the specified language.
Users can then click this link to change to the language specified by the locale parameter with the command. To make more than one language available to users, you create a separate link for each language.
Example: To create links for English and German, add the lines shown in the following example to the banner area of the theme:
<!-- add these lines --> <a href="http://setgetweb.com/p/portal80/<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale" value="en"/></portal-navigation:url>">English</a> <a href="http://setgetweb.com/p/portal80/<portal-navigation:url command="ChangeLanguage"><portal-navigation:urlParam name="locale" value="de"/></portal-navigation:url>">Deutsch</a> <%-- logout button --%>The banner area can be defined in different files, depending on the different themes. Themes in recent portal versions commonly define the banner area within the Default.jsp, whereas older themes can include a separate JSP, such as banner_toolbar.jsp. For more information about locating the files for the themes refer to the topic about the Location of theme resources.
- The changed setting applies only for the duration of the current session. When the user logs out and back in again, the portal applies the default language as determined by the steps described under Selecting and changing the language.
- The previous examples use the portal: prefix to designate JSP tags from the portal tag library in portal.tld. Your custom JSPs might use a different tag prefix. Refer to Tags used by the portal JSPs for more information.
- Important for every operating system: Touch the Default.jsp file after editing any JSP files and before any restart. This updates the timestamp on the file to the current time and will signal a recompile of Default.jsp to incorporate the edit changes from other JSP files. Enter:
touch Default.jspAn alternative is to edit (open and save) Default.jsp, which has the same effect as the touch command. After updating theme JSPs, you must restart WebSphere Portal unless JSP reloading is enabled.
Parent: Language support
Related:
Set the language fallback filter
Related reference:
Location of theme resources
Related:
Support a new language
Change the character set for a language
Set the the language
Tags used by the portal JSPsSelect the language
We can control the multiple language-specific settings within the portal.
Change the default portal language
After the installation we can change the default language of the portal. To do this, use the Global Settings portlet. Select Administration, Portal settings, Global Settings. From the pull down list, select the required default language for the portal. This can be, for example, en for English. For a list of languages supported by the portal refer to the topic about Language support.
The Global Settings portlet does not work in portal cluster configurations. For portal clusters set the portal default language in the portal Localizer service using the WAS admin console. For details about how to set the language refer to the topic about Setting service configuration properties.
Portlets
A portlet can support one or more locales. All portlets must have their own default language specified in the deployment descriptors. Otherwise the portlet cannot be installed.
Change titles for pages
We can edit titles for pages in the portlet for Managing Pages using the configure option for the locale specific settings. Select Administration, Portal User Interface, Manage pages. Click the Edit Page Properties icon, expand the Advanced options, and select the option for setting page titles and descriptions. We can enter a different title for each available language.
Language selection by the user
The user can select the preferred language for rendering portal content during the enrollment process. The user can select from a list of available languages. If required, the user can later change the selected language in the self care portlet by selecting Edit My Profile. The selection list shown to the user for choosing a language shows all available portal languages.
The user's language selection does not become effective until after the user has logged in.
Language determined by the portal
The portal determines the language for rendering the portal content by a search process along the following sequence at login time:
- The language encoded in the URL takes highest priority. The portal does not encode a locale into the URL by default. However, we can add code to the JSPs to support dynamic language selection. For details about this refer to Dynamically changing the language during the session.
- If the user has logged in, the portal displays in the preferred language selected and stored in the user repository by the user.
- If no preferred user language can be found, the portal looks for the language defined in the user's browser. If the portal supporto that language, it displays the content is that language. If the browser has more than one language defined, the portal uses the first language in the list to display the content.
- If no browser language can be found, for example if the browser used does not send a language or if the portal does not support the language set in the browser, the portal resorts to its own default language.
- If the user has a portlet that does not support the languagthat was determined by the previous stepso that portlet is shown in its own default language.
This sequence describes the language selection process that is applied for each user at logon time. For pages viewed by anonymous users only the last three steps for determining the language apply. This applies, for example, before login and after log off.
The language determined by this selection process is applied to the complete portal. If the portal or one component does not find the appropriate resources for the language as selected by this sequence, it tries to find the resources in a similar language.
For example, if the determined language was US English (en_US), the next closest option is English (en).
This search sequence applies to all portal components individually down to portlets.
For example, if a portlet does not support the language selected by the portal, it is shown in default language of the portlet. This way, the portal can show individual portlets in different languages.
If a page does not support any of the languages determined by the steps given in the preceding list, then the navigation displays the object ID of the page rather than the page title. Such an object ID can be, for example, 7_0_5T .
Parent: Language support
Related:
Set the language fallback filter
Related:
Dynamically changing the language during the session
Related:
Support a new language
Change the character set for a languageSet the language fallback filter
We can set the language fallback servlet filter to perform fallback for the entries in the browser locale list. This changes the way by which the portal determines the language for rendering portlets.
By default portal v8.0 recognizes whether a general language code is secondary or farther down in the browser priority list and ignores all regional variations that do not directly match a language defined by the portal.
For example, if the browser locale list specifies "ja-JP", "de", "ja", the portal ignores the entry "ja-JP" and falls back to the second entry of "de", as it recognizes that "ja-JP" does not have a match among the portal defined locales and that the more generic version "ja" of this locale is further down in the list behind "de". This behavior conforms to the HTTP specification.
If you turn the filter on, the portal performs a fallback for all entries and removes duplicates of the fallback localethat appear later in the list. In the example browser locale list of "ja-JP", "de", "ja" as given before, the portal recognizes that "ja-JP" does not match any of the portal defined locales, but performs a fallback to the portal defined locale "ja". It uses "ja" as the locale of choice and ignores the 3rd entry "ja" from the list. The resulting locale list used by the portal is "ja", "de". This bypasses strict adherence to the HTTP specification of accepting and displaying languages and uses the fallback option instead. This also makes the WebSphere Portal v8.0 behave the same way as earlier portal versions.
You set this filter in web.xml . This file is located in the directory WP_PROFILE/config/cells/node-name/applications/wps.ear/deployments/wps/wps.war/WEB-INF. By default the portal is set to use the extended locale filter as follows:
<filter> <filter-name>Locale Filter</filter-name> <filter-class>com.ibm.wps.engine.ExtendedLocaleFilter</filter-class> </filter>To switch to the language fallback servlet filter, replace the extended locale filter by the sorting locale filter as follows:<filter> <filter-name>Locale Filter</filter-name> <filter-class>com.ibm.wps.engine.SortingLocaleFilter</filter-class> </filter>After you set filters, restart the portal for the change to take effect.Example: Assumthat the browser sends the Accept-Language header "DE_de, en". The user prefers German as spoken in Germany as first priority, then English, but not German in general. In a portal scenario, this would result in serving resources in "en", even though "de" would be supported (but is not acceptable according to the header). Using the ExtendedLocaleFilter adds all fallback locales to the header, preserving the relative order of the original locales in the header. The result would be "DE_de, en, de", with the fallback to "de" appearing after "en" to match the user preference.
In contrast, com.ibm.wps.engine.SortingLocaleFilter gives fallbacks precedence over the original order of locales in the header. For "DE_de, en" the filter would generate "DE_de, de, en", giving all fallbacks for "DE_de" the same relative priority as "DE_de".
We can write our own filters and apply our own locale fallback logic. WebSphere Portal uses the value of the Accept-Language header for further processing.
- If we remove a language from the portal, both filters rely on the localethat were defined last.
For example, if we remove Japanese ( "ja-JP" , "ja" ) from the locales defined in the portal, then the browser locale list specifies "ja-JP,de,ja" . In this case the portal recognizes that "ja-JP" and "ja" do not have a match among the portal defined locales. Therefore it ignores these entries "ja-JP" and "ja". Instead it falls back to the second entry named "de" .
- IBM Web Content Manager does not use portlets and can therefore not apply the filter that the portal uses for portlets. If the portal installation includes Web Content Manager, set the filter in the Web Content Manager web.xml under the directory location WP_PROFILE/config/cells/node-name/applications/wcm.ear/deployments/wcm/ilwwcm.war/WEB-INF/. Replace the extended filter by the sorting locale filter as shown previously and restart the portal.
If we use servlet delivery instead of portlet delivery, then you need to edit web.xml under the directory location WP_PROFILE/config/cells/node-name/applications/PA_WCM_Authoring_UI.ear/deployments/PA_WCM_Authoring_UI/ilwwcm-authoring.war/WEB-INF/.
Parent: Language support
Related:
Dynamically changing the language during the session
Related reference:
XML samples for creating or removing language definitions
Related:
Support a new language
Change the character set for a language
Set the the language