|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.turbine.tool.LocalizationTool
org.tigris.scarab.tools.ScarabLocalizationTool
Scarab-specific localiztion tool. Uses a specific property format to map a generic i10n key to a specific screen. For example, the $i10n.title on the screen: admin/AddPermission.vm would be in ScarabBundle_en.properties
admin/AddPermission.vm.Title
| Field Summary | |
static java.util.Locale |
DEFAULT_LOCALE
The Locale to be used, if the Resource could not be found in one of the Locales specified in the Browser's language preferences. |
| Constructor Summary | |
ScarabLocalizationTool()
Creates a new instance. |
|
| Method Summary | |
protected java.lang.String |
findProperty(java.lang.String property)
Retrieves the localized version of the value of property. |
java.lang.String |
format(java.lang.String key,
java.util.List args)
Formats a localized value using the provided objects. |
java.lang.String |
format(java.lang.String key,
java.lang.Object arg1)
Formats a localized value using the provided object. |
java.lang.String |
format(java.lang.String key,
java.lang.Object[] args)
Formats a localized value using the provided objects. |
java.lang.String |
format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
Formats a localized value using the provided objects. |
java.lang.String |
format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Formats a localized value using the provided objects. |
java.lang.String |
get(Localizable key)
Return the localized property value. |
java.lang.String |
get(java.lang.String key)
Deprecated. Please use #get(LocalizationKey) instead |
protected java.lang.String |
getBundleName()
Get the default ResourceBundle name |
java.lang.String |
getIgnoreMissingResource(java.lang.String key)
Deprecated. Please use #get(LocalizationKey) instead |
java.lang.String |
getMessage(java.lang.Throwable t)
Extract a message from an exception. |
java.util.Locale |
getPrimaryLocale()
Gets the primary locale. |
java.lang.String |
getTitle()
Provides $l10n.Title to templates, grabbing it
from the title property for the current template. |
void |
init(java.lang.Object obj)
Initialize the tool. |
boolean |
isFilterEnabled()
Whether our cross-site scripting filter is enabled. |
void |
refresh()
Reset this instance to initial values. |
void |
restoreBundlePrefix()
Restore the old Bundle Prefix to it's previous value. |
void |
setBundlePrefix(java.lang.String prefix)
Change the BundlePrefix. |
void |
setFilterEnabled(boolean v)
Allow us to be able to enable/disable our cross-site scripting filter when rendering something from the format() method. |
| Methods inherited from class org.apache.turbine.tool.LocalizationTool |
determineBundleName, formatErrorMessage, get, getLocale, getLocalizationService, getPrefix, setPrefix |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static java.util.Locale DEFAULT_LOCALE
| Constructor Detail |
public ScarabLocalizationTool()
initialize the instance.
| Method Detail |
public java.lang.String get(Localizable key)
public java.lang.String get(java.lang.String key)
#get(LocalizationKey) instead
public java.lang.String getIgnoreMissingResource(java.lang.String key)
#get(LocalizationKey) instead
public java.lang.String format(java.lang.String key,
java.lang.Object arg1)
key - The identifier for the localized text to retrieve,arg1 - The object to use as {0} when formatting the localized text.
format(String, List)
public java.lang.String format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2)
key - The identifier for the localized text to retrieve,arg1 - The object to use as {0} when formatting the localized text.arg2 - The object to use as {1} when formatting the localized text.
format(String, List)
public java.lang.String format(java.lang.String key,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
key - The identifier for the localized text to retrieve,arg1 - The object to use as {0} when formatting the localized text.arg2 - The object to use as {1} when formatting the localized text.arg3 - The object to use as {2} when formatting the localized text.
format(String, List)
public java.lang.String format(java.lang.String key,
java.util.List args)
Formats a localized value using the provided objects.
ResourceBundle:
VelocityUsersNotWrong={0} out of {1} users can't be wrong!
Template:
$l10n.format("VelocityUsersNotWrong", ["9", "10"])
Result:
9 out of 10 Velocity users can't be wrong!
key - The identifier for the localized text to retrieve,args - The objects to use as {0}, {1}, etc. when formatting the
localized text.
public void setFilterEnabled(boolean v)
public boolean isFilterEnabled()
public java.lang.String format(java.lang.String key,
java.lang.Object[] args)
key - The identifier for the localized text to retrieve,args - The MessageFormat data used when formatting
the localized text.
format(String, List)public java.lang.String getTitle()
$l10n.Title to templates, grabbing it
from the title property for the current template.
null if title property was not found in
the available resource bundles.protected java.lang.String findProperty(java.lang.String property)
property.
property - The name of the property whose value to retrieve.
public void setBundlePrefix(java.lang.String prefix)
prefix - public void restoreBundlePrefix()
protected java.lang.String getBundleName()
public java.util.Locale getPrimaryLocale()
public void init(java.lang.Object obj)
public void refresh()
public java.lang.String getMessage(java.lang.Throwable t)
null
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||