Version 4.10.0

Interface LocaleSource

All Known Implementing Classes:

public interface LocaleSource

Return the Locale associated with a given request.

See BuildImpl for important information on how this item is configured. BuildImpl.forLocaleSource() returns the configured implementation of this interface. See LocaleSourceImpl for a default implementation. This interface is similar to TimeZoneSource, and is used in much the same way.

In general, a Locale is used for two distinct operations :

Since almost all applications at least render data, then almost all applications will also use a Locale - even single-language applications.

In a single-language application, the returned Locale is used by WEB4J for rendering these items :

If the application is multilingual, then the returned Locale is also used for translating text. See Translator and related classes for more information.

A very large number of policies can be defined by implementations of this interface. Possible sources of Locale information include :

All WEB4J applications have at least one Locale - the DefaultLocale setting configured in web.xml. (This allows the application's Locale to be set explicitly, independent of the server's default Locale setting, or of browser header settings.) For applications which use only a single language, that Locale defines how WEB4J will format the items mentioned above. For multilingual applications, this web.xml setting is reinterpreted as the default Locale, which is overridden by implementations of this interface.

Method Summary
 Locale get(HttpServletRequest aRequest)
          Return a Locale corresponding to a given underlying request.

Method Detail


Locale get(HttpServletRequest aRequest)
Return a Locale corresponding to a given underlying request.

Version 4.10.0

Copyright Hirondelle Systems. Published October 19, 2013 - User Guide - All Docs.