<
From version < 11.5 >
edited by Clemens Robbenhaar
on 2013/11/07
To version < 12.1 >
edited by Vincent Massol
on 2013/11/08
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ClemensRobbenhaar
1 +XWiki.VincentMassol
Content
... ... @@ -21,14 +21,17 @@
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 "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:(((
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 +
31 31  {{code}}
29 +{{translation key="key"/}}
30 +{{/code}}
31 +
32 +From Script (Velocity in this example):
33 +
34 +{{code}}
32 32  $services.localization.render("key")
33 33  $services.localization.render("key", ["param1", "param2", ...])
34 34  {{/code}}
... ... @@ -36,6 +36,16 @@
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.
37 37  )))
38 38  
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 +
39 39  = I18n of XWiki Objects =
40 40  
41 41  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:
... ... @@ -64,4 +64,3 @@
64 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 -

Get Connected