LocalizationManager component instead@Deprecated public class XWikiMessageTool extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ResourceBundle |
bundle
Deprecated.
The default Resource Bundle to fall back to if no document bundle is found when trying to get a key.
|
protected XWikiContext |
context
Deprecated.
|
| Constructor and Description |
|---|
XWikiMessageTool(ContextualLocalizationManager localization)
Deprecated.
|
XWikiMessageTool(ResourceBundle bundle,
XWikiContext context)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
String |
get(String key)
Deprecated.
|
String |
get(String key,
List<?> params)
Deprecated.
Find a translation and then replace any parameters found in the translation by the passed params parameters.
|
String |
get(String key,
Object... params)
Deprecated.
Find a translation and then replace any parameters found in the translation by the passed parameters.
|
XWikiDocument |
getDocumentBundle(String documentName)
Deprecated.
Helper method to help get a translated version of a document.
|
protected List<String> |
getDocumentBundleNames()
Deprecated.
|
Properties |
getDocumentBundleProperties(XWikiDocument docBundle)
Deprecated.
|
List<XWikiDocument> |
getDocumentBundles()
Deprecated.
|
List<XWikiDocument> |
getDocumentBundles(String documentName,
String defaultLanguage)
Deprecated.
Helper method to help get a translated version of a document.
|
protected String |
getTranslation(String key)
Deprecated.
Looks for a translation in the list of internationalization document bundles.
|
protected XWikiContext |
getXWikiContext()
Deprecated.
|
protected ResourceBundle bundle
@Deprecated protected XWikiContext context
XWikiContext object, used to get access to XWiki primitives for loading documents.public XWikiMessageTool(ContextualLocalizationManager localization)
localization - the localization managerpublic XWikiMessageTool(ResourceBundle bundle, XWikiContext context)
bundle - the default Resource Bundle to fall back to if no document bundle is found when trying to get a keycontext - the XWikiContext object, used to get access to XWiki primitives for loading
documentsprotected XWikiContext getXWikiContext()
public String get(String key)
key - the key identifying the message to look forget(String, java.util.List)for more details on the algorithm used to find the messagepublic String get(String key, List<?> params)
MessageFormat.
Note: The reason we're using a List instead of an Object array is because we haven't found how to easily create
an Array in Velocity whereas a List is easily created. For example: $msg.get("key", ["1", "2", "3"])
.
key - the key of the string to findparams - the list of parameters to use for replacing "{N}" elements in the string. See
MessageFormat for the full syntaxpublic String get(String key, Object... params)
MessageFormat.key - the key of the string to findparams - the list of parameters to use for replacing "{N}" elements in the string. See
MessageFormat for the full syntaxprotected List<String> getDocumentBundleNames()
for more details on the algorithm used to find the document bundlespublic List<XWikiDocument> getDocumentBundles()
XWikiDocument)for more details on the algorithm used to find the document bundlespublic XWikiDocument getDocumentBundle(String documentName)
documentName - the document's name (eg Space.Document)public List<XWikiDocument> getDocumentBundles(String documentName, String defaultLanguage)
documentName - the document's name (eg Space.Document)defaultLanguage - default languagepublic Properties getDocumentBundleProperties(XWikiDocument docBundle)
docBundle - the document bundle.protected String getTranslation(String key)
key - the key identifying the translationCopyright © 2004–2022 XWiki. All rights reserved.