Set the language fallback filter

You 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 WebSphere Portal v7.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 locales that appear later in the list. In the example browser locale list of "ja-JP", "de", "ja" as given above, 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 WebSphere Portal v7.0 behave the same way as earlier portal versions.

You set this filter in the file web.xml under the directory location 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>

Restart the portal for the change to take effect.

For example, assume the browser sends the Accept-Language header "DE_de, en". This means that 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".

Users can write their own filters and apply their own locale fallback logic. WebSphere PortalPortal uses the value of the accept-language header for further processing. IBM Web Content Manager does not use portlets and can therefore not apply the filter that the portal uses for portlets. Therefore, if the portal installation includes Web Content Manager, you need to 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 above and restart the portal.

If you 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 tasks


Dynamically changing the language during the session


Support a new language
Change the character set for a language
Set the the language

 


+

Search Tips   |   Advanced Search