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

<
From version < 12.1 >
edited by Vincent Massol
on 2013/11/08
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.VincentMassol
1 +XWiki.ClemensRobbenhaar
Content
... ... @@ -21,17 +21,14 @@
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 Translation page by adding an Object of type ##TranslationDocumentClass## to your page.
25 -* On the page where you want to use use either the ##~{{translation~}}## macro or the Localization Script Service (check the document for the [[Localization module>>extensions:Extension.Localization Module]]). Quick examples:(((
26 -From wiki syntax:
27 -
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 +{{info}}
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 +{{/info}}
28 +)))
29 +* Alternatively you can also specify the list of Internationalization Document Bundles in ##xwiki.cfg## under the key ##xwiki.documentBundles##.
30 +* On the page where you want to use the internationalized message, use:(((
28 28  {{code}}
29 -{{translation key="key"/}}
30 -{{/code}}
31 -
32 -From Script (Velocity in this example):
33 -
34 -{{code}}
35 35  $services.localization.render("key")
36 36  $services.localization.render("key", ["param1", "param2", ...])
37 37  {{/code}}
... ... @@ -39,16 +39,6 @@
39 39  where ##key## is the key for the message to retrieve. Parameters can also be passed as is shown in the second syntax above.
40 40  )))
41 41  
42 -== Old way ==
43 -
44 -Prior to XWiki 4.3, the way to register a Document Resource Bundle was by going to the Administration page, selecting the "Localization" section and entering it in the "Internationalization Document Bundles" field. You could specify several pages, separated by commas.
45 -
46 -{{info}}
47 -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
48 -{{/info}}
49 -
50 -Alternatively you could also specify the list of Internationalization Document Bundles in ##xwiki.cfg## under the key ##xwiki.documentBundles##.
51 -
52 52  = I18n of XWiki Objects =
53 53  
54 54  This is currently not implemented (see our logged issue: [[XWIKI-69>>http://jira.xwiki.org/browse/XWIKI-69]]). There are 2 workarounds you can use:
... ... @@ -77,3 +77,4 @@
77 77  * In your document, use the following to get the value associated with a key: {{code language="none"}}$services.localization.render("key"){{/code}}
78 78  
79 79  This will get the value from the Resource Bundle corresponding to the current language you are using in XWiki.
67 +

Get Connected