Friday, June 6, 2014

Get the ResourceBundle handle based on the current Locale in ADF

import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
import javax.faces.component.UIViewRoot;
import java.util.Locale;

private static ResourceBundle getBundle() {
    FacesContext ctx = getFacesContext();
    UIViewRoot uiRoot = ctx.getViewRoot();
    Locale locale = uiRoot.getLocale();
    ClassLoader ldr = Thread.currentThread().getContextClassLoader();
    return ResourceBundle.getBundle(ctx.getApplication().getMessageBundle(), locale, ldr);
}

No comments:

Post a Comment