Package org.hippoecm.frontend.i18n
Class TranslatorUtils
java.lang.Object
org.hippoecm.frontend.i18n.TranslatorUtils
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 Node
getTemplateNode
(Node typeNode) Get the first node of type 'frontend:plugincluster' under the 'editor:templates' node
-
Field Details
-
EDITOR_TEMPLATES_NODETYPE
- See Also:
-
EDITOR_TEMPLATESET_NODETYPE
- See Also:
-
CAPTION_PROPERTY
- See Also:
-
-
Method Details
-
getTemplateNode
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:
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.
-