Translating RawTherapee/fr

From RawPedia
Revision as of 19:46, 7 October 2019 by Lebarhon (talk | contribs) (→‎Introduction: updated)
Jump to navigation Jump to search

Cet article explique comment vous pouvez aider à traduire l'interface de RawTherapee.

Introduction

L'interface graphique utilisateur de RawTherapee contient du texte en de nombreux endroits. Dans le but d'autoriser l'affichage de ce texte en langues variées, le code ne contient que des clés et chaque fois qu'un texte doit être affiché, le code recherche le texte correspondant à cette clé dans un fichier texte de traduction paire clé-valeur correspondant à la langue sélectionnée par l'utilisateur (ou auto-détectée par RawTherapee d'après le paramétrage). Lorsqu'une clé est trouvée dans le fichier de traduction, elle est remplacée par la valeur correspondante. Si elle n'est pas trouvée, la valeur correspondant à l'anglais est utilisée en saufconduit.

Le fichier qui contient les paires clé-valeur de référence est appelé default. Il utilise l'anglais américain. Toutes les traductions sont basées sur ce fichier. Chaque fois qu'une clé n'est pas trouvée dans une traduction, c'est la clé de ce fichier qui est utilisée.

Les fichiers de traduction sont placés dans /rtdata/languages.

De temps à autres nous exécutons le script /tools/generateTranslationDiffs qui met à jour chaque fichier de traduction avec les nouvelles clés du fichier default. Si une nouvelle paire clé-valeur est ajoutée à default, le script copie cette paire dans le fichier de traduction si elle n'existe pas, et puisque la valeur a ce niveau est en anglais, il préfixe cette ligne avec un point d’exclamation. Lorsque RawTherapee recherche une chaîne de caractères traduite, il ignore les lignes préfixées avec un point d'interrogation. Lorsque quelqu'un traduit cette valeur, il doit enlever ce point d'interrogation afin qu'elle ne soit plus ignorée.

Un inconvénient du système est que si la valeur d'une clé dans le fichier default est modifiée et cette entrée à déjà été traduite, alors la traduction devient obsolète et cette situation n'est pas repérée. Pour cette raison, les personnes assurant la maintenance d'une traduction doit garder un œil sur les modifications apportées aux valeurs existantes dans default et mettre à jour leurs traductions. Une façon de garder un oeil sur ces modifications est de vérifier les commits dans git qui affectent ce fichier.

Utilisons en exemple l'étiquette "Compensation d'exposition" :

  • La clé utilisée par le code est TP_EXPOSURE_EXPCOMP.
  • Le fichier default contient la paire clé-valeur :
    TP_EXPOSURE_EXPCOMP;Exposure compensation
  • Le fichier English (US) contient la même paire, mais préfixée par un point d'exclamation :
    !TP_EXPOSURE_EXPCOMP;Exposure compensation
  • Les traductions devraient contenir la clé avec la valeur traduite et le point d'exclamation enlevé, par ex :
    TP_EXPOSURE_EXPCOMP;Compensation d'exposition

How To

  1. Check whether there is an existing translation file of the language into which you're interested in translating by looking into /rtdata/languages
    • If one does not exist, download the English (US) file (right-click the "Raw" button and "Save link as"), then rename it into your language - let's call it Inuktitut for the purpose of this article.
    • If there is one, download it (right-click the "Raw" button and "Save link as").
  2. Translate new strings.
    Open Inuktitut in a modern text editor (Windows users: do not use "Notepad", get Notepad++ instead). All the strings that need translating are on lines that begin with an exclamation mark, you will find them at the end of the file if you're updating an existing translation. Translate them, and remove the exclamation mark prefix from each translated line.
    As an example, you would translate
    !TP_EXPOSURE_EXPCOMP;Exposure compensation
    to
    TP_EXPOSURE_EXPCOMP;Lorem ipsum
  3. Update existing strings
    If your Inuktitut file has already been translated a long time ago, chances are that some of the translated parts are out of date. To update them, open the latest default file in a window covering the right half of your screen, open Inuktitut in a window covering the left half of your screen, then go through each already-translated string in Inuktitut, compare it to the English string in default, and update the translation if it no longer matches the English string.
  4. When done translating, open a new issue in GitHub and attach your translation to it. Please do not create patch files of translations, just send us the whole translated file. We will then run it through the /tools/generateTranslationDiffs script which will sort the entries, add new keys, and delete ones which are no longer used. We will then commit it to the codebase.
  5. When you want to update your translation in the future, you must download the latest version of that file from the repository from /rtdata/languages

Markup

Some lines have elements which should appear in bold or italics, or have characters which must be written in a special way. This is accomplished using markup. However, parsing markup is slightly slower than parsing plain text, so RawTherapee only supports markup on keys which we know to require it. That means that if you use markup on keys which do not support it, then those keys will not display correctly. Always stick to the style used in default. If a key in default does not use markup then neither should your translation.

When a key uses markup, certain characters must be written using their HTML character entity reference name:

  • Write < using &lt;
  • Write > using &gt;
  • Write & using &amp;

How to know when markup is needed? Look at default. For example:

  • HISTORY_MSG_251;B&amp;W - Algorithm uses markup to display the & character, and so should your translation.
  • PARTIALPASTE_RAWCACORR_CAREDBLUE;CA red & blue does not use markup to display the & character, and neither should your translation.
  • FILEBROWSER_EMPTYTRASHHINT;<b>Permanently</b> delete all files in trash. uses markup to make the word "Permanently" appear in bold when displayed in RawTherapee, and so should your translation.