Wiki source code of Internationalization

Last modified by Thomas Mortagne on 2023/10/10

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 51.2 7 {{velocity}}
8 #set($locales = $xwiki.getDocument('dev:Community.L10N.SupportedLocales.WebHome').getObjects('dev:Community.L10N.SupportedLocales.Code.LocaleClass'))
9 XWiki has translations in ${locales.size()} languages:
Silvia Macovei 20.2 10
Vincent Massol 51.2 11 {{language showCode="true" codes="#foreach($locale in $locales)#if($locale.locale!='none')#if($foreach.index > 0),#end$locale.locale#end#end"/}}
12 {{/velocity}}
Guillaume Lerouge 1.1 13
Vincent Massol 43.1 14
Adel Atallah 46.1 15 If you wish to help out improve translations, check our [[translation platform>>http://l10n.xwiki.org]].
Vincent Massol 43.1 16
Silvia Macovei 20.12 17 = Preferences =
Vincent Massol 18.1 18
Manuel Smeria 26.2 19 Setting up languages is done in the Administration (link on the top left of every page).
Silvia Macovei 20.2 20
Thomas Mortagne 31.1 21 {{info}}
Thomas Mortagne 56.1 22 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>>Documentation.AdminGuide.Encoding]].
Thomas Mortagne 31.1 23 {{/info}}
Silvia Macovei 20.2 24
Silvia Macovei 25.3 25 {{image reference="AdminLanguages.png"/}}
Vincent Massol 8.1 26
Silvia Macovei 20.12 27 = Switch to another language =
Vincent Massol 18.1 28
Thomas Mortagne 56.1 29 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>>Documentation.AdminGuide.Configuration#HLanguagesettings]].
Guillaume Lerouge 1.1 30
Silvia Macovei 25.3 31 {{image reference="LanguageEN.png"/}} <-//English// //Deutsch//-> {{image reference="LanguageDE.png"/}}
Guillaume Lerouge 1.1 32
Thomas Mortagne 31.1 33 {{info}}
34 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.
35 {{/info}}
Vincent Massol 8.1 36
Marius Dumitru Florea 48.1 37 = Page translations =
38
Marius Dumitru Florea 53.1 39 The //title// and //content// of a wiki page can be translated in multiple locales. For this you need to configure your wiki to be multilingual and set the list of supported locales. Once you do this XWiki will try to show you the title and content of the page translation that matches the current user interface locale. If the page has not been translated yet then XWiki will show you the title and content from the original version of the page. You can check the [[Information tab>>Documentation.UserGuide.Features.DocumentLifecycle.WebHome#HInformation]] at the bottom of the page to see the locale of the current page, its original locale, as well as the list of existing and missing page translations. You can use the links to access the available page translations or to create the missing ones.
Marius Dumitru Florea 48.1 40
Marius Dumitru Florea 52.1 41 {{version since='13.2RC1,12.10.5'}}
42 You can also use the Translate page button to start creating the missing translation. It opens either the [[in-place editor>>Documentation.UserGuide.Features.PageEditing||anchor="HIn-placeeditingmode"]] or it takes you to the stand-alone editor (Wiki or WYSIWYG) depending on your preferences.
Marius Dumitru Florea 55.1 43
44 {{image reference="translatePageButton.png" /}}
Marius Dumitru Florea 52.1 45 {{/version}}
46
Silvia Macovei 20.12 47 = Edit a translation =
Silvia Macovei 20.9 48
Marius Dumitru Florea 49.1 49 When editing a plain wiki page the editor will load:
50 * the page translation that corresponds to the current laguage, if it exists and multilingual is on
51 * otherwise, the original page
Guillaume Lerouge 1.1 52
Marius Dumitru Florea 49.1 53 When editing a structured page the editor will load the original page because the structured data (objects) are shared by all page translations.
54
55 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.
56
Marius Dumitru Florea 51.1 57 When editing in-place you get a "Translate" button if the edited page doesn't have a translation for the current locale. Click on the "Translate" button if you wish to create the missing translation, otherwise all the changes you do will be saved to the original version of the page.
58
59 {{image reference="edit-inplace-new-translation.png"/}}
60
Marius Dumitru Florea 49.1 61 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:
62
Silvia Macovei 25.3 63 {{image reference="DefaultLanguageEN.PNG"/}}
Vincent Massol 8.1 64
Silvia Macovei 20.8 65 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 66
Silvia Macovei 25.3 67 {{image reference="DocumentTranslations.PNG"/}}
Silvia Macovei 20.8 68
69 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.
70
Silvia Macovei 25.3 71 {{image reference="DefaultLanguageFR.PNG"/}}
Silvia Macovei 20.8 72
73 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.
74
Silvia Macovei 25.3 75 {{image reference="OriginalLanguage.PNG"/}}
Silvia Macovei 20.8 76
Thomas Mortagne 31.1 77 {{info}}
78 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.
79 {{/info}}

Get Connected