No edit summary |
No edit summary |
||
Line 20: | Line 20: | ||
== Techniques == | == Techniques == | ||
The explanations on this page use the following techniques, which we will look at in more detail: | [[File:langswitcher.png|alt=language switcher|thumb|language switcher]] | ||
[[File:usrelanguage-switchlabels.png|link=https://en.wiki.bluespice.com/wiki/File:usrelanguage-switchlabels.png|alt=Content based on user language settings|thumb|250x250px|Content based on user language ]] | |||
[[File:multilingual-categories.png|link=https://en.wiki.bluespice.com/wiki/File:multilingual-categories.png|alt=Multilingual category tree|thumb|250x250px|Multilingual category tree]]The explanations on this page use the following techniques, which we will look at in more detail: | |||
# '''Smart language switcher''': A menu bar directly on | #'''Smart language switcher''': A menu bar directly inserted on wiki pages. It provides: | ||
#* the functionality to configure the supported page languages in the wiki | #*'''defining languages''': the functionality to configure the supported page languages in the wiki | ||
#* a mechanism to automatically switch between the language versions of a page | #*'''navigation:''' a mechanism to automatically switch between the language versions of a page | ||
#* a property that | #*'''tracking:''' a property that tracks the page language for each page (supported in BlueSpice pro) | ||
#* | #*'''fall-back mechanism:''' an automatic category assignment system that can track the page language in ''BlueSpice free'' | ||
#* a way to provide a display title for language subpages that otherwise would show the language code as | #*'''translated page titles:''' a way to provide a display title for language subpages that otherwise would show the language code as the title. This is useful to support the quick search functionality of the wiki and to create dynamic page lists. <br /> | ||
# '''User language:''' A simple mechanism to determine which language a user has defined in their personal settings. It provides options to: | #'''User language:''' A simple mechanism to determine which language a user has defined in their personal settings. It provides options to: | ||
#* show or hide content based on the user language | #* show or hide content based on the user language | ||
#* swap the entire page content shown to the user | #*swap the entire page content shown to the user | ||
#* customize the main navigation | #*customize the main navigation | ||
#* display template and form labels to users based on their user preference. | #*display template and form labels to users based on their user preference. <br /> | ||
# '''Categories:''' A multilingual category system. It is useful for: | #'''Categories:''' A multilingual category system. It is useful for: | ||
#* users that don't speak the "main" language (the content language) of the wiki and who want to tag pages in another supported language. | #*users that don't speak the "main" language (the content language) of the wiki and who want to tag pages in another supported language. | ||
== A note about MediaWiki translation extensions == | ==A note about MediaWiki translation extensions== | ||
The following information gives you some suggestions for organising a wiki around its multilingual content based on the previously mentioned aspects. It does not consider using MediaWiki extensions like [[mediawikiwiki:Extension:Translate|Translate]] or the [[mediawikiwiki:MediaWiki_Language_Extension_Bundle|MW Language Extension Bundle]] which can be installed in multlingual wikis to faciliate a section-by-section translation of wiki pages. | The following information gives you some suggestions for organising a wiki around its multilingual content based on the previously mentioned aspects. It does not consider using MediaWiki extensions like [[mediawikiwiki:Extension:Translate|Translate]] or the [[mediawikiwiki:MediaWiki_Language_Extension_Bundle|MW Language Extension Bundle]] which can be installed in multlingual wikis to faciliate a section-by-section translation of wiki pages. | ||
Line 43: | Line 45: | ||
Here, we look at mechanisms that support multilingual content in an easy way. All that is necessary, in addition to using already built-in mechanisms, is importing a language switcher template which provides the necessary information to easily change between different languages. This template also tracks the language versions of a page in a way that makes it easy to create targeted overview pages for users with different language backgrounds. | Here, we look at mechanisms that support multilingual content in an easy way. All that is necessary, in addition to using already built-in mechanisms, is importing a language switcher template which provides the necessary information to easily change between different languages. This template also tracks the language versions of a page in a way that makes it easy to create targeted overview pages for users with different language backgrounds. | ||
== Importing the language switcher == | == Considerations before using the subpages approach == | ||
== Importing the language switcher== | |||
To show that a page has different versions, it is useful to indicate this with a language switcher on each page. If you have no language switcher in your wiki, you can [[Templates download/Language switcher|download a language switcher template]]. The techniques shown in the following sections assume that this particular language switcher is installed. | To show that a page has different versions, it is useful to indicate this with a language switcher on each page. If you have no language switcher in your wiki, you can [[Templates download/Language switcher|download a language switcher template]]. The techniques shown in the following sections assume that this particular language switcher is installed. | ||
Line 50: | Line 54: | ||
[[File:language-switcher-template.png|alt=language switcher on a wiki page|center|thumb|450x450px|language switcher on a wiki page]] | [[File:language-switcher-template.png|alt=language switcher on a wiki page|center|thumb|450x450px|language switcher on a wiki page]] | ||
== Creating wiki pages with translated subpages == | ==Creating wiki pages with translated subpages== | ||
Let's take a page called ''Vacation policy'' in a wiki with English as its content language wiki and create a German language version. | Let's take a page called ''Vacation policy'' in a wiki with English as its content language wiki and create a German language version. | ||
Line 65: | Line 69: | ||
</gallery> | </gallery> | ||
=== Adding the language switcher to a page === | ===Adding the language switcher to a page=== | ||
Now that we have two language versions, we want to connect them with the language switcher. To add the language switcher to a page: | Now that we have two language versions, we want to connect them with the language switcher. To add the language switcher to a page: | ||
# '''Open''' the page in edit mode. | #'''Open''' the page in edit mode. | ||
# '''Insert''' the template ''Languages'' form the editor toolbar. | #'''Insert''' the template ''Languages'' form the editor toolbar. | ||
# '''Enter''' a display title for the page (recommended for subpages).[[File:language-displaytitle.png|link=https://en.wiki.bluespice.com/wiki/File:language-displaytitle.png|alt=Setting the display title|center|thumb|450x450px|Setting the display title]]The search engine will index this display title so that the title search returns the expected result. | #'''Enter''' a display title for the page (recommended for subpages).[[File:language-displaytitle.png|link=https://en.wiki.bluespice.com/wiki/File:language-displaytitle.png|alt=Setting the display title|center|thumb|450x450px|Setting the display title]]The search engine will index this display title so that the title search returns the expected result. | ||
# '''Save''' the page. | #'''Save''' the page. | ||
# '''Repeat''' steps 1-4 with other language subpages (e.g, fr, nl). | #'''Repeat''' steps 1-4 with other language subpages (e.g, fr, nl). | ||
The language switcher in the right corner of the page now shows what other languages are already available. | The language switcher in the right corner of the page now shows what other languages are already available. | ||
[[File:languageswitcher-DE.png|alt=Language switcher shows all available translations|center|thumb|550x550px|The language switcher shows all available translations]] | [[File:languageswitcher-DE.png|alt=Language switcher shows all available translations|center|thumb|550x550px|The language switcher shows all available translations]] | ||
# | # | ||
# | # | ||
== Creating page lists for different languages == | ==Creating page lists for different languages== | ||
Over time, a wiki can have lots of these translated pages. We want to make sure that users know what pages are available in what language. For this purpose, the language switcher template includes a custom property L''anguages/tracklang'' that allows to easily create filtered page lists for this purpose. | Over time, a wiki can have lots of these translated pages. We want to make sure that users know what pages are available in what language. For this purpose, the language switcher template includes a custom property L''anguages/tracklang'' that allows to easily create filtered page lists for this purpose. | ||
Line 91: | Line 95: | ||
Explanation of the arguments for this query: | Explanation of the arguments for this query: | ||
* '''<nowiki>[[:+]]</nowiki>''': Returns pages only in the main namespace. To show the pages form the entire wiki, simply delete this argument. Other options: | *'''<nowiki>[[:+]]</nowiki>''': Returns pages only in the main namespace. To show the pages form the entire wiki, simply delete this argument. Other options: | ||
**<nowiki>[[QM::+]]</nowiki>: Returns pages from the namespace QM | **<nowiki>[[QM::+]]</nowiki>: Returns pages from the namespace QM | ||
**<nowiki>[[QM:+||Help:+]]</nowiki>: Returns pages from the namespaces QM and Help. | **<nowiki>[[QM:+||Help:+]]</nowiki>: Returns pages from the namespaces QM and Help. | ||
* '''<nowiki>[[Languages/tracklang::de]]</nowiki>''': Returns only pages that are marked by the language switcher template as German language pages. Other options: | *'''<nowiki>[[Languages/tracklang::de]]</nowiki>''': Returns only pages that are marked by the language switcher template as German language pages. Other options: | ||
**<nowiki>[[Languages/tracklang::+]]</nowiki>: Returns all language pages that are tracked in the wiki by the language switcher template. | **<nowiki>[[Languages/tracklang::+]]</nowiki>: Returns all language pages that are tracked in the wiki by the language switcher template. | ||
**<nowiki>[[Languages/tracklang::!de]]</nowiki>: Returns all language pages except German pages. | **<nowiki>[[Languages/tracklang::!de]]</nowiki>: Returns all language pages except German pages. | ||
**<nowiki>[[Languages/tracklang::de||fr]]</nowiki>: Returns all language pages in German and French (in the example above restricted to the main namespace. | **<nowiki>[[Languages/tracklang::de||fr]]</nowiki>: Returns all language pages in German and French (in the example above restricted to the main namespace. | ||
* '''format=category''': returns a category style output. | *'''format=category''': returns a category style output. | ||
** format=ul: returns a list style output | ** format=ul: returns a list style output | ||
[[File:languageswitcher-ask-result-de.png|alt=Results format "ul"|center|thumb|250x250px|Results format "ul"]] | [[File:languageswitcher-ask-result-de.png|alt=Results format "ul"|center|thumb|250x250px|Results format "ul"]] | ||
Line 107: | Line 111: | ||
{{Messagebox|boxtype=note|icon=|Note text=Working with properties requires the [https://www.mediawiki.org/wiki/Extension:Semantic_MediaWiki Semantic MediaWiki extensions], which are bundled in ''BlueSpice pro'', but not in ''BlueSpice free''. There are, however, alternative approaches for [[#Mulitlingual content in BlueSpice free|creating page lists in ''BlueSpice free'']].|bgcolor=}} | {{Messagebox|boxtype=note|icon=|Note text=Working with properties requires the [https://www.mediawiki.org/wiki/Extension:Semantic_MediaWiki Semantic MediaWiki extensions], which are bundled in ''BlueSpice pro'', but not in ''BlueSpice free''. There are, however, alternative approaches for [[#Mulitlingual content in BlueSpice free|creating page lists in ''BlueSpice free'']].|bgcolor=}} | ||
== Creating portal pages based on user language settings == | ==Creating portal pages based on user language settings== | ||
Portal pages are pages that serve as entry points to different topics or areas in the portal, often considering the needs of specific user groups. A typical example is the main page of the wiki, which should give users a high-level orientation in the wiki. A portal page is a good place to take the language needs of different users into account. | Portal pages are pages that serve as entry points to different topics or areas in the portal, often considering the needs of specific user groups. A typical example is the main page of the wiki, which should give users a high-level orientation in the wiki. A portal page is a good place to take the language needs of different users into account. | ||
Here, we can take two different approaches: | Here, we can take two different approaches: | ||
# Show the '''same page to all users''', but include '''some content''' that targets specific user languages. | #Show the '''same page to all users''', but include '''some content''' that targets specific user languages. | ||
# Show completely '''separate content''' to users based on their user language. | #Show completely '''separate content''' to users based on their user language. | ||
=== What is the user language? === | ===What is the user language?=== | ||
Wiki users can change their own language setting in the user preferences: | Wiki users can change their own language setting in the user preferences: | ||
[[File:userlanguage.png|alt=User language preference|center|thumb|550x550px|User language preference]] | [[File:userlanguage.png|alt=User language preference|center|thumb|550x550px|User language preference]] | ||
Line 122: | Line 126: | ||
To provide additional support for this setting, we can include checks on wiki pages that determine the user language and serve up additional or alternative information as needed. | To provide additional support for this setting, we can include checks on wiki pages that determine the user language and serve up additional or alternative information as needed. | ||
=== Preparing the user language check === | ===Preparing the user language check=== | ||
Checking for the user language requires that we create a system message for this purpose. This is easy to do, but needs to be done by users in the role ''admin'' or ''structuremanager.'' | Checking for the user language requires that we create a system message for this purpose. This is easy to do, but needs to be done by users in the role ''admin'' or ''structuremanager.'' | ||
To create a system message for the user language: | To create a system message for the user language: | ||
# '''Create''' the page ''MediaWiki:lang w''ith the content being the language code of the content language of your wiki. If you are not sure in what language your wiki was installed, you can add the magic word <nowiki>{{CONTENTLANGUAGE}}</nowiki> to the source of any wiki page and look at its output. If you have an English wiki, you need to add "en" as the content to this page. If your wiki is German, add "de" instead.[[File:message key-lang.png|alt=Page MediaWiki:Lang|center|thumb|650x650px|Page MediaWiki:Lang]] | #'''Create''' the page ''MediaWiki:lang w''ith the content being the language code of the content language of your wiki. If you are not sure in what language your wiki was installed, you can add the magic word <nowiki>{{CONTENTLANGUAGE}}</nowiki> to the source of any wiki page and look at its output. If you have an English wiki, you need to add "en" as the content to this page. If your wiki is German, add "de" instead.[[File:message key-lang.png|alt=Page MediaWiki:Lang|center|thumb|650x650px|Page MediaWiki:Lang]] | ||
# '''Create''' subpages to this page for the user languages you want to support. For example in an English wiki: | #'''Create''' subpages to this page for the user languages you want to support. For example in an English wiki: | ||
#* MediaWiki:Lang/de | #*MediaWiki:Lang/de | ||
#* MediaWiki:Lang/fr | #*MediaWiki:Lang/fr | ||
Now we have a mechanism to detect the user language. By checking for the value of the "[[mediawikiwiki:Help:Magic_words#Localization|magic word]]" <nowiki>{{int:lang}}</nowiki> , we can use it in many different scenarios. | Now we have a mechanism to detect the user language. By checking for the value of the "[[mediawikiwiki:Help:Magic_words#Localization|magic word]]" <nowiki>{{int:lang}}</nowiki> , we can use it in many different scenarios. | ||
=== Displaying additional content === | ===Displaying additional content=== | ||
To show content on a page only to users with a specific language setting — for example, German — we can add the following check:<syntaxhighlight lang="text"> | To show content on a page only to users with a specific language setting — for example, German — we can add the following check:<syntaxhighlight lang="text"> | ||
{{#ifeq: {{int:lang}}|de|show this content|}} | {{#ifeq: {{int:lang}}|de|show this content|}} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Switching to different page content === | ===Switching to different page content=== | ||
To show entirely different content to users with different language settings, you can prepare different pages and then serve them up as needed. As an example we take the homepage of the wiki. | To show entirely different content to users with different language settings, you can prepare different pages and then serve them up as needed. As an example we take the homepage of the wiki. | ||
To display different homepage content based on user language in an English wiki, where the homepage is called ''Main Page'': | To display different homepage content based on user language in an English wiki, where the homepage is called ''Main Page'': | ||
# Create a subpage for each language you want to support, e.g. | #Create a subpage for each language you want to support, e.g. | ||
## Main Page/en | ## Main Page/en | ||
## Main Page/de | ##Main Page/de | ||
## Main Page/fr | ## Main Page/fr | ||
# On the page Main Page, add the following switch:<syntaxhighlight lang="text"> | #On the page Main Page, add the following switch:<syntaxhighlight lang="text"> | ||
{{#switch: {{int:lang}}|de={{:Main Page/de}}|fr={{:Main Page/fr}}|{{:Main Page/en}} }} | {{#switch: {{int:lang}}|de={{:Main Page/de}}|fr={{:Main Page/fr}}|{{:Main Page/en}} }} | ||
</syntaxhighlight>Users with language setting "de" will see the content of page ''Main Page/de'', users with "fr" language setting the page ''Main Page/fr'', all other users get the page Main ''Page/en''. | </syntaxhighlight>Users with language setting "de" will see the content of page ''Main Page/de'', users with "fr" language setting the page ''Main Page/fr'', all other users get the page Main ''Page/en''. | ||
=== Switching labels === | ===Switching labels=== | ||
To show different labels or short text snippets directly on a page, we can also use the switch function:<syntaxhighlight lang="text"> | To show different labels or short text snippets directly on a page, we can also use the switch function:<syntaxhighlight lang="text"> | ||
{{#switch:{{int:lang}}|de=Überschrift 2|en=Heading 2}} | {{#switch:{{int:lang}}|de=Überschrift 2|en=Heading 2}} | ||
</syntaxhighlight>To summarize, the following main page can be accomplished in two different ways: | </syntaxhighlight>To summarize, the following main page can be accomplished in two different ways: | ||
# By creating separate subpages for each user language and then transcluding them with a user language check on the actual Main Page. | #By creating separate subpages for each user language and then transcluding them with a user language check on the actual Main Page. | ||
# By loading the actual Main Page and then building the language checks into the page itself. The following picture shows examples of: | #By loading the actual Main Page and then building the language checks into the page itself. The following picture shows examples of: | ||
#* (1), (2) Switching headings | #*(1), (2) Switching headings | ||
#* (3) Displaying query results based on the tracked language from the language switcher template (e.g., <nowiki>[[Languages/tracklang::en]]</nowiki>) | #*(3) Displaying query results based on the tracked language from the language switcher template (e.g., <nowiki>[[Languages/tracklang::en]]</nowiki>) | ||
#* (4) Switching display labels in templates (this can also be applied to page forms) | #*(4) Switching display labels in templates (this can also be applied to page forms) | ||
#* (5) Switching image captions | #*(5) Switching image captions | ||
[[File:usrelanguage-switchlabels.png|alt=Content based on user language settings|center|thumb|750x750px|Content based on user language settings]] | [[File:usrelanguage-switchlabels.png|alt=Content based on user language settings|center|thumb|750x750px|Content based on user language settings]] | ||
=== Switching template and form labels === | ===Switching template and form labels=== | ||
As the previous screenshot shows, labels in templates (and forms) can also be shown based on user language. You can simply add the switch function directly in the template. The template ''Template:Contactinfo'' collects street, zip and city info:<syntaxhighlight lang="text"> | As the previous screenshot shows, labels in templates (and forms) can also be shown based on user language. You can simply add the switch function directly in the template. The template ''Template:Contactinfo'' collects street, zip and city info:<syntaxhighlight lang="text"> | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 182: | Line 186: | ||
</gallery> | </gallery> | ||
== Multilingual navigation == | ==Multilingual navigation== | ||
Currently, there is no easy mechanism to create multilingual navigation menus, such as the main navigation or the custom menu. More support should be coming in one of the next minor releases of BlueSpice (4.2 or 4.3). In the meantime, you can create [[Manual:Extension/BlueSpiceDiscovery/Main navigation/Language support|individual links based on a user's language settings]]. | Currently, there is no easy mechanism to create multilingual navigation menus, such as the main navigation or the custom menu. More support should be coming in one of the next minor releases of BlueSpice (4.2 or 4.3). In the meantime, you can create [[Manual:Extension/BlueSpiceDiscovery/Main navigation/Language support|individual links based on a user's language settings]]. | ||
== Searching content by language == | ==Searching content by language== | ||
[[File:search-tracklang1.png|alt=Limiting search results by language|center|thumb|650x650px|Limiting search results by language]] | [[File:search-tracklang1.png|alt=Limiting search results by language|center|thumb|650x650px|Limiting search results by language]] | ||
[[File:search-tracklang2.png|alt=Filtering pages by language|center|thumb|250x250px|Filtering pages by language]] | [[File:search-tracklang2.png|alt=Filtering pages by language|center|thumb|250x250px|Filtering pages by language]] | ||
== Multilingual categories == | ==Multilingual categories== | ||
An important aspect of organizing content is a well-designed category system for your wiki. By tagging your content, you support both the search functionality and the possibility of creating context-based page lists in all kinds of variations. | An important aspect of organizing content is a well-designed category system for your wiki. By tagging your content, you support both the search functionality and the possibility of creating context-based page lists in all kinds of variations. | ||
Line 207: | Line 211: | ||
*Is there already a different mechanism (e.g. a SMW-property, an automatically assigned category, the subpage syntax) that can be used to later "collect" pages based on different commonalities.|bgcolor=}} | *Is there already a different mechanism (e.g. a SMW-property, an automatically assigned category, the subpage syntax) that can be used to later "collect" pages based on different commonalities.|bgcolor=}} | ||
=== Creating a root category first === | ===Creating a root category first=== | ||
It is also a good idea, to start your category system with a single root category: | It is also a good idea, to start your category system with a single root category: | ||
[[File:rootcategory.png|alt=Starting with a root category|center|thumb|250x250px|Starting with a root category]] | [[File:rootcategory.png|alt=Starting with a root category|center|thumb|250x250px|Starting with a root category]] | ||
Line 214: | Line 218: | ||
This allows you to later manage your category system without entangling it with other unrelated categories that might be created by users. Besides your category system, other types of categories might coexist: | This allows you to later manage your category system without entangling it with other unrelated categories that might be created by users. Besides your category system, other types of categories might coexist: | ||
* [[mediawikiwiki:Help:Categories#Hidden_categories|Hidden categories]] | *[[mediawikiwiki:Help:Categories#Hidden_categories|Hidden categories]] | ||
* [[mediawikiwiki:Help:Tracking_categories|Tracking categories]] | *[[mediawikiwiki:Help:Tracking_categories|Tracking categories]] | ||
* Informal tagging-categories created by users "on-the-go" | *Informal tagging-categories created by users "on-the-go" | ||
=== Sharing subcategories === | === Sharing subcategories=== | ||
If you have already assigned a subcategory to a category using the [[Manual:Extension/BlueSpiceCategoryManager|Category manager]], there is no mechanism to assign it to a second category. You have to do the assignment manually and directly on the category page. For example, to use the category ''APP SAP'' as a subcategory of both the category ''APP Application'' and ''APPde Anwendung:''[[File:multiple-parentcats.png|alt=Subcategory of multiple parent categories|center|thumb|550x550px|Subcategory of multiple parent categories]]The category manager then shows the category APP SAP listed under both parent categories: [[File:multiple-parentcats-catmanager.png|alt=Shared subcategory|center|thumb|280x280px|Shared subcategory]] | If you have already assigned a subcategory to a category using the [[Manual:Extension/BlueSpiceCategoryManager|Category manager]], there is no mechanism to assign it to a second category. You have to do the assignment manually and directly on the category page. For example, to use the category ''APP SAP'' as a subcategory of both the category ''APP Application'' and ''APPde Anwendung:''[[File:multiple-parentcats.png|alt=Subcategory of multiple parent categories|center|thumb|550x550px|Subcategory of multiple parent categories]]The category manager then shows the category APP SAP listed under both parent categories: [[File:multiple-parentcats-catmanager.png|alt=Shared subcategory|center|thumb|280x280px|Shared subcategory]] | ||
{{Messagebox|boxtype=important|icon=yes|Note text=If you delete a shared subcategory from the category manager, it will be deleted from all its parent categories and from all the pages that are assigned to this subcategory.|bgcolor=}} | {{Messagebox|boxtype=important|icon=yes|Note text=If you delete a shared subcategory from the category manager, it will be deleted from all its parent categories and from all the pages that are assigned to this subcategory.|bgcolor=}} | ||
=== Querying multilingual categories === | ===Querying multilingual categories=== | ||
To show a list of pages based on categories, you can use different arguments in an ask query. | To show a list of pages based on categories, you can use different arguments in an ask query. | ||
* Show all pages in categories ''DOC Process description'' OR ''DOC Prozessbeschreibung:'' | *Show all pages in categories ''DOC Process description'' OR ''DOC Prozessbeschreibung:'' | ||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
[[Category:DOC Process description||Category:DOCde Prozessbeschreibung]] | [[Category:DOC Process description||Category:DOCde Prozessbeschreibung]] | ||
Line 231: | Line 235: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* Show all pages in all categories related to Applications (both German and English). This also includes the pages in all subcategories of these two main categories: | *Show all pages in all categories related to Applications (both German and English). This also includes the pages in all subcategories of these two main categories: | ||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
[[Category:APP Application||APPde Anwendung]] | [[Category:APP Application||APPde Anwendung]] | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* Show all pages in category ''APP Applicatio''n including pages from the first level of subcategories only. Do not include English versions of any subcategories that are shared across languages. This ensures that the German pages included by default through the shared subcategory ''APP SAP'' are not included in the results<syntaxhighlight lang="text"> | *Show all pages in category ''APP Applicatio''n including pages from the first level of subcategories only. Do not include English versions of any subcategories that are shared across languages. This ensures that the German pages included by default through the shared subcategory ''APP SAP'' are not included in the results<syntaxhighlight lang="text"> | ||
[[Category:APP Application|+depth=1]][[Languages/tracklang::!de]] | [[Category:APP Application|+depth=1]][[Languages/tracklang::!de]] | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 08:11, 30 March 2022
A wiki can be set up to include different language versions for wiki pages. Wiki administrators have to make some decisions regarding how they want to support each wiki user's language setting in addition to simply providing translated content.
The following considerations refer to a single-wiki scenario and don't apply if the language versions are maintained in multiple wikis.
Concepts
To make a single wiki multilingual, some basic steps are necessary:
- Import a language switcher
- Create wiki pages with linked translation subpages
In addition, depending on your wiki setup, further aspects can and should be considered:
- Create page lists for each language with different filter settings
- Create portal pages based on user language
- Create template and form labels based on user language
- Create a multilingual category system
- Create multilingual navigation links
Techniques
The explanations on this page use the following techniques, which we will look at in more detail:
- Smart language switcher: A menu bar directly inserted on wiki pages. It provides:
- defining languages: the functionality to configure the supported page languages in the wiki
- navigation: a mechanism to automatically switch between the language versions of a page
- tracking: a property that tracks the page language for each page (supported in BlueSpice pro)
- fall-back mechanism: an automatic category assignment system that can track the page language in BlueSpice free
- translated page titles: a way to provide a display title for language subpages that otherwise would show the language code as the title. This is useful to support the quick search functionality of the wiki and to create dynamic page lists.
- User language: A simple mechanism to determine which language a user has defined in their personal settings. It provides options to:
- show or hide content based on the user language
- swap the entire page content shown to the user
- customize the main navigation
- display template and form labels to users based on their user preference.
- Categories: A multilingual category system. It is useful for:
- users that don't speak the "main" language (the content language) of the wiki and who want to tag pages in another supported language.
A note about MediaWiki translation extensions
The following information gives you some suggestions for organising a wiki around its multilingual content based on the previously mentioned aspects. It does not consider using MediaWiki extensions like Translate or the MW Language Extension Bundle which can be installed in multlingual wikis to faciliate a section-by-section translation of wiki pages.
If most of your wiki content needs consistently accurate translations, these extensions can be valuable. Such a focus on translation, however, requires an understanding of how this mechanism technically works and might hinder the spontaneous contribution to the wiki by a broad user base. In addition, these extensions are not bundled with BlueSpice and require additional administrative effort during wiki updates or upgrades.
Here, we look at mechanisms that support multilingual content in an easy way. All that is necessary, in addition to using already built-in mechanisms, is importing a language switcher template which provides the necessary information to easily change between different languages. This template also tracks the language versions of a page in a way that makes it easy to create targeted overview pages for users with different language backgrounds.
Considerations before using the subpages approach
Importing the language switcher
To show that a page has different versions, it is useful to indicate this with a language switcher on each page. If you have no language switcher in your wiki, you can download a language switcher template. The techniques shown in the following sections assume that this particular language switcher is installed.
Be sure to read the configuration instructions on the downloads page. You need to define the languages that you want to support in your wiki in the template itself.
Creating wiki pages with translated subpages
Let's take a page called Vacation policy in a wiki with English as its content language wiki and create a German language version.
To create a language version for the main language (=content language), a subpage with the ISO-639 language code as subpage name is created. This means that for the page Vacation policy, you need to create the subpage Vacation policy/de.
As you can see in the screenshots below, the page content is always shown in the context of the user language preferences of each user. This means that the user interface elements do not necessarily correspond to the translated language. But since the user decided to use this language setting, it does not negatively affect this user, but actually supports them when navigating the wiki.
Adding the language switcher to a page
Now that we have two language versions, we want to connect them with the language switcher. To add the language switcher to a page:
- Open the page in edit mode.
- Insert the template Languages form the editor toolbar.
- Enter a display title for the page (recommended for subpages).The search engine will index this display title so that the title search returns the expected result.
- Save the page.
- Repeat steps 1-4 with other language subpages (e.g, fr, nl).
The language switcher in the right corner of the page now shows what other languages are already available.
Creating page lists for different languages
Over time, a wiki can have lots of these translated pages. We want to make sure that users know what pages are available in what language. For this purpose, the language switcher template includes a custom property Languages/tracklang that allows to easily create filtered page lists for this purpose.
In BlueSpice pro, you can include different inline queries on any wiki page. This example lists German language pages in the main namespace and displays them in a category-type output (A-Z listing):
{{#ask:
[[:+]][[Languages/tracklang::de]]
|format=category
}}
Explanation of the arguments for this query:
- [[:+]]: Returns pages only in the main namespace. To show the pages form the entire wiki, simply delete this argument. Other options:
- [[QM::+]]: Returns pages from the namespace QM
- [[QM:+||Help:+]]: Returns pages from the namespaces QM and Help.
- [[Languages/tracklang::de]]: Returns only pages that are marked by the language switcher template as German language pages. Other options:
- [[Languages/tracklang::+]]: Returns all language pages that are tracked in the wiki by the language switcher template.
- [[Languages/tracklang::!de]]: Returns all language pages except German pages.
- [[Languages/tracklang::de||fr]]: Returns all language pages in German and French (in the example above restricted to the main namespace.
- format=category: returns a category style output.
- format=ul: returns a list style output
To see more examples for defining and further modifying a query, go to our SMW-query examples page.
Creating portal pages based on user language settings
Portal pages are pages that serve as entry points to different topics or areas in the portal, often considering the needs of specific user groups. A typical example is the main page of the wiki, which should give users a high-level orientation in the wiki. A portal page is a good place to take the language needs of different users into account.
Here, we can take two different approaches:
- Show the same page to all users, but include some content that targets specific user languages.
- Show completely separate content to users based on their user language.
What is the user language?
Wiki users can change their own language setting in the user preferences:
Depending on this setting, users then see the user interface elements in that language as we have seen in previous screenshots. This applies to interface elements that already have translated system messages.
To provide additional support for this setting, we can include checks on wiki pages that determine the user language and serve up additional or alternative information as needed.
Preparing the user language check
Checking for the user language requires that we create a system message for this purpose. This is easy to do, but needs to be done by users in the role admin or structuremanager.
To create a system message for the user language:
- Create the page MediaWiki:lang with the content being the language code of the content language of your wiki. If you are not sure in what language your wiki was installed, you can add the magic word {{CONTENTLANGUAGE}} to the source of any wiki page and look at its output. If you have an English wiki, you need to add "en" as the content to this page. If your wiki is German, add "de" instead.
- Create subpages to this page for the user languages you want to support. For example in an English wiki:
- MediaWiki:Lang/de
- MediaWiki:Lang/fr
Now we have a mechanism to detect the user language. By checking for the value of the "magic word" {{int:lang}} , we can use it in many different scenarios.
Displaying additional content
To show content on a page only to users with a specific language setting — for example, German — we can add the following check:
{{#ifeq: {{int:lang}}|de|show this content|}}
Switching to different page content
To show entirely different content to users with different language settings, you can prepare different pages and then serve them up as needed. As an example we take the homepage of the wiki.
To display different homepage content based on user language in an English wiki, where the homepage is called Main Page:
- Create a subpage for each language you want to support, e.g.
- Main Page/en
- Main Page/de
- Main Page/fr
- On the page Main Page, add the following switch:Users with language setting "de" will see the content of page Main Page/de, users with "fr" language setting the page Main Page/fr, all other users get the page Main Page/en.
{{#switch: {{int:lang}}|de={{:Main Page/de}}|fr={{:Main Page/fr}}|{{:Main Page/en}} }}
Switching labels
To show different labels or short text snippets directly on a page, we can also use the switch function:
{{#switch:{{int:lang}}|de=Überschrift 2|en=Heading 2}}
To summarize, the following main page can be accomplished in two different ways:
- By creating separate subpages for each user language and then transcluding them with a user language check on the actual Main Page.
- By loading the actual Main Page and then building the language checks into the page itself. The following picture shows examples of:
- (1), (2) Switching headings
- (3) Displaying query results based on the tracked language from the language switcher template (e.g., [[Languages/tracklang::en]])
- (4) Switching display labels in templates (this can also be applied to page forms)
- (5) Switching image captions
Switching template and form labels
As the previous screenshot shows, labels in templates (and forms) can also be shown based on user language. You can simply add the switch function directly in the template. The template Template:Contactinfo collects street, zip and city info:
{| class="wikitable"
! {{#switch:{{int:lang}}|en=Street|de=Straße}}
| {{{street|}}}
|-
! {{#switch:{{int:lang}}|en=Zip|de=PLZ}}
| {{{zip|}}}
|-
! {{#switch:{{int:lang}}|en=City|de=Stadt}}
| {{{city|}}}
|}
It displays the different labels as needed:
Currently, there is no easy mechanism to create multilingual navigation menus, such as the main navigation or the custom menu. More support should be coming in one of the next minor releases of BlueSpice (4.2 or 4.3). In the meantime, you can create individual links based on a user's language settings.
Searching content by language
Multilingual categories
An important aspect of organizing content is a well-designed category system for your wiki. By tagging your content, you support both the search functionality and the possibility of creating context-based page lists in all kinds of variations.
To keep an overview of which categories are available translated in different languages and which categories are simply shared by different languages, you can use a prefix mechanism that allows to associate categories by language.
For example, for the category Application, you would use (in an English wiki) the English category APP Application and the German category APPde Anwendung. Both categories could share the category APP SAP.
Whether you even need the separate category APPde Anwendung depends simply on the language proficiencies of your users. You don't need to create a language variation of a category just for finding, for example, all German pages that are related to the concept of "Applications", since the language switcher mechanism already collects this information for you (both in BlueSpice free and in BlueSpice pro).
Creating a root category first
It is also a good idea, to start your category system with a single root category:
This allows you to later manage your category system without entangling it with other unrelated categories that might be created by users. Besides your category system, other types of categories might coexist:
- Hidden categories
- Tracking categories
- Informal tagging-categories created by users "on-the-go"
Sharing subcategories
If you have already assigned a subcategory to a category using the Category manager, there is no mechanism to assign it to a second category. You have to do the assignment manually and directly on the category page. For example, to use the category APP SAP as a subcategory of both the category APP Application and APPde Anwendung:
The category manager then shows the category APP SAP listed under both parent categories:
Querying multilingual categories
To show a list of pages based on categories, you can use different arguments in an ask query.
- Show all pages in categories DOC Process description OR DOC Prozessbeschreibung:
[[Category:DOC Process description||Category:DOCde Prozessbeschreibung]]
- Show all pages in all categories related to Applications (both German and English). This also includes the pages in all subcategories of these two main categories:
[[Category:APP Application||APPde Anwendung]]
- Show all pages in category APP Application including pages from the first level of subcategories only. Do not include English versions of any subcategories that are shared across languages. This ensures that the German pages included by default through the shared subcategory APP SAP are not included in the results
[[Category:APP Application|+depth=1]][[Languages/tracklang::!de]]