Comments on: Supporting multiple languages in ADF applications backed by resource bundles – and programmatically controlling the JSF locale Friends of Oracle and Java Thu, 23 Apr 2015 12:54:46 +0000 hourly 1 By: Yves Tue, 04 Nov 2014 13:26:40 +0000 Dear Lucas,

thank you for this great Post about Internationalization through Database.

We used it in Jdeveloper 12c / ADF 12 c and had one Issue with it when using task-flows as regions:

We extended the ViewHandler (javax.faces.application.ViewHandler) and configured it in faces-config.xml as described in your tutorial.

Then, when we used any task-flow as a region in a page (fragment). The region didn’t show up, the space was just blank. Removing the ViewHandler configuration from faces-config.xml brought the region back.

The solution was

Step 1 of 2) instead of extending the javax.faces.application.ViewHandler we extended from the javax.faces.application.ViewHandlerWrapper:

import java.util.Locale;

import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;

import javax.faces.application.ViewHandler;
import javax.faces.application.ViewHandlerWrapper;
import javax.faces.context.FacesContext;

public class LocaleSettingViewHandlerWr extends ViewHandlerWrapper {

private final ViewHandler base;
private final String LANGUAGE_EL_EXPRESSEION = “#{localeManager.currentLocale}”;

public LocaleSettingViewHandlerWr(ViewHandler base) {
this.base = base;

public Locale calculateLocale(FacesContext facesContext) {
String language = (String) evaluateEL(LANGUAGE_EL_EXPRESSEION);

if(language == null){
return base.calculateLocale(facesContext);

return new Locale(language);

public ViewHandler getWrapped() {

return base;


public static Object evaluateEL(String el){
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
ValueExpression exp = expressionFactory.createValueExpression(elContext, el, Object.class);
return exp.getValue(elContext);

This ViewHandler has to be configured in faces-config.xml as in your tutorial. !!!!!!

Step 2 of 2) Also set this ViewHandler as ALTERNATE_VIEW_HANDLER in web.xml
Add the following lines to the web.xml file in the right section (somewhere amongst other context params)



Kind regards

Yves Tiesler