Attention : vous consultez actuellement la documentation dédiée aux versions 1.x de Moodle. La documentation pour les versions 2.x de Moodle est consultable ici : Traduction 2.0, celle pour les versions 3.x de Moodle est consultable ici : Traduction 2.0 et celle pour Moodle 4.x est consultable là : Traduction 2.0.

Remarque : la traduction de cet article n'est pas terminée. N'hésitez pas à traduire tout ou partie de cette page ou à la compléter. Vous pouvez aussi utiliser la page de discussion pour vos recommandations et suggestions d'améliorations.


Remarque : cet article est en cours de rédaction. N'hésitez pas à le compléter. Veuillez utiliser la page de discussion pour vos recommandations et suggestions d'améliorations.


Moodle2.0


Moodle 1.x

Le texte ci-dessous décrit le processus de traduction de Moodle pour les versions 2.0 et ultérieures. Pour Moodle 1.x, veuillez consulter la page Traduction.

Résumé des modification depuis Moodle 1.x

  • Les traductions ne sont plus gérées dans le CVS. Elles sont stockées dans une base de données sur http://lang.moodle.org
  • Une application web est utilisée pour le processus de traduction
  • Tous les plugins définissent maintenant leurs chaînes de caractères dans leur propre dossier, y compris les plugins officiels, comme c'était déjà le cas pour les plugins contribués par des tiers
  • Le nom des dossiers des paquetages de langue ne comportent plus le suffixe _utf8
  • Les fichiers d'aide HTML ont été remplacés par des chaînes de caractères d'aide dont l'identifiant comporte le suffixe _help
  • Les paramètres pour variables doivent être entourés d'accolades, par exemple {$a} ou {$a->blabla}
  • Il n'y a plus besoin de placer une barre oblique inversée avant les guillemets droits dans les chaînes de caractères

Structure d'un paquetage de langue pour Moodle 2.x

La distribution standard de Moodle ne comporte que le paquetage de langue anglais. Tous les autres paquetages doivent être ajoutés manuellement à votre installation. Les chaînes en anglais pour le coeur de Moodle, c'est-à-dire ses sous-systèmes principaux (administration, carnet de notes, rôles, etc.) se trouvent dans le dossier lang/en de la distribution de Moodle. Par exemple, les chaînes concernant l'évaluation des activités sont définies dans le fichier lang/en/grades.php. Les chaînes de caractères de tous les autres composants de Moodle (modules d'activité, blocs, plugins d'inscription, etc.) se trouvent dans un dossier lang/en situé dans le dossier du composant concerné. Par exemple, les chaînes du module Atelier se trouvent dans le fichier mod/workshop/lang/en/workshop.php.

Les traductions sont situées dans le dossier de données moodledata de Moodle, dans le sous-dossier lang. Par exemple, la traduction en italien se trouve dans le dossier lang/it/. Les traductions de tous les composants préinstallés (coeur et plugins) y sont stockées. La traduction française du module Atelier est par exemple stockée dans moodledata/lang/fr/workshop.php et celle des chaînes concernant l'évaluation des activités dans moodledata/lang/fr/grades.php (notez la différence par rapport aux chaînes de caractères du paquetage anglais).

Les fichiers de langue ont tous l'extension .php (comme moodle.php ou admin.php). Ces fichiers contiennent de brèves expressions ou phrases, appelées chaînes de caractères ou simplement chaînes. Les chaînes contiennent parfois des paramètres pour la substitution de variables. Ces paramètres sont remplacés par certaines valeurs lorsque la chaîne est affichée. Les chaînes sont stockées dans un tableau PHP dénommé $string. La clef du tableau est appelée identifiant de la chaîne ou nom de la chaîne. Exemples :

$string['addnewcourse'] = 'Ajouter un cours';
$string['hidesection'] = 'Cacher la section {$a}';
$string['uploadedfileto'] = '{$a->file} déposé dans {$a->directory}';

La définition de ces chaînes est utilisée par la fonction get_string() pour être affichée (voir lib/moodlelib.php). Si une chaîne n'est pas traduite dans une langue, Moodle essaie de la trouver une langue dite parente. S'il n'y a pas de langue parente définie pour cette langue ou que la langue parente ne définit pas non plus la chaîne, c'est le texte anglais qui est alors utilisé automatiquement.

Installation language packs may be found in the install/lang folder. These language packs contain only the strings needed for the installation process. The files are generated automatically and must not be changed manually. For translators this is a unusual experience, since changes you add to the strings used in the installation script will not be visible until our script is run and commits them into Moodle sources.

Using the AMOS translation tool

Just quick notes for now, to be elaborated more - please help to improve this documentation.

Language pack maintainers can create an account at http://lang.moodle.org and email translation@moodle.org (Koen) to get their account activated for working for their language.

AMOS provides support for community contributions into the translation. If you want to participate, just create an account at http://lang.moodle.org. There is no need to contact Koen in this case but you should definitely contact the language maintainer and coordinate your work.

Basic concepts

AMOS consists of several tools available via the main navigation block - Translator, Stage, Stashes and Log.

  • Translator - is a tool that allows you to filter strings you want to work on and translate them
  • Stage - is a temporary are that holds the strings you have translated during the current session
  • Stashes - are snapshots of the stage. Imagine them as ordinary files at your computer where you can save your work. You can share your stash with the language pack maintainers via so called pull request.
  • Repository - a database of all Moodle strings and their history running at lang.moodle.org server
  • Log - displays the log of all modifications of Moodle strings.

Fichier:amos-workflow.png

Using Translator

Use the Translator filter to show strings you want to work on. You have many options of filtering. You can work on a single component or all missing strings at once. You can search for strings containing a given text (either in English or the translated string) etc. You can check for strings in older versions, too but those strings are read-only. They get automatically pulled into AMOS from the CVS repository.

Click the Translation field to turn it into editable field and put the translation there. Click outside the field to stage your translation.

Using Stage

The translated strings are put into a temporary area called stage immediately after the cursor leaves the editor field. The stage holds your work before it is either committed into the repository (if you are language pack maintainer) or is stashed and offered to the maintainers for inclusion.

The stage is destroyed when you logout. You have to explicitly commit or stash the stage so it is saved permanently. If you forget to do it, or there is a problem with the connectivity, your browser crashes or whatever, you can find your most recent snapshot of the stage in AUTOSAVE stash.

If you are language pack maintainer, you can commit the stage into the repository so your work is registered and the translated strings become part of the official language package. Language packages in ZIP format are generated every hour (at 45 mins) and are published at http://download.moodle.org/langpack/2.0/. At the same time, they become available for Moodle sites for automatic update.

Using Stashes

At any moment, you can save a snapshot of the current stage. We call such snapshot a stash. Stashed strings are kept forever until you drop them manually (please do not abuse this and keep your stashes reasonable big). The stash can be applied so that the stashed strings are copied back to the stage.

Your stash can be also offered to the official language pack maintainers for inclusion into the repository. Once you have a bulk of translation finished in your stage, just stash it and create pull request. This will mark the stash as available for the maintainers and they will be able to apply it into their stage, review your work and eventually commit it. Please note that the maintainers are not sent any notification on new pull requests (this is intentional to prevent spamming). Just use either Moodle messaging subsystem or direct email to inform the maintainer about the pull request. We believe that all contributors should be in contact with the official maintainer anyway and AMOS should not try to replace this kind of communication.

Your pull request is available to the maintainers of all languages that your stash modifies. Once you receive a confirmation from the maintainers that your work has been accepted, you should drop the offered stash.

There is one special stash record for every user called AUTOSAVE. This stash keeps the most recent state of the stage. You may find it useful if you loose the current stage for any reason - your browser crashes, your internet connectivity dies or you accidentally unstage all strings. If that happens, just apply the AUTOSAVE stash to get your work back. The AUTOSAVE stash is updated every time you stage a string. So if your stage is empty and your AUTOSAVE is full of strings and you go into the Translator first without applying the stash, the AUTOSAVE will be replaced with the new translated string. We recommend to experiment a bit with this feature first.

Using Log

This tool is not fully implemented yet. There will a filter that will allow to search for string modifications in a similar manner as in the Translator filter.