/** * @see FacesContextHelper#getLocale() */ public Locale getLocale() { Locale locale = null; // Try and get the current user's locale from Liferay, since they can override the locale with the Liferay // Language portlet. ThemeDisplay themeDisplay = getThemeDisplay(); if (themeDisplay != null) { locale = themeDisplay.getLocale(); } // If Liferay didn't return a locale, then try and get the locale from the JSF ViewRoot. if (locale == null) { locale = getViewRoot().getLocale(); } // If the JSF ViewRoot didn't return a locale, then try and get it from the JSF Application. if (locale == null) { locale = getApplication().getDefaultLocale(); } // Otherwise, if we couldn't determine the locale, just use the server's default value. if (locale == null) { locale = Locale.getDefault(); } return locale; }
/** * @see FacesContextHelper#getLocale() */ public Locale getLocale() { Locale locale = null; // Try and get the current user's locale from Liferay, since they can override the locale with the Liferay // Language portlet. ThemeDisplay themeDisplay = getThemeDisplay(); if (themeDisplay != null) { locale = themeDisplay.getLocale(); } // If Liferay didn't return a locale, then try and get the locale from the JSF ViewRoot. if (locale == null) { locale = getViewRoot().getLocale(); } // If the JSF ViewRoot didn't return a locale, then try and get it from the JSF Application. if (locale == null) { locale = getApplication().getDefaultLocale(); } // Otherwise, if we couldn't determine the locale, just use the server's default value. if (locale == null) { locale = Locale.getDefault(); } return locale; }