Klasse LocalizationTool
java.lang.Object
org.apache.turbine.services.localization.LocalizationTool
- Alle implementierten Schnittstellen:
ApplicationTool
A pull tool which provides lookups for localized text by delegating
to the configured Fulcrum
LocalizationService.- Autor:
- Eric Pugh, Daniel Rall, Jon Stevens
-
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungFormats a localized value using the provided objects.Performs text lookups for localization.protected StringgetBundleName(Object data) The return value of this method is used to set the name of the bundle used by this tool.Gets the current locale.voidSets the request to get theAccept-Languageheader from (reset on each request).voidrefresh()No-op.
-
Felddetails
-
locale
The language and country information parsed from the request'sAccept-Languageheader. Reset on each request.
-
-
Konstruktordetails
-
LocalizationTool
public LocalizationTool()Creates a new instance. Used byPullService.
-
-
Methodendetails
-
get
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.HELLOwould render tohellofor English requests andholain Spanish (depending on the value of the HTTP request'sAccept-Languageheader).- Parameter:
key- The identifier for the localized text to retrieve.- Gibt zurück:
- The localized text.
-
getLocale
Gets the current locale.- Gibt zurück:
- The locale currently in use.
-
getBundleName
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 specified in yourLocalizationServiceconfiguration.- Parameter:
data- The inputs passed frominit(Object). (ignored by this implementation).- Gibt zurück:
- the name of the bundle to use
-
format
Formats a localized value using the provided objects.- Parameter:
key- The identifier for the localized text to retrieve,args- The objects to use as {0}, {1}, etc. when formatting the localized text.- Gibt zurück:
- Formatted localized text.
-
init
Sets the request to get theAccept-Languageheader from (reset on each request).- Angegeben von:
initin SchnittstelleApplicationTool- Parameter:
data- initialization data
-
refresh
No-op.- Angegeben von:
refreshin SchnittstelleApplicationTool
-