public class TranslatorUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CAPTION_PROPERTY |
static String |
EDITOR_TEMPLATES_NODETYPE |
static String |
EDITOR_TEMPLATESET_NODETYPE |
Modifier and Type | Method and 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
|
public static final String EDITOR_TEMPLATES_NODETYPE
public static final String EDITOR_TEMPLATESET_NODETYPE
public static final String CAPTION_PROPERTY
public static javax.jcr.Node getTemplateNode(javax.jcr.Node typeNode) throws TranslatorException
typeNode
- a node of type 'editor:templates'javax.jcr.RepositoryException
TranslatorException
- if either no child node of type 'frontend:plugincluster'
is found, typeNode
is null or not the type 'editor:templates'.public static org.apache.wicket.model.IModel<String> getExceptionTranslation(org.apache.wicket.Component component, Throwable t, Object... parameters)
exception,type\=${exception-class-path},message\=${exception-message}=<your-localized-message>
component
- the component having translated resource filest
- the throwable exceptionparameters
- parameters used in the message template storing in resource filespublic static org.apache.wicket.model.IModel<String> getExceptionTranslation(Class clazz, Throwable t, Object... parameters)
exception,type\=${exception-class-path}
This method was created due to CMS-9656, where the GalleryUploadPanel failed to retrieve messages from its
own resource bundle due to an intricate inheritance structure. Using the clazz instead of a component
circumvents the inheritance structure as far as necessary.clazz
- the class having translated resource filest
- the throwable exceptionparameters
- parameters used in the message template storing in resource filesCopyright © 2007–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.