Help:Extension:Translate/Group configuration example/nl

Deze handleiding is voor ontwikkelaars en beheerders van geavanceerde vertalingen. Deze handleiding beschrijft hoe u nieuwe configuratie bestanden kunt aanmaken voor het vertalen van interfaceberichten, met praktische details. Het dient samen met het handboek voor de groepsconfiguratie te worden gebruikt, de ontwikkelaars van de extensie willen u graag helpen bij vragen die u heeft bij het werken met deze handleiding.

Vereisten

 * de extensie Translate en
 * deze.
 * deze.

Deze tutorial is gebaseerd op de extensie versie r97948 (2011-09-23).

Deze tutorial beschrijft het inschakelen van het vertalen voor enkele delen van het project MyBB. Maar de stappen zullen voor andere projecten niet zo verschillen. Enkele zaken zijn specifiek voor translatewiki.net en u zou natuurlijk moeten gebruiken wat voor u dan relevant is, volg dus niet blind de hier beschreven stappen.



Stap 1: Bekijk de broncode
Laten we de MyBB source controleren met gebruik van  als werkmap, in dit voorbeeld is dat.

Nu moeten we de bestanden met de berichten vinden. Deze staan in de submap, u vindt de Engelse berichten in de submap.

Laten we beginnen met , het eerste vertaalbestand van ons project.



Stap 2: Ondersteuning bestandstypes
In onze MediaWiki submap installation, onder  en    kunnen we de classes dien voor het ondersteunen van bestandstypes, die voor berichtgroepen worden gebruikt voor de vertaalbestanden per project. Na wat zoeken, ziet u welke formaten worden ondersteund. Dus we proberen om de FlatPhpFFS class te gebruiken om te kijken hoe dat werkt met ons PHP-bestand.

Dus we hebben een bestand te koppelen en daarvoor hebben we de class FFS uitgezocht. Nu moeten we een groepsconfiguratie maken. Dat is een YAML bestand.

In de kunt een link vinden voor de. We beginnen het bestand dat als voorbeeld staat in de sectie BASIC.

We passen de voorbeeldtekst aan met onze eigen waarden.

De beschrijving accepteert de gehele wikitext syntaxis. In het orginele  voorbeeld staat een mooi foefje voor het vertaalbaar maken door het gebruiken van. U moet dan de standaardtekst definiëren in de pagina MediaWiki:Message-key. De ID van de namespace wordt toegevoegd met de constante, zie: Hoe aangepaste namespaces te gebruiken.

We need one more thing: the  section. Again starting from the example provided in the documentation:

Hmm,  is the language code, like   by default. For now, we do not want to change the directory structure used by MyBB. Instead we can use a feature designed for this purpose: the code map, which allows us to map language codes of each language to the identifiers used by our project.

Dus we eindigen met:

Basically this says that for code, the   in above will be  , which is the directory for the English message files. The key  is usually the same as , but without the   prefix.

Good. Now let's save this file somewhere, for example to the same folder where is stored, with name. The whole file is:

Then we must tell our extension to read that file. Add the following line to :

After doing this, follow the instructions at to run the   script.

So let's log in, make sure the user has the "translate-manage" right configured properly, and go to Special:ManageMessageGroups.

You may see this:

No valid namespace defined, got NS_MYBB. Backtrace: <...>

In this case, reading the documentation carefully, you could have identified the need to add the following line to  to register the new namespace with MediaWiki:

In this example 1246 is used, but you can pick any free namespace number you need. For the Translate extension, we recommend you to use the even namespace numbers 1200-1298.

If you now reload the ManageMessageGroups special page, you should see a line which says:

MyBB This message group has not been imported previously.

Click on the MyBB link. After that, you will see the list of messages that are in that file. If you are happy with the results, click "Execute".

After you click "Execute", the file is processed and you will see an output similar to this:

Imported new version of page MyBB:L\x5b'boardstats'\x5d/en. Imported new version of page MyBB:L\x5b'new posts'\x5d/en. Imported new version of page MyBB:L\x5b'no new posts'\x5d/en. ... Cache rebuild. All done!

If the file is very large, you need to run  first, because the web interface can only import a limited number of messages at once because of the PHP timeout limit; if you encounter this limit, you can click a button at the bottom of the page to import the remaining messages.



Stap 3: Een bestand toevoegen
Now let's add a second file for MyBB for translation. There are two ways to do this:



Benadering 1: Een YAML-bestand toevoegen
Simply add a new YAML file and save it with a new name. Then call it from inside  and follow all the above steps. The file will look something like this:

As obvious in the above example, you have to use a different ID for this new group.

While easy, this approach does not scale to hundreds of different translation units (i.e. files mapped to their message group). At some point you need to update some value, and doing it for all those files is no fun. Fortunately there is another way, shown below.



Benadering 2: TEMPLATE syntaxis
The idea is that we pull common values into a template. Then each group will take missing values from the template and there is no need to repeat them for every group.

Let's get back to MyBB example. Let's say you want to include,   and   in the translatable messages. The YAML file needs to be updated like this:

As obvious in the above example,  is defined only once; addition and removal of files is as easy as adding or removing a section in the above file.

Now if you go to the ManageMessageGroups special page, you will see three items like this:

MyBB global messages: This message group has not been imported previously. MyBB index page: This message group has not been imported previously. MyBB show thread: This message group has not been imported previously.

If there are a lot of files to be included in your project, it may be a good idea to write a script that generated your YAML file for you. An example can be found in trunk/translatewiki/StatusNet/genStatusNet-plugins.php.



Stap 4: Groep samenvoegen
Adding an aggregate group and defining the message files as its subgroups has two benefits:


 * Less work for translators to select different message groups, in particular for maintenance work. Translators can simply open the aggregate group and translate or update everything that needs updating or translation for all the groups.
 * Statistics can be reported on the aggregate group level, i.e. whole project.

In order to define an aggregate group, you need to add the following section right after the TEMPLATE section and before the definition of individual subgroups:

This gets us pretty close, but there is still one step missing. At this point, if you go to Special:Translate, you will see the MyBB parent group (and it in fact works!) but also the subgroups listed as separate groups. :(

This is the way to fix it. Add the following line to your :



This takes all groups whose id match the given pattern, shows the first group, and hides everything else below that first group. A bit ugly, but it works. This construction only supports two layers, even though aggregate groups can be part of aggregate groups.

If you go to Special:Translate now, you will only see the parent group MyBB listed. Additionally, you will see a link "Show 3 subgroups"; clicking on that will show you the names of subgroups.

Check out the manual for TAGS and other sections we didn't go through in this document.



Stap 5: Opschonen
YAML files of projects supported by translatewiki.net are committed to the repository on Git.

In translatewiki.net, the  lines are actually in. Sandboxwiki at translatewiki.net does not have a  file, which is why we added everything in.