org.apache.tapestry5.internal.services
Class LocalizationSetterImpl
java.lang.Object
org.apache.tapestry5.internal.services.LocalizationSetterImpl
- All Implemented Interfaces:
- LocalizationSetter
public class LocalizationSetterImpl
- extends Object
- implements LocalizationSetter
Given a set of supported locales, for a specified desired locale, sets the current thread's locale to a supported
locale that is closest to the desired.
|
Method Summary |
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). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocalizationSetterImpl
public LocalizationSetterImpl(Request request,
PersistentLocale persistentLocale,
ThreadLocale threadLocale,
@Inject@Symbol(value="tapestry.supported-locales")
String acceptedLocaleNames)
setLocaleFromLocaleName
public boolean setLocaleFromLocaleName(String localeName)
- Description copied from interface:
LocalizationSetter
- 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.
- Specified by:
setLocaleFromLocaleName in interface LocalizationSetter
- 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
setNonPeristentLocaleFromLocaleName
public void setNonPeristentLocaleFromLocaleName(String localeName)
- Description copied from interface:
LocalizationSetter
- 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.
- Specified by:
setNonPeristentLocaleFromLocaleName in interface LocalizationSetter
- Parameters:
localeName - locale in effect for this request
Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.