Writing Internationalized XWiki Applications
Using the static Resource Bundles
- Stop your XWiki instance
- Unjar the WEB-INF/lib/xwiki-core-*.jar file (it was named xwiki.jar in old versions) in WEB-INF/classes and remove it from WEB-INF/lib
- Edit the WEB-INF/classes/ApplicationResources*.properties Resource Bundle files by adding the key/value pairs you need for your application.
- In your document, use the following to get the value associated with a key:
$msg.get("key")Using properties located in XWiki pages
- Create a page that will host your key/value pairs.
- Enter all the key/value pairs in that page (use the wiki editor). For example:
greeting=hello
welcome=Welcome
withparams=I can {0} pass {1} {2} params too using the Java MessageFormat syntax- Do the same for all the translations you want.
- Tell XWiki that your page is a Document Bundle by going to the Administration page, selecting the Advanced tab and entering it in the "Internationalization Document Bundles" field. You can specify several pages, separated by commas.
- Alternatively you can also specify the list of Internationalization Document Bundles in xwiki.cfg under the key xwiki.documentBundles.
- On the page where you want to use the internationalized message, use:
$msg.get("key") $msg.get("key", ["param1", "param2", ...])
Version 4.1 last modified by VincentMassol on 26/11/2007 at 17:54
Document data
Attachments:
No attachments for this document
Comments: 0