Last modified by Raphaƫl Jakse on 2022/03/17

From version 1.10
edited by Vincent Massol
on 2007/02/16
Change comment: There is no comment for this version
To version 1.13
edited by Vincent Massol
on 2007/10/19
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -5,12 +5,12 @@
5 5  1.1 Using the static Resource Bundles
6 6  
7 7  * Stop your XWiki instance
8 -* Unjar the ~~WEB-INF/lib/xwiki.jar~~ file in ~~WEB-INF/classes~~ and remove the ~~xwiki.jar~~file from ~~WEB-INF/lib~~
8 +* Unjar the ~~WEB-INF/lib/xwiki-core-\*.jar~~ file in ~~WEB-INF/classes~~ and remove it from ~~WEB-INF/lib~~
9 9  * Edit the ~~WEB-INF/classes/ApplicationResources*.properties~~ Resource Bundle files by adding the key/value pairs you need for your application.
10 10  * In your document, use the following to get the value associated with a key:
11 11  
12 12  {code}
13 -\$msg.get("key")
13 +$msg.get("key")
14 14  {code}
15 15  
16 16  This will get the value from the Resource Bundle corresponding to the current language you are using in XWiki.
... ... @@ -25,7 +25,7 @@
25 25  {code}
26 26  greeting=hello
27 27  welcome=Welcome
28 -withparams=I can \{0\} pass \{1\} \{2\} params too using the Java MessageFormat syntax
28 +withparams=I can {0} pass {1} {2} params too using the Java MessageFormat syntax
29 29  {code}
30 30  
31 31  * Do the same for all the translations you want.
... ... @@ -39,8 +39,8 @@
39 39  * On the page where you want to use the internationalized message, use:
40 40  
41 41  {code}
42 -\$msg.get("key")
43 -\$msg\.get\("key", \[\"param1\", \"param2\", \.\.\.\])
42 +$msg.get("key")
43 +$msg.get("key", ["param1", "param2", ...])
44 44  {code}
45 45  
46 46  where ~~key~~ is the key for the message to retrieve. Parameters can also be passed as is shown in the second syntax above.

Get Connected