|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Localizer
public class Localizer
A utility class that encapsulates all of the localization related functionality in a way that it
can be accessed by all areas of the framework in a consistent way. A singleton instance of this
class is available via the Application
object.
You may register additional IStringResourceLoader to extend or replace Wickets default search strategy for the properties. E.g. string resource loaders which load the properties from a database. There should be no need to extend Localizer.
Settings.getLocalizer()
,
IStringResourceLoader
,
Settings.getStringResourceLoaders()
Constructor Summary | |
---|---|
Localizer()
Create the utils instance class backed by the configuration information contained within the supplied application object. |
Method Summary | |
---|---|
void |
clearCache()
Clear all cache entries |
protected java.lang.String |
getCacheKey(java.lang.String key,
Component component)
Gets the cache key |
protected java.lang.String |
getFromCache(java.lang.String cacheKey)
Get the value associated with the key from the cache. |
java.lang.String |
getString(java.lang.String key,
Component component)
|
java.lang.String |
getString(java.lang.String key,
Component component,
IModel model)
|
java.lang.String |
getString(java.lang.String key,
Component component,
IModel model,
java.util.Locale locale,
java.lang.String style,
java.lang.String defaultValue)
This method is now deprecated. |
java.lang.String |
getString(java.lang.String key,
Component component,
IModel model,
java.lang.String defaultValue)
Get the localized string using all of the supplied parameters. |
java.lang.String |
getString(java.lang.String key,
Component component,
java.lang.String defaultValue)
|
protected java.util.Map |
newCache()
Create a new cache, override this method if you want a different map to store the cache keys, for example a map that hold only the last X number of elements.. |
protected void |
putIntoCache(java.lang.String cacheKey,
java.lang.String string)
Put the value into the cache and associate it with the cache key |
void |
setEnableCache(boolean value)
By default the cache is enabled. |
java.lang.String |
substitutePropertyExpressions(Component component,
java.lang.String string,
IModel model)
Helper method to handle property variable substitution in strings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Localizer()
Method Detail |
---|
public final void clearCache()
public java.lang.String getString(java.lang.String key, Component component) throws java.util.MissingResourceException
key
- The key to obtain the resource forcomponent
- The component to get the resource for
java.util.MissingResourceException
- If resource not found and configuration dictates that exception should be throwngetString(String, Component, IModel, Locale, String, String)
public java.lang.String getString(java.lang.String key, Component component, IModel model) throws java.util.MissingResourceException
key
- The key to obtain the resource forcomponent
- The component to get the resource formodel
- The model to use for property substitutions in the strings (optional)
java.util.MissingResourceException
- If resource not found and configuration dictates that exception should be throwngetString(String, Component, IModel, Locale, String, String)
public java.lang.String getString(java.lang.String key, Component component, java.lang.String defaultValue) throws java.util.MissingResourceException
key
- The key to obtain the resource forcomponent
- The component to get the resource fordefaultValue
- The default value (optional)
java.util.MissingResourceException
- If resource not found and configuration dictates that exception should be throwngetString(String, Component, IModel, Locale, String, String)
public java.lang.String getString(java.lang.String key, Component component, IModel model, java.util.Locale locale, java.lang.String style, java.lang.String defaultValue) throws java.util.MissingResourceException
key
- component
- model
- locale
- style
- defaultValue
-
java.util.MissingResourceException
public java.lang.String getString(java.lang.String key, Component component, IModel model, java.lang.String defaultValue) throws java.util.MissingResourceException
key
- The key to obtain the resource forcomponent
- The component to get the resource for (optional)model
- The model to use for substitutions in the strings (optional)defaultValue
- The default value (optional)
java.util.MissingResourceException
- If resource not found and configuration dictates that exception should be thrownprotected void putIntoCache(java.lang.String cacheKey, java.lang.String string)
cacheKey
- string
- protected java.lang.String getFromCache(java.lang.String cacheKey)
cacheKey
-
protected java.lang.String getCacheKey(java.lang.String key, Component component)
key
- component
-
public java.lang.String substitutePropertyExpressions(Component component, java.lang.String string, IModel model)
component
- The component requesting a model valuestring
- The string to substitute intomodel
- The model
public final void setEnableCache(boolean value)
value
- protected java.util.Map newCache()
ConcurrentHashMap
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |