Wiki source code of Internationalization

Version 49.1 by Marius Dumitru Florea on 2020/04/29

Hide last authors
Thomas Mortagne 31.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
Silvia Macovei 20.1 4
Vincent Massol 43.1 5 XWiki can be set-up to support one or various languages.
Silvia Macovei 20.9 6
Vincent Massol 43.1 7 {{groovy}}
8 import groovy.json.*
Silvia Macovei 20.2 9
Vincent Massol 43.1 10 def languages = []
11 def stop = false
12 def counter = 1
13 def total = 0
Guillaume Lerouge 1.1 14
Vincent Massol 43.1 15 while (!stop) {
16 def json = "https://l10n.xwiki.org/api/languages/?page=${counter}".toURL()
17 .getText(requestProperties: [Accept: 'application/json', Authorization: 'q6VxVYaJL7cg2ceCAubkl9vXrLzyshOHa3GlG5RX'])
18 def root = new JsonSlurper().parseText(json)
19 root.results.each() {
20 languages.add("[[${it.name} (${it.code})>>https://l10n.xwiki.org/languages/${it.code}/]]")
21 total++
22 }
23 counter++
24 if (!root.next) {
25 stop = true
26 }
27 }
28
29 println "XWiki has translations in ${total} languages:"
30
31 languages.each() {
32 println "* ${it}"
33 }
34 {{/groovy}}
35
Adel Atallah 46.1 36 If you wish to help out improve translations, check our [[translation platform>>http://l10n.xwiki.org]].
Vincent Massol 43.1 37
Silvia Macovei 20.12 38 = Preferences =
Vincent Massol 18.1 39
Manuel Smeria 26.2 40 Setting up languages is done in the Administration (link on the top left of every page).
Silvia Macovei 20.2 41
Thomas Mortagne 31.1 42 {{info}}
43 To make use of this feature for Languages with encodings that are not ISO-8859-1, you will need to adjust the encoding for your XWiki setup as documented in the [[Encodings page of the Administrators Guide>>platform:AdminGuide.Encoding]].
44 {{/info}}
Silvia Macovei 20.2 45
Silvia Macovei 25.3 46 {{image reference="AdminLanguages.png"/}}
Vincent Massol 8.1 47
Silvia Macovei 20.12 48 = Switch to another language =
Vincent Massol 18.1 49
Vincent Massol 42.3 50 By default the language displayed will be the one coming from the browser. However, on every page you can choose to switch between the different language translations that exist for that page. To do so click on the language name in the top right corner of the screen as shown in the following screenshots. Note that you can also force a language by suffixing a URL with ##language=<2-letter language code>##. In addition you can [[configure your wiki to always use a specific language or force a single language to be used>>platform:AdminGuide.Configuration#HLanguagesettings]].
Guillaume Lerouge 1.1 51
Silvia Macovei 25.3 52 {{image reference="LanguageEN.png"/}} <-//English// //Deutsch//-> {{image reference="LanguageDE.png"/}}
Guillaume Lerouge 1.1 53
Thomas Mortagne 31.1 54 {{info}}
55 Once you click on a language, you're forcing it and thus all pages which have translations in that language will display these translations by default when you navigate to them.
56 {{/info}}
Vincent Massol 8.1 57
Marius Dumitru Florea 48.1 58 = Page translations =
59
60 You can check the [[Information tab>>Documentation.UserGuide.Features.DocumentLifecycle.WebHome#HInformation]] at the bottom of the page to see the language of the current page, its original language, as well as the list of existing and missing page translations. You can use the links to access the available page translation or to create the missing ones.
61
Silvia Macovei 20.12 62 = Edit a translation =
Silvia Macovei 20.9 63
Marius Dumitru Florea 49.1 64 When editing a plain wiki page the editor will load:
65 * the page translation that corresponds to the current laguage, if it exists and multilingual is on
66 * otherwise, the original page
Guillaume Lerouge 1.1 67
Marius Dumitru Florea 49.1 68 When editing a structured page the editor will load the original page because the structured data (objects) are shared by all page translations.
69
70 From Wiki and WYSIWYG edit modes, as well as when editing in-place, you can switch to a different page translation or create a missing translation.
71
72 From the Wiki and WYSIWYG edit modes you are able to edit the default (original) page language. The default language is indicated on the right "Document Information" panel as shown below:
73
Silvia Macovei 25.3 74 {{image reference="DefaultLanguageEN.PNG"/}}
Vincent Massol 8.1 75
Silvia Macovei 20.8 76 In the "Document Translations" panel you can see the current language you are performing translations in and the alternative languages you may translate your page to. These are the languages you have previously set up in "Administration".
Guillaume Lerouge 1.1 77
Silvia Macovei 25.3 78 {{image reference="DocumentTranslations.PNG"/}}
Silvia Macovei 20.8 79
80 In order to translate your document in a different language, click on one of the languages (e.g. Fr). As a result you will see the edition mode translated in that language.
81
Silvia Macovei 25.3 82 {{image reference="DefaultLanguageFR.PNG"/}}
Silvia Macovei 20.8 83
84 Once you save a document in one of the languages, that document becomes the original document and the language it is written in becomes the default language.
85
Silvia Macovei 25.3 86 {{image reference="OriginalLanguage.PNG"/}}
Silvia Macovei 20.8 87
Thomas Mortagne 31.1 88 {{info}}
89 Note that all translations of one page share the same set of XWiki objects. As a result it is impossible to have different objects (and page tags, which are objects too) in different translations for now, but it is planed in next versions.
90 {{/info}}

Get Connected