Introduction.
Certaines parties de pywws peut être configurées pour utiliser votre langue locale en lieu de l’Anglais Britanique. Ceci requière un fichier de langage contenant la traduction des différentes phrases utilisées par pywws. Le projet repose sur les utilisateur qui fournissent ces traductions. Ce document décrit comment créer un fichier de langage.
The pywws documentation can also be translated into other languages. This is a lot more work, but could be very useful to potential users who do not read English very well.
Prérequis.
En plus du logiciel pywws vous devez installer le paquet utilitaire GNU d’internationalisation ‘gettext’. Celui-ci est disponible dans la plupart des dépôts standard des distributions Linux, ou vous pouvez le télécharger à partir de http://www.gnu.org/software/gettext/ si vous devez le compiler vous même.
Choisir votre code de langage.
Les ordinateur utilisent les étiquettes d’identification de langues IETF (voir http://fr.wikipedia.org/wiki/%C3%89tiquette_d%27identification_de_langues_IETF). Par exemple, la Grande-Bretagne utilise ‘en_GB’ qui est composé de 2 parties: ‘en’ pour Anglais, et ‘GB’ la version Britanique. Pour trouver le code correspondant à votre langue, consultez la liste sur http://www.gnu.org/software/gettext/manual/gettext.html#Language-Codes.
Démarrage.
Your pywws directory should already have a subdirectory called translations. This contains the existing set of language files, for example ‘translations/sv/pywws.po’ contains the Swedish translations. If one of these languages is what you need, then edit your weather.ini file and add a ‘language’ entry to the ‘[config]’ section, for example:
[config]
day end hour = 21
gnuplot encoding = iso_8859_1
language = sv
You may still need to compile and install your chosen language file. This is done by the ‘makefile’ included with pywws:
make lang LANG=sv
S’il n’y a pas déjà de fichier pour votre langage, le reste de ce document vous indique comment en créer un.
Créer un fichier de langage.
The ‘makefile’ included with pywws can create a file for you to fill in. For example, to create a source file for the French language (code ‘fr’):
make lang_src LANG=fr
This will ask you to confirm your email address (several times, annoyingly), then create several ‘.po’ files in the directory ‘translations/fr’. You should now edit ‘pywws.po’, filling in every ‘msgstr’ line with a translation of the ‘msgid’ line immediately above it. The reason for including your email address is to allow anyone who has questions about your translation to get in touch with you. Feel free to put in an invalid address if you are concerned about privacy.
Après avoir édité le nouveau fichier de langage, il doit être compilé pour que pywws puisse l’utiliser. Ce qui est fait aussi par le fichier makefile:
make lang LANG=fr
N’oubliez pas de faire celà à chaque fois que vous éditez un fichier de langue.
Tester la traduction pywws.
The Localisation.py module can be used to do a quick test of your language file installation:
python code/RunModule.py Localisation -t fr
This should produce output something like this:
Locale changed from (None, None) to ('fr_FR', 'UTF-8')
Translation set OK
Locale
decimal point: 23,2
date & time: lundi, 17 décembre (17/12/2012 16:00:48)
Translations
'NNW' => 'NNO'
'rising very rapidly' => 'en hausse très rapide'
'Rain at times, very unsettled' => 'Quelques précipitations, très perturbé'
Éditez l’entrée de langue dans votre fichier weather.ini pour utiliser le code de langue (ex. ‘fr’), puis essayer d’utiliser Plot.py pour dessiner un graphe. L’axe des X du graphe devrait maintenant être étiquetté dans votre langue, utilisant la traduction que vous avez fournis pour ‘Time’, ‘Day’ ou ‘Date’.
Envoyez le fichier de langue à Jim.
I’m sure you would like others to benefit from the work you’ve done in making a new language file for pywws. Please, please, please send a copy of your language file (for example pywws.po) to jim@jim-easterbrook.me.uk.
Mettre à jour le fichier de langue.
As pywws is extended, new strings may be added which will require your translation file to be extended as well. This is fairly easy to do. First you need to remove the language master template file, then run the ‘make lang_src’ command again:
rm translations/pywws.pot
make lang_src LANG=fr
This should add the new strings to your language file, without changing the strings you’ve already translated.
Translating the documentation.
The system used to translate the strings used in pywws can also be used to translate the documentation. The files ‘index.po’, ‘essential.po’, ‘guides.po’ and ‘api.po’ contain text strings (often whole paragraphs) extracted from the different parts of the documentation.
These files can be edited in a similar way to ‘pywws.po’. Fill in each ‘msgstr’ with a translation of the ‘msgid’ above it. Note that some strings (such as URLs) need not be translated. In these cases, leave the ‘msgstr’ blank.
Translating all of the pywws documentation is a lot of work. However, when the documentation is ‘compiled’ any untranslated strings revert to their English original. This means that a partial translation could still be useful - I suggest starting with the documentation front page, ‘index.po’.
Commentaires ou questions? SVP, souscrivez à la liste d’envoi de pywws http://groups.google.com/group/pywws et laissez-le nous savoir.