Package org.apache.struts2.locale
Interface LocaleProvider
- All Known Subinterfaces:
- ValidatorContext
- All Known Implementing Classes:
- ActionSupport,- CspReportAction,- DefaultActionSupport,- DefaultCspReportAction,- DefaultLocaleProvider,- DelegatingValidatorContext,- VisitorFieldValidator.AppendingValidatorContext
public interface LocaleProvider
Indicates that the implementing class can provide its own 
Locale.
 
 This is useful for when an action may wish override the default locale. All that is
 needed is to implement this interface and return your own custom locale.
 The TextProvider interface uses this interface
 heavily for retrieving internationalized messages from resource bundles.
- 
Method SummaryModifier and TypeMethodDescriptionGets the provided locale.booleanisValidLocale(Locale locale) Validates if providedLocaleis valuebooleanisValidLocaleString(String localeStr) Validates if provided string is a validLocaledefault LocaleTries to convert provided locale string intoLocaleor returns null
- 
Method Details- 
getLocaleLocale getLocale()Gets the provided locale.- Returns:
- the locale.
 
- 
isValidLocaleStringValidates if provided string is a validLocale- Parameters:
- localeStr- a String representing locale, e.g. en_EN
- Returns:
- true if valid
 
- 
isValidLocaleValidates if providedLocaleis value- Parameters:
- locale- instance of- Localeto validate
- Returns:
- true if valid
 
- 
toLocaleTries to convert provided locale string intoLocaleor returns null- Parameters:
- localeStr- a String representing locale, e.g.: en_EN
- Returns:
- instance of Localeor null
- Since:
- Struts 6.5.0
 
 
-