public static Locale resolveLocale(FacesContext context, Object locale, String clientId) {
        Locale result = null;

        if (locale != null) {
            if (locale instanceof String) {
                result = toLocale((String) locale);
            }
            else if (locale instanceof java.util.Locale) {
                result = (java.util.Locale) locale;
            }
            else {
                throw new IllegalArgumentException("Type:" + locale.getClass() + " is not a valid locale type for: " + clientId);
            }
        }
        else {
            // default to the view local
            result = context.getViewRoot().getLocale();
        }

        return result;
    }
Gets a {@link Locale} instance by the value of the component attribute "locale" which can be String or {@link Locale} or null.
<p>
If NULL is passed the view root default locale is used.

@param context the {@link FacesContext}
@param locale given locale
@param clientId the component clientId
@return resolved Locale
primefaces/src/main/java/org/primefaces/util/LocaleUtils.java