Thursday, June 20, 2013

How to Get the Client Locale in ADF Application

How to Get the Client Locale in ADF Application

/**
* Get the client Locale
**/
  public static Locale getLocale()
  {
    FacesContext ctx = FacesContext.getCurrentInstance();
    UIViewRoot uiRoot = ctx.getViewRoot();
    Locale locale = null;
    if (uiRoot != null)
    {
      locale = uiRoot.getLocale();
    }
    else
    {
      locale = FacesContext.getCurentInstance().getExternalContext().getRequestLocale();
    }
    return locale;
  }

No comments:

Post a Comment