Example usage for org.springframework.util StringUtils parseLocaleString

List of usage examples for org.springframework.util StringUtils parseLocaleString

Introduction

In this page you can find the example usage for org.springframework.util StringUtils parseLocaleString.

Prototype

@Nullable
public static Locale parseLocaleString(String localeString) 

Source Link

Document

Parse the given String representation into a Locale .

Usage

From source file:org.springframework.web.servlet.i18n.LocaleChangeInterceptor.java

/**
 * Parse the given locale value as coming from a request parameter.
 * <p>The default implementation calls {@link StringUtils#parseLocaleString(String)}
 * or JDK 7's {@link Locale#forLanguageTag(String)}, depending on the
 * {@link #setLanguageTagCompliant "languageTagCompliant"} configuration property.
 * @param locale the locale value to parse
 * @return the corresponding {@code Locale} instance
 * @since 4.3/*from ww  w  .jav a 2s  .  co m*/
 */
@Nullable
protected Locale parseLocaleValue(String locale) {
    return (isLanguageTagCompliant() ? Locale.forLanguageTag(locale) : StringUtils.parseLocaleString(locale));
}