Help:Extension:Translate/Unstructured element translation/nl

Op deze pagina wordt uitgelegd hoe met de extensie Translate de vertaling van aangepaste wiki interface berichten wat meer beheersbaar gemaakt kunnen worden. Het slaat op elk deel van de interface van de wiki die u automatisch wil aanbieden in de taal van de gebruiker. Een typisch voorbeeld is de zijbalk, daar kan er maar een van zijn, maar dezelfde methode kan voor de hoofdpagina gebruikt worden, als u alle vertalingen ervan onder dezelfde titel wilt hebben, ook voor de sjablonen.

Deze methode is ook toepasbaar als de wiki inhoud niet geschikt is voor vertaling van de hele pagina, bijvoorbeeld als er erg veel opmaak is of als er veel sjablonen gebruikt worden. Men wil voorkomen dat vertalers per ongeluk de opmaak gaan vertalen of moeten gaan nadenken of iets opmaak is. Dit gaat ook rondom de interface berichten en het magische woord, dat toestaat dat interface berichten overal toegevoegd kunnen worden waar wikitext geschreven kan worden. Dit magische woord zorgt er automatisch voor dat het interface bericht wordt vervangen door die tekst in taal van de gebruiker.

U kunt dus de kracht van de automatische vertaling van de wiki interface naar de wiki gebruiken, maar dat lost het probleem voor de anonieme gebruikers niet op. Die kunnen standaard niet de taal aanpassen. Zie hieronder de extensie Universal Language Selector.

Compared to page translation, this method has some drawbacks:


 * 1) MediaWiki developers usually discourage the usage of  because it fragments the cache. Instead of storing one cached rendered version of a page, when  is used it needs to be cached potentially in hundreds of different languages.
 * 2) It is harder to setup, requiring access to wiki configuration.
 * 3) There is no automatic tracking of outdated translations and completion statistics might be off when new messages are added or deleted.
 * 4) Only wiki administrators can add messages to the message groups and translate them. This means that the system is suitable only for pages which don't change often, or administrators will have a lot of work.

The good thing is that it works most of the time and you can still get the job done. There are two tutorials that provide examples of the common use cases. Before that there is a section which details how to set up a message group, something which is always needed when using this method.

Instellen
A server administrator must complete this step. The following snippet needs to be added to :

The message group id,, must be unique, so don't reuse the same id for multiple groups. The second parameter to the  constructor, , refers to the MediaWiki:Sidebar-messages page. The label is shown in dropdowns and other places where you can select a message group. The description is shown in Special:Translate. Those are the values you can and should change to what suits your wiki when adding a new custom message group.



Tutorial vertaald zijbalk
We assume that the setup step has already been done. Then you should follow the sidebar customization guide carefully. Let's assume the following simple sidebar was created:


 * sidebar-commonpages
 * FAQ|sidebar-faq

And MediaWiki:Sidebar-commonpages contains, while MediaWiki:Sidebar-faq contains.

Then all we need to do is to go to MediaWiki:Sidebar-messages (or whatever was defined in the previous step) and write there:

sidebar-commonpages sidebar-faq

That is, the names of the system messages, without the "MediaWiki:" namespace prefix, separated by whitespace.

Then go to Special:Translate/wiki-sidebar (or whatever was defined in the previous step; see Special:Translate for the list of defined groups). Now it is possible to translate the messages into other languages. Since all the messages are in the MediaWiki namespace, only interface administrators can edit the list of messages and actually translate them.



Tutorial vertaalde hoofdpagina
Another use case is a page with lots of markup or templates. The advantage of this method is that the language automatically appears in the user's interface language. The drawback is that to change the language in which the page is displayed, the interface language must be changed.

The implementation is the same as in the previous tutorial:


 * 1) Setup a new message group.
 * 2) Take a wiki page.
 * 3) Replace each translatable part with  and move the content to MediaWiki:Mainpage-messagename.
 * 4) Go to MediaWiki:Mainpage-messages (or what was defined in the setup) and add the message names there separated by whitespace.
 * 5) You are done. Go to Special:Translate to translate the main page.

Here is an example. Let's say Main Page contains:

Then change it to:

Create MediaWiki:Mainpage-slogan with the content:

is a community for chefs and bakers that love chocolate.

Create MediaWiki:Mainpage-pagecount with the content:

We currently have pages full of chocolate.

Create MediaWiki:Mainpage-messages with the content:

mainpage-slogan mainpage-pagecount

And you are done! You can add and remove new messages any time you want.



Selectie van taal
Not only the user can't choose what localised version of the page to read unless changing their preferences, but anonymous users can't set their user interface language and always use the wiki's default language. A page translated with this system will be in the default content language, if you don't provide anonymous users a way to select their language.

Luckily, there is a solution. With the extension it is possible to guess the user's preferred language and also to let the user manually select another language and store the choice in a cookie, with no need of tricks such as the   parameter, which is suitable mostly only for debugging.