Setting 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 IBM® WebSphere® Portal Version 8.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 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 your WebSphere Portal Version 8.0 behave the same way as earlier portal versions.
<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 your portal for the change
to take effect.Example: Assume that 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".
You can write your own filters and apply your own locale fallback logic. WebSphere Portal uses the value of the Accept-Language header for further processing.
- If you remove a language from the portal, both filters rely on the locales that were defined last. For example, if you 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. Therefore, if your 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_root/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 you use servlet delivery instead of portlet delivery, then you need to edit web.xml under the directory location wp_profile_root/config/cells/node-name/applications/PA_WCM_Authoring_UI.ear/deployments/PA_WCM_Authoring_UI/ilwwcm-authoring.war/WEB-INF/.