Package org.hippoecm.frontend.i18n
Class TranslatorUtils
- java.lang.Object
-
- org.hippoecm.frontend.i18n.TranslatorUtils
-
public class TranslatorUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
CAPTION_PROPERTY
static String
EDITOR_TEMPLATES_NODETYPE
static String
EDITOR_TEMPLATESET_NODETYPE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.wicket.model.IModel<String>
getExceptionTranslation(Class clazz, Throwable t, Object... parameters)
Create a model containing the translated message for the given exception and its parameters.static org.apache.wicket.model.IModel<String>
getExceptionTranslation(org.apache.wicket.Component component, Throwable t, Object... parameters)
Create a model containing the translated message for the given exception and its parameters.static javax.jcr.Node
getTemplateNode(javax.jcr.Node typeNode)
Get the first node of type 'frontend:plugincluster' under the 'editor:templates' node
-
-
-
Field Detail
-
EDITOR_TEMPLATES_NODETYPE
public static final String EDITOR_TEMPLATES_NODETYPE
- See Also:
- Constant Field Values
-
EDITOR_TEMPLATESET_NODETYPE
public static final String EDITOR_TEMPLATESET_NODETYPE
- See Also:
- Constant Field Values
-
CAPTION_PROPERTY
public static final String CAPTION_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTemplateNode
public static javax.jcr.Node getTemplateNode(javax.jcr.Node typeNode) throws TranslatorException
Get the first node of type 'frontend:plugincluster' under the 'editor:templates' node- Parameters:
typeNode
- a node of type 'editor:templates'- Returns:
- the template node or thrown exceptions
- Throws:
javax.jcr.RepositoryException
TranslatorException
- if either no child node of type 'frontend:plugincluster' is found,typeNode
is null or not the type 'editor:templates'.
-
getExceptionTranslation
public static org.apache.wicket.model.IModel<String> getExceptionTranslation(org.apache.wicket.Component component, Throwable t, Object... parameters)
Create a model containing the translated message for the given exception and its parameters. The message will be loaded from the resource properties files of either component or exception class with following syntax:exception,type\=${exception-class-path},message\=${exception-message}=<your-localized-message>
- Parameters:
component
- the component having translated resource filest
- the throwable exceptionparameters
- parameters used in the message template storing in resource files- Returns:
- A model for the translated exception message.
-
getExceptionTranslation
public static org.apache.wicket.model.IModel<String> getExceptionTranslation(Class clazz, Throwable t, Object... parameters)
Create a model containing the translated message for the given exception and its parameters. The message will be loaded from a class's resource properties files with following syntax:exception,type\=${exception-class-path}
- Parameters:
clazz
- the class having translated resource filest
- the throwable exceptionparameters
- parameters used in the message template storing in resource files- Returns:
- A model for the translated exception message.
-
-