My Oracle Support Banner

How to Allow User to Change the Language of WebCenter Custom Portal Application? (Doc ID 1367612.1)

Last updated on OCTOBER 10, 2023

Applies to:

Oracle WebCenter Portal - Version to [Release 11g]
Information in this document applies to any platform.


In WebCenter Custom Portal Application, in some cases, you may want to allow user to specify their preferred locale in the application rather than using the browser default locale so that the page can be displayed in the user preferred language.

By default, the locale is selected based on the HTTP request object and specified by the user in their browser settings. To allow users to specify their preferred locale in the application, this class must be used along with a ServletFilter to get the preferred locale, through LanguageSetting.getLocale(), and set it in the ADFContext.

This document is to walk through some of the major steps to implement the switch languages feature.

In this example, I will take the English and Chinese languages as an example.

Here are the high level steps:

1. Create the Portal Bundle to store the English labels and Chinese labels.
2. Create your own Navigation menu, and refer to the PortalBundle and specify the Title
3. Create a backing bean to handle the language switch.
4. Create a HttpServletRequestWrapper that wraps the client HTTP request and overwrite the Accept-Language HTTP header that sent by the browser.
5. Create your Servlet Filter.
6.  Register the Servlet Filter in web.xml
7. Add the adf commandLink to call the backing bean to switch the language.
8. Done, and run the application.

The is a sample code provided for your reference only.
The code provided within this Note it is not supported by Oracle Support and you may use it at your own risk.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.