Package org.apache.struts2.locale
Class DefaultLocaleProvider
java.lang.Object
org.apache.struts2.locale.DefaultLocaleProvider
- All Implemented Interfaces:
LocaleProvider
Default implementation of
LocaleProvider
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the provided locale.boolean
isValidLocale
(Locale locale) Validates if providedLocale
is valueboolean
isValidLocaleString
(String localeStr) Validates if provided string is a validLocale
Tries to convert provided locale string intoLocale
or returns null
-
Constructor Details
-
DefaultLocaleProvider
public DefaultLocaleProvider()
-
-
Method Details
-
getLocale
Description copied from interface:LocaleProvider
Gets the provided locale.- Specified by:
getLocale
in interfaceLocaleProvider
- Returns:
- the locale.
-
isValidLocaleString
Description copied from interface:LocaleProvider
Validates if provided string is a validLocale
- Specified by:
isValidLocaleString
in interfaceLocaleProvider
- Parameters:
localeStr
- a String representing locale, e.g. en_EN- Returns:
- true if valid
-
isValidLocale
Description copied from interface:LocaleProvider
Validates if providedLocale
is value- Specified by:
isValidLocale
in interfaceLocaleProvider
- Parameters:
locale
- instance ofLocale
to validate- Returns:
- true if valid
-
toLocale
Description copied from interface:LocaleProvider
Tries to convert provided locale string intoLocale
or returns null- Specified by:
toLocale
in interfaceLocaleProvider
- Parameters:
localeStr
- a String representing locale, e.g.: en_EN- Returns:
- instance of
Locale
or null
-