Help:Extension:Translate/Translation aids/nl

Vertaal hulpmiddelen zijn modules die bruikbare en nodige informatie geven aan een vertaler bij het vertalen. Verschillende hulpmiddelen kunnen suggesties geven uit het vertaalgeheugen, machine vertaling, documentatie over het bericht of zelfs uit zoiets eenvoudigs als de definitie van het bericht, de tekst die vertaald moet worden.

Er is wat overlap tussen de gegevens die berichtengroep en de hulpmiddelen aanleveren, maar de regel is dat de berichtengroep alleen de informatie geeft om aan te geven in de lijst met welke berichten vertaald moeten worden: definitie, status van de vertaling, laatste vertaler (men kan alleen vertalingen beoordelen als men die niet zelf heeft vertaald) enz.

De extensie Translate heeft veel classes om het vertalen te ondersteunen. Elke class die de class TranslationAid uitbreidt hoef alleen een methode  te maken. Die moet dan de gegevens in een genest array gestructureerd teruggeven. Deze modules kunnen direct via PHP worden aangeroepen of via de WebAPI.



Hoe vertaalhulpmiddelen te gebruiken
Een voorbeeld om de documentatie van een bericht op te halen, indien beschikbaar. 

Hoe de vertaal API te gebruiken
As already seen above, translation aids are available via a WebAPI, which is using the MediaWiki WebAPI framework. Getting translation aids is as simple as doing HTTP GET for the URL http://translatewiki.net/w/api.php?action=translationaids&title=MediaWiki%3AJan%2Fde. It provides various different formats, but JSON and XML are the most popular ones. This API does not need authentication, but some translation aids like "inotherlanguages" uses user preferences to determine which languages to use. To use that aid you should log in first, as described in the MediaWiki WebAPI documentation.

The returned data should look like this (shown in pretty json format): Every requested aid is guaranteed to have a key here (until the request fails miserably), but while we use exceptions in the PHP side, in the JavaScript side each aid may have the key "error" set with the error message set as value. You can see an example of this above with. It signals that it cannot display a diff, because there have been no changes to the definition since last translation.



JavaScript voorbeeld
Here is the same thing for JavaScript. By default the API returns all aids, but you can request specific ones with the  param. In the example we are using jsonp to work around cross site request limitations. Be aware that you cannot execute any write actions with jsonp, so if you are using this API from JavaScript you will need: to have a proxy; to run the script on the same host; or to load a little helper (not yet implemented) from the target site. 

Naamconventies en returnwaarden
Each translation aid has a unique string identifier. Identifiers should avoid special characters, especially those which are not valid in JavaScript identifiers, like  and.

The array that is returned by each translation aid is up to the developer, but should follow some general recommendations.

If only one text value is returned, it should use  as the key of the field. Language should be provided in field. Users of this data should ensure that in HTML and elsewhere the text is tagged properly with the provided language and directionality (not provided here). If there is HTML output, it should be available with key. Examples of this are message documentation and diffs.

Various kinds of translation suggestions like machine translation and translation memories should use these keys when they make sense:


 * ,  and   (target language is implicitly the same as the language of the translation)
 * : identifier of the service used
 * : value in range [0,1], higher value means that the quality of the suggestions is very good.

List of standard aids
[field] Means that the return value is a list. In PHP that means array with numerical indexes + one with key ; see above why this is needed.