org.apache.tapestry5.services
Interface LocalizationSetter

All Known Implementing Classes:
LocalizationSetterImpl

public interface LocalizationSetter

Sets the thread's locale given a desired locale. Note that the desired locale is just a hint. It will try to honor it but there is no guarantee that it will be used as is.

Localization is controlled by the SymbolConstants.SUPPORTED_LOCALES symbol.


Method Summary
 List<Locale> getSupportedLocales()
          Returns a list of supported locales, as per the SymbolConstants.SUPPORTED_LOCALES symbol.
 SelectModel getSupportedLocalesModel()
          Returns the supported locales packaged as a model.
 boolean isSupportedLocaleName(String localeName)
          Checks to see if the indicated locale name is a supported locale name (that may have been incorporated into a request path).
 boolean setLocaleFromLocaleName(String localeName)
          Determines if the provided potential locale name (presumably, extracted from a request URL) is a supported locale name.
 void setNonPeristentLocaleFromLocaleName(String localeName)
          Allows the locale to be set from a specified locale name (which may be narrowed or defaulted to a support locale).
 Locale toLocale(String localeName)
          Converts a locale name into a Locale.
 

Method Detail

setLocaleFromLocaleName

boolean setLocaleFromLocaleName(String localeName)
Determines if the provided potential locale name (presumably, extracted from a request URL) is a supported locale name. A call to this method will always set the ThreadLocale (either to the provided locale, if supported, or to the default locale). If the locale name is supported, it will also set the PersistentLocale (which may affect how page and event links are generated, to persist the selected locale across requests).

Note that locale names are case sensitive.

Parameters:
localeName - name of locale to check (which may be blank or not a locale name)
Returns:
true if the locale name is supported and the PersistentLocale was set
Since:
5.1.0.0

setNonPeristentLocaleFromLocaleName

void setNonPeristentLocaleFromLocaleName(String localeName)
Allows the locale to be set from a specified locale name (which may be narrowed or defaulted to a support locale). Does not set the persistent locale.

Parameters:
localeName - locale in effect for this request
Since:
5.1.0.0

getSupportedLocales

List<Locale> getSupportedLocales()
Returns a list of supported locales, as per the SymbolConstants.SUPPORTED_LOCALES symbol.

Since:
5.2.0

isSupportedLocaleName

boolean isSupportedLocaleName(String localeName)
Checks to see if the indicated locale name is a supported locale name (that may have been incorporated into a request path). This is an important part of decoding a request.

Since:
5.2.0

getSupportedLocalesModel

SelectModel getSupportedLocalesModel()
Returns the supported locales packaged as a model. The label for each locale comes from Locale.getDisplayName(Locale) (in that locale).

Since:
5.2.0

toLocale

Locale toLocale(String localeName)
Converts a locale name into a Locale. The result is cached.

Since:
5.2.0


Copyright © 2003-2012 The Apache Software Foundation.