| java.lang.Object org.apache.turbine.services.localization.LocalizationTool
LocalizationTool | public class LocalizationTool implements ApplicationTool(Code) | | A pull tool which provides lookups for localized text by delegating
to the configured LocalizationService .
author: Daniel Rall author: Jon Stevens version: $Id: LocalizationTool.java 551164 2007-06-27 14:04:14Z seade $ |
Field Summary | |
protected String | bundleName The name of the bundle for this tool to use. | protected Locale | locale The language and country information parsed from the request's
Accept-Language header. |
Method Summary | |
public String | format(String key, Object arg1) Formats a localized value using the provided object.
Parameters: key - The identifier for the localized text to retrieve, Parameters: arg1 - The object to use as {0} when formatting the localized text. | public String | format(String key, Object arg1, Object arg2) Formats a localized value using the provided objects.
Parameters: key - The identifier for the localized text to retrieve, Parameters: arg1 - The object to use as {0} when formatting the localized text. Parameters: arg2 - The object to use as {1} when formatting the localized text. | public String | format(String key, Object[] args) Formats a localized value using the provided objects.
Parameters: key - The identifier for the localized text to retrieve, Parameters: args - The objects to use as {0}, {1}, etc. | public String | format(String key, List args) Formats a localized value using the provided objects. | public String | get(String key) Performs text lookups for localization.
Assuming there is a instance of this class with a HTTP
request set in your template's context named l10n ,
the VTL $l10n.HELLO would render to
hello for English requests and hola
in Spanish (depending on the value of the HTTP request's
Accept-Language header).
Parameters: key - The identifier for the localized text to retrieve. | protected String | getBundleName(Object data) The return value of this method is used to set the name of the
bundle used by this tool. | public Locale | getLocale() Gets the current locale. | public void | init(Object data) Sets the request to get the Accept-Language header
from (reset on each request). | public void | refresh() No-op. |
bundleName | protected String bundleName(Code) | | The name of the bundle for this tool to use.
|
locale | protected Locale locale(Code) | | The language and country information parsed from the request's
Accept-Language header. Reset on each request.
|
LocalizationTool | public LocalizationTool()(Code) | | Creates a new instance. Used by PullService .
|
format | public String format(String key, Object arg1, Object arg2)(Code) | | Formats a localized value using the provided objects.
Parameters: key - The identifier for the localized text to retrieve, Parameters: arg1 - The object to use as {0} when formatting the localized text. Parameters: arg2 - The object to use as {1} when formatting the localized text. Formatted localized text. See Also: LocalizationTool.format(String,Locale,String,Object[]) |
format | public String format(String key, Object[] args)(Code) | | Formats a localized value using the provided objects.
Parameters: key - The identifier for the localized text to retrieve, Parameters: args - The objects to use as {0}, {1}, etc. whenformatting the localized text. Formatted localized text. |
format | public String format(String key, List args)(Code) | | Formats a localized value using the provided objects. This variation
allows for a List so that the velocity ["arg1", "arg2", "arg3"] syntax
is supported.
Parameters: key - The identifier for the localized text to retrieve, Parameters: args - The objects to use as {0}, {1}, etc. whenformatting the localized text. Formatted localized text. |
get | public String get(String key)(Code) | | Performs text lookups for localization.
Assuming there is a instance of this class with a HTTP
request set in your template's context named l10n ,
the VTL $l10n.HELLO would render to
hello for English requests and hola
in Spanish (depending on the value of the HTTP request's
Accept-Language header).
Parameters: key - The identifier for the localized text to retrieve. The localized text. |
getBundleName | protected String getBundleName(Object data)(Code) | | The return value of this method is used to set the name of the
bundle used by this tool. Useful as a hook for using a
different bundle than specifed in your
LocalizationService configuration.
Parameters: data - The inputs passed from LocalizationTool.init(Object).(ignored by this implementation). |
getLocale | public Locale getLocale()(Code) | | Gets the current locale.
The locale currently in use. |
init | public void init(Object data)(Code) | | Sets the request to get the Accept-Language header
from (reset on each request).
|
refresh | public void refresh()(Code) | | No-op.
|
|
|