Difference between revisions of "Translation for developers/fr"

From Kiwix
Jump to navigation Jump to search
(Created page with "=== Trouver une chaîne à localiser ===")
(Created page with "Cherchez dans les fichiers *.xul et *.js pour trouver des chaînes codées en dur.")
Line 33: Line 33:
=== Trouver une chaîne à localiser ===
=== Trouver une chaîne à localiser ===


Go through the *.xul and *.js files to find hardcoded strings (in English).
Cherchez dans les fichiers *.xul et *.js pour trouver des chaînes codées en dur.


If you find one you need to find a string identifier (foobar for example), have a look to the already localized string to see how it should look like. The most important to know is that in the *.xul files, it should look like "&foobar;" and in the *.js like "getProperty('foobar')".
If you find one you need to find a string identifier (foobar for example), have a look to the already localized string to see how it should look like. The most important to know is that in the *.xul files, it should look like "&foobar;" and in the *.js like "getProperty('foobar')".

Revision as of 17:05, 23 May 2020

Other languages:
Bahasa Melayu • ‎English • ‎català • ‎español • ‎français • ‎galego • ‎italiano • ‎magyar • ‎português • ‎русский • ‎日本語

En dehors de la partie Special:MyLanguage/traduction, le code source de Kiwix doit être synchronisé avec Translatewiki

Cette synchronisation avec Translatewiki a besoin de trois opérations:

  • Ajouter une chaîne entre Kiwis et Translatewiki, cad ajouter une chaîne dynamique qui sera remplacée par la traduction correspondante lors de l'exécution.
  • Mettre à jour les chaînes Kiwix avec les traductions venant de Translatewiki
  • Ajouter une nouvelle traduction complète de Translatewiki sur Kiwix

Prérequis

Vous avez besoin d'un système d'exploitation GNU/Linux. Il est possible de le faire dans un autre système d'exploitation, mais il bien plus compliqué d'obtenir un environnement fonctionnel.

Vous devez garder plusieurs chose en tête:

  • Les fichiers de traduction de Kiwix se trouvent tous dans le dossier kiwix/chrome/locale
  • Il y a deux types de fichiers de traduction pour traduire l'interface utilisateur (Jetez un oeil aux fichiers *.js et *.xul dans kiwix/chrome/content/main pour en comprendre le fonctionnement):
    • "main.dtd" fournit les traductions pour tous les fichiers *.xul
    • "main.properties" fournit les traductions pour touts les fichies *.js
  • Les traduction Translatewiki sont importées séparément dans le dépôt de code Kiwix une fois par semaine ; nous avons toujours besoin de synchroniser ces fichiers avec le code de Kiwix dans les deux direction (KW->TW et TW->KW)

ATTENTION: avant toute modification dans le code source de Kiwix, mettez à jour chacun de vos dépôts locaux avec "git pull origin master".

Extraction du code et démarrage de Kiwix

Avant de commencer à travailler sur l'intégration de nouvelles chaînes dans le code Kiwix, il est préférable de compiler Kiwix:

  • Prenez le code instable
  • Compilez le
  • Exécutez-le en allant dans le dossier kiwix et lancez "kiwix"

Remarque: Si vous n'arrivez pas à compiler Kiwix, ou n'avez pas de xulrunner disponible (c'est par exemple le cas pour Ubuntu Oneirix et au delà), vous pourrez toujours démarrer kiwix et obtenir une interface bien que l'application ne fonctionnera pas correctement ; cela sera cependant suffisant pour manipuler les fichiers XUL. Dans ce cas vous devrez effectuer quelques opérations supplémentaires telles qu'ajouter "MaxVersion=42" comme nouvelle ligne de au fichier kiwix/application.ini et lancer Kiwix en utilisant la commande suivante dans la console (depuis le dossier "kiwix"): "firefox -app application.ini".

Ajouter une chaîne aux traductions

Trouver une chaîne à localiser

Cherchez dans les fichiers *.xul et *.js pour trouver des chaînes codées en dur.

If you find one you need to find a string identifier (foobar for example), have a look to the already localized string to see how it should look like. The most important to know is that in the *.xul files, it should look like "&foobar;" and in the *.js like "getProperty('foobar')".

Translate it in the master language English

You will need to do that on two places. First in the "kiwix/chrome/locale/en/main/" main.dtd or main.properties files. In that way the Kiwix application knows what to display if the user interface language is English.

Update Translatewiki files

But you also need to tell Translatewiki to add this string in the list of string it has to provide (for the Translatewiki translators) to translate. For that you need to checkout another part of Kiwix code repository. Please run outside of your local kiwix code directory following console command:

git pull origin master

You have now on your computer the translatewiki translations. What you need is only to update the "en" file which is the master language file for Translatewiki. So simply add your new string following the examples of other already inserted strings and commit your "en" file.

Someone from Translatewiki check each week the "en" file for new strings and synchronized Translatewiki with this file if necessary.

Create stub translation of you new string for all languages

The last thing you need to do is creating stub translation of your new localized string for all supported user interface languages in Kiwix. If you don't do that, Kiwix won't be able to work correctly in a language other than English.

For that purpose you need to use the TW2PL.pl script (this is a perl script, so perl needs to be installed) like following (go in the translatewiki file directory):

./TW2KW.pl --path=/full/path/to/the/kiwix/code/directory --allLanguages=kw

Commit the new Kiwix translation files

Now, all the locale file in kiwix/chrome/locale should be updated and you should have a lot of (modified) files listed by typing:

git status kiwix/chrome/locale

After checking everything is OK, you can commit your modifications: ie. the kiwix/chrome/locale directory and the *.xul and/or *.js files you have modified.

Update Kiwix translations

Another task is to update already supported Kiwix languages with the last strings updated coming from Translatewiki. The first thing to know about that is that in the remote subversion repository, the Translatewiki file (in maintenance/translatewiki) is updated every two weeks from a Translatewiki contributors. That means, you only need to update your local repository and update and commit the kiwix code translation files like this:

cd /full/path/to/the/kiwix/maintenance_tools/translatewiki
./TW2KW.pl --path=/full/path/to/the/kiwix/code/directory --allLanguages=kw
git commit /full/path/to/the/kiwix/code/directory/kiwix/chrome/locale
git push origin master

The full path should be the moulinkiwix directory, not the kiwix directory in it.

Add a new supported language to Kiwix

Kiwix tries to add only 100% translated languages coming from Translatewiki. So it happens often that there are more languages in the "maintenance_tools/translatewiki" directory than in the "kiwix/kiwix/chrome/locale" directory. In such a case, that simply means the Translatewiki language was still not integrated in Kiwix code base. We explain now how to do that.

First of all you need to create the translation files in a new directory at "kiwix/kiwix/chrome/locale/your_language_iso_code" like this:

./TW2KW.pl --path=/full/path/to/your/kiwix/code/base/directory/ --language=your_language_iso_code

After that, you need go to the Kiwix source code directory in "kiwix/chrome" and edit with your preferred text editor the "chrome.manifest" and "chrome.manifest.prod" files. No explanation here, just do like for the already supported languages.

Next edit chrome/content/main/js/languages.js and here also add the new languages.

Now update CHANGELOG and make a notice about the addition of the new supported languages.

Add the new language directory and commit like this:

git add kiwix/chrome/locale/language_iso_code
git commit CHANGELOG kiwix/chrome/chrome.manifest kiwix/chrome/chrome.manifest.prod kiwix/chrome/locale/ kiwix/chrome/content/main/js/gui.js
git push origin master

Voir aussi