<
From version < 11.4 >
edited by Paul Libbrecht
on 2013/01/24
To version < 11.5 >
edited by Clemens Robbenhaar
on 2013/11/07
>
Change comment: replace deprecated $msg.get

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.polx
1 +XWiki.ClemensRobbenhaar
Content
... ... @@ -21,7 +21,7 @@
21 21  To enable multiple languages you'll need to go to the Administration page and set MultiLingual to true and list the different languages you wish to use in the Languages field.
22 22  {{/info}}
23 23  )))
24 -* Tell XWiki that your page is a Document Bundle by going to the Administration page, selecting the "Programming" icon and entering it in the "Internationalization Document Bundles" field. You can specify several pages, separated by commas.(((
24 +* Tell XWiki that your page is a Document Bundle by going to the Administration page, selecting the "Localization" section and entering it in the "Internationalization Document Bundles" field. You can specify several pages, separated by commas.(((
25 25  {{info}}
26 26  When creating "Internationalization Document Bundles", you should avoid naming the pages with names that include spaces. For example, a document name of Main.My Messages could cause issues, instead, use Main.MyMessages
27 27  {{/info}}
... ... @@ -29,8 +29,8 @@
29 29  * Alternatively you can also specify the list of Internationalization Document Bundles in ##xwiki.cfg## under the key ##xwiki.documentBundles##.
30 30  * On the page where you want to use the internationalized message, use:(((
31 31  {{code}}
32 -$msg.get("key")
33 -$msg.get("key", ["param1", "param2", ...])
32 +$services.localization.render("key")
33 +$services.localization.render("key", ["param1", "param2", ...])
34 34  {{/code}}
35 35  
36 36  where ##key## is the key for the message to retrieve. Parameters can also be passed as is shown in the second syntax above.
... ... @@ -61,7 +61,7 @@
61 61  * Stop your XWiki instance
62 62  * Extract the ##ApplicationResources*.properties## file for your language from the ##WEB-INF/lib/xwiki-*oldcore-*.jar## file and put them in your ##WEB-INF/classes## directory
63 63  * Edit this file and add/modify the key/value pairs you need for your application
64 -* In your document, use the following to get the value associated with a key: {{code language="none"}}$msg.get("key"){{/code}}
64 +* In your document, use the following to get the value associated with a key: {{code language="none"}}$services.localization.render("key"){{/code}}
65 65  
66 66  This will get the value from the Resource Bundle corresponding to the current language you are using in XWiki.
67 67  
XWiki.XWikiComments[2]
Date
... ... @@ -1,1 +1,1 @@
1 -2013-01-24 22:57:12.271
1 +2013-01-24 22:57:12.0

Get Connected