Wiki source code of Internationalization

Version 43.2 by Vincent Massol on 2018/05/22

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
Vincent Massol 43.2 36 If you wish to help out improve translations, check our [[translation wiki>>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
Silvia Macovei 20.12 58 = Edit a translation =
Silvia Macovei 20.9 59
Silvia Macovei 20.8 60 When you go to the edition mode you are able to edit the page in the default language. The default language is indicated on the right "Document Information" panel as shown below:
Guillaume Lerouge 1.1 61
Silvia Macovei 25.3 62 {{image reference="DefaultLanguageEN.PNG"/}}
Vincent Massol 8.1 63
Silvia Macovei 20.8 64 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 65
Silvia Macovei 25.3 66 {{image reference="DocumentTranslations.PNG"/}}
Silvia Macovei 20.8 67
68 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.
69
Silvia Macovei 25.3 70 {{image reference="DefaultLanguageFR.PNG"/}}
Silvia Macovei 20.8 71
72 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.
73
Silvia Macovei 25.3 74 {{image reference="OriginalLanguage.PNG"/}}
Silvia Macovei 20.8 75
Thomas Mortagne 31.1 76 {{info}}
77 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.
78 {{/info}}

Get Connected