From 153d8d446603250085b384fda1a08e6a7267c7d7 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Jan 2012 19:12:03 +0100 Subject: Setup.py now generate locales --- setup.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index bf109e5..7847163 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,9 @@ #!/usr/bin/env python import os +import sys +import glob +import subprocess from distutils.core import setup @@ -12,21 +15,33 @@ from mat import mat if os.path.exists('MANIFEST'): os.remove('MANIFEST') + +def l10n(): + ''' + Compile .po files to .mo + ''' + for language in glob.glob('locale/*'): + fpath = os.path.join(language, 'LC_MESSAGES', 'mat-gui.po') + output = fpath[:-2] + 'mo' + subprocess.call(['msgfmt', fpath, '-o', output]) + yield output + setup( name = 'MAT', version = mat.__version__, description = 'Metadata Anonymisation Toolkit', - long_decription = 'A Metadata Anonymisation Toolkit in Python, using python-hachoir', + long_description = 'A Metadata Anonymisation Toolkit in Python, using python-hachoir', author = mat.__author__, author_email = 'julien.voisin@dustri.org', - platforms = 'linux', + platforms = 'linux', license = 'GPLv2', url = 'https://mat.boum.org', packages = ['mat', 'mat.hachoir_editor', 'mat.bencode', 'mat.tarfile'], scripts = ['mat-cli', 'mat-gui'], data_files = [ - ( 'share/applications', [ 'mat.desktop' ] ), + ( 'share/applications', ['mat.desktop'] ), ( 'share/mat', ['FORMATS'] ), ( 'share/doc/mat', ['README', 'TODO'] ), + ( 'share/mat/locale/', [i for i in l10n()] ), ], ) -- cgit v1.3 From 2481c04480e594f385945dcab6822b2b4f227f34 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Jan 2012 19:12:15 +0100 Subject: Mat's can now be localised ! --- mat-gui | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/mat-gui b/mat-gui index 380e4d8..7561dd0 100755 --- a/mat-gui +++ b/mat-gui @@ -262,11 +262,11 @@ data loss, but clean more efficiently')) if response is 0: # gtk.STOCK_OK filenames = chooser.get_filenames() - task = self.__populate(filenames) + task = self.populate(filenames) gobject.idle_add(task.next) # asynchrone processing chooser.destroy() - def __populate(self, filenames): + def populate(self, filenames): ''' Append selected files by add_file to the self.liststore ''' @@ -461,7 +461,7 @@ non-anonymised) file to output archive')) ''' urls = selection.data.strip('\r\n\x00') # strip stupid characters cleaned_urls = map(self.__clean_draged_file_path, urls.split('\n')) - task = self.__populate(cleaned_urls) + task = self.populate(cleaned_urls) gobject.idle_add(task.next) # asynchrone processing def __clean_draged_file_path(self, url): @@ -676,11 +676,27 @@ class TreeViewTooltips(object): name = model[path][0] return name.file.filename + +def translate(): + '''' + Handle L10N of mat-gui + ''' + # get system's language + current_lang, _ = locale.getdefaultlocale() + if current_lang: + langs = [current_lang] + + # get the $LANG environnement's variable + language = os.environ.get('LANG', None) + if language: + print language + langs += language.split(':') + + return gettext.translation('mat-gui', 'locale', langs, fallback=True).ugettext + + if __name__ == '__main__': - #Translations - t = gettext.translation('gui', 'locale', fallback=True) - _ = t.ugettext - t.install() + _ = translate() #Main gui = GUI() @@ -688,7 +704,7 @@ if __name__ == '__main__': #Add files from command line infiles = [arg for arg in sys.argv[1:] if os.path.exists(arg)] if infiles: - task = gui.__populate(infiles) + task = gui.populate(infiles) gobject.idle_add(task.next) gtk.main() -- cgit v1.3 From ba3a4b531925afa9f3b65d9a2c6da97598e32a73 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Jan 2012 19:12:35 +0100 Subject: French localisation ! --- locale/fr_FR/LC_MESSAGES/mat-gui.po | 177 ++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 locale/fr_FR/LC_MESSAGES/mat-gui.po diff --git a/locale/fr_FR/LC_MESSAGES/mat-gui.po b/locale/fr_FR/LC_MESSAGES/mat-gui.po new file mode 100644 index 0000000..9a7ea11 --- /dev/null +++ b/locale/fr_FR/LC_MESSAGES/mat-gui.po @@ -0,0 +1,177 @@ +# Metadata Anonymisation Toolkit +# Copyright (C) 2011 Julien (jvoisin) Voisin " +# This file is distributed under the same license as the mat package. +# Julien (jvoisin) Voisin \n" +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: fr\n" +"Report-Msgid-Bugs-To: Julien (jvoisin) Voisin \n" +"POT-Creation-Date: 2012-01-07 00:09+0100\n" +"PO-Revision-Date: 2012-01-07 00:09+0100\n" +"Last-Translator: Julien (jvoisin) Voisin \n" +"Language-Team: Julien (jvoisin) Voisin \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: mat-gui:88 mat-gui:504 mat-gui:523 mat-gui:542 +msgid "Ready" +msgstr "Prêt" + +#: mat-gui:100 +msgid "Add" +msgstr "Ajouter" + +#: mat-gui:102 mat-gui:186 +msgid "Add files" +msgstr "Ajouter fichiers" + +#: mat-gui:106 mat-gui:206 mat-gui:498 mat-gui:519 +msgid "Clean (lossless)" +msgstr "Nettoyer (sans pertes)" + +#: mat-gui:108 +msgid "Clean selected files without possible data loss" +msgstr "Nettoie les fichiers selectionnés sans pertes possible de données" + +#: mat-gui:113 mat-gui:217 mat-gui:496 mat-gui:514 mat-gui:533 mat-gui:538 +msgid "Clean (strict)" +msgstr "Nettoyer (strict)" + +#: mat-gui:116 +msgid "Clean selected files with possible data loss, but clean more efficiently" +msgstr "Nettoie les fichiers selectionnés de manière stricte, mais des pertes de données sont possibles" + +#: mat-gui:121 mat-gui:228 +msgid "Check" +msgstr "Vérifier" + +#: mat-gui:123 +msgid "Check selected files for harmful meta" +msgstr "Vérifie si les fichiers selectionnés comportent des metadatas compromettantes" + +#: mat-gui:127 mat-gui:188 +msgid "Quit" +msgstr "Quitter" + +#: mat-gui:139 mat-gui:331 +msgid "Filename" +msgstr "Nom" + +#: mat-gui:139 mat-gui:333 +msgid "Mimetype" +msgstr "Type Mime" + +#: mat-gui:139 +msgid "State" +msgstr "État" + +#: mat-gui:140 +msgid "Cleaned file" +msgstr "Fichier nettoyé" + +#: mat-gui:185 +msgid "Files" +msgstr "Fichiers" + +#: mat-gui:191 +msgid "Edit" +msgstr "Edition" + +#: mat-gui:192 +msgid "Clear the filelist" +msgstr "Vider la liste de fichiers" + +#: mat-gui:195 mat-gui:403 +msgid "Preferences" +msgstr "Préférences" + +#: mat-gui:198 +msgid "Process" +msgstr "Traiter" + +#: mat-gui:232 +msgid "Help" +msgstr "Aide" + +#: mat-gui:233 mat-gui:361 +msgid "Supported formats" +msgstr "Formats supportés" + +#: mat-gui:235 +msgid "About" +msgstr "À propos" + +#: mat-gui:244 +msgid "Choose files" +msgstr "Choisir fichiers" + +#: mat-gui:251 +msgid "All files" +msgstr "Tout les fichiers" + +#: mat-gui:258 +msgid "Supported files" +msgstr "Fichiers supportés" + +#: mat-gui:301 +msgid "unknow" +msgstr "inconnu" + +#: mat-gui:311 +msgid "Not-supported" +msgstr "Non-supporté" + +#: mat-gui:348 +msgid "This software was coded during the GSoC 2011" +msgstr "Ce logiciel fût forgé lors du GSoC 2011" + +#: mat-gui:350 +msgid "Website" +msgstr "Site internet" + +#: mat-gui:414 +msgid "Force Clean" +msgstr "Forcer le nettoyage" + +#: mat-gui:417 +msgid "Do not check if already clean before cleaning" +msgstr "Ne pas vérifier si un fichier est propre avant le nettoyage" + +#: mat-gui:421 +msgid "Backup" +msgstr "Sauvegarde" + +#: mat-gui:424 +msgid "Keep a backup copy" +msgstr "Conserve une copie de sauvegarde" + +#: mat-gui:427 +msgid "Add unsupported file to archives" +msgstr "Ajoute les types de fichiers non-supportés aux archives" + +#: mat-gui:431 +msgid "Add non-supported (and so non-anonymised) file to output archive" +msgstr "Ajoute les types de fichiers non supportés (et donc, non-traités) aux archives produites" + +#: mat-gui:495 +#, python-format +msgid "Checking %s..." +msgstr "Vérifie %s..." + +#: mat-gui:500 +msgid "dirty" +msgstr "compromettant" + +#: mat-gui:513 mat-gui:532 +#, python-format +msgid "Cleaning %s..." +msgstr "Nettoie %s..." + +#: mat-gui:531 +#, python-format +msgid "Cleaning (strict) %s" +msgstr "Nettoie de manière stricte %s..." -- cgit v1.3 From bcd26f69c597309975770ee4d9f5947a17d14ef6 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Jan 2012 19:13:12 +0100 Subject: Remove old french localisation file --- locale/fr/LC_MESSAGES/gui.po | 180 ------------------------------------------- 1 file changed, 180 deletions(-) delete mode 100644 locale/fr/LC_MESSAGES/gui.po diff --git a/locale/fr/LC_MESSAGES/gui.po b/locale/fr/LC_MESSAGES/gui.po deleted file mode 100644 index 2d5de00..0000000 --- a/locale/fr/LC_MESSAGES/gui.po +++ /dev/null @@ -1,180 +0,0 @@ -# Copyright (C) 2011 julien (jvoisin) voisin -# This file is distributed under the same license as the whole package. -# julien (jvoisin) voisin , 2011 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: julien (jvoisin) voisin \n" -"POT-Creation-Date: 2011-08-22 19:52+0200\n" -"PO-Revision-Date: 2011-08-22:GTM+2\n" -"Last-Translator: julien (jvoisin) voisin \n" -"Language-Team: French \n" -"Language: Francais\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: mat-gui:83 mat-gui:459 mat-gui:476 mat-gui:493 -msgid "Ready" -msgstr "Prêt" - -#: mat-gui:95 -msgid "Add" -msgstr "Ajouter" - -#: mat-gui:97 mat-gui:179 -msgid "Add files" -msgstr "Ajouter fichiers" - -#: mat-gui:101 mat-gui:199 mat-gui:453 -msgid "Clean (lossless)" -msgstr "Nettoyage (sans pertes)" - -#: mat-gui:103 -msgid "Clean selected files without data loss" -msgstr "Nettoie sans pertes possibles de données" - -#: mat-gui:107 mat-gui:210 mat-gui:451 mat-gui:469 mat-gui:486 mat-gui:491 -msgid "Clean (strict)" -msgstr "Nettoyage (strict)" - -#: mat-gui:109 -msgid "Clean selected files with possible data loss, but clean more efficiently" -msgstr "Nettoie de manière sure avec pertes possibles d'informations" - -#: mat-gui:114 mat-gui:221 -msgid "Check" -msgstr "Vérification" - -#: mat-gui:116 -msgid "Check selected files for harmful meta" -msgstr "Vérifie l'état des fichiers" - -#: mat-gui:120 mat-gui:181 -msgid "Quit" -msgstr "Quitter" - -#: mat-gui:132 mat-gui:315 -msgid "Filename" -msgstr "Nom" - -#: mat-gui:132 mat-gui:317 -msgid "Mimetype" -msgstr "Type mime" - -#: mat-gui:132 -msgid "State" -msgstr "État" - -#: mat-gui:133 -msgid "Cleaned file" -msgstr "Fichier nettoyé" - -#: mat-gui:178 -msgid "Files" -msgstr "Fichiers" - -#: mat-gui:184 -msgid "Edit" -msgstr "Edition" - -#: mat-gui:185 -msgid "Clear the filelist" -msgstr "Vide la liste de fichiers" - -#: mat-gui:188 mat-gui:386 -msgid "Preferences" -msgstr "Préférences" - -#: mat-gui:191 -msgid "Process" -msgstr "Traiter" - -#: mat-gui:226 -msgid "Help" -msgstr "Aide" - -#: mat-gui:227 mat-gui:345 -msgid "Supported formats" -msgstr "Formats supportés" - -#: mat-gui:229 -msgid "About" -msgstr "A propos" - -#: mat-gui:238 -msgid "Choose files" -msgstr "Selection de fichiers" - -#: mat-gui:245 -msgid "All files" -msgstr "Tous" - -#: mat-gui:252 -msgid "Supported files" -msgstr "Supportés" - -#: mat-gui:290 -msgid "unknow" -msgstr "inconnu" - -#: mat-gui:301 -msgid "Not-supported" -msgstr "non-supporté" - -#: mat-gui:332 -msgid "This software was coded during the GSoC 2011" -msgstr "Ce logiciel a été forgé lors du GSoC 2011" - -#: mat-gui:334 -msgid "Website" -msgstr "Site internet" - -#: mat-gui:397 -msgid "Force Clean" -msgstr "Nettoyage forcé" - -#: mat-gui:400 -msgid "Do not check if already clean before cleaning" -msgstr "Ne pas vérifier l'état avant de traiter" - -#: mat-gui:404 -msgid "Backup" -msgstr "Copie de sauvegarde" - -#: mat-gui:407 -msgid "Keep a backup copy" -msgstr "Garde une copie de sauvegarde" - -#: mat-gui:410 -msgid "Add unsupported file to archives" -msgstr "Ajouter les formats non-supportés aux archives traités" - -#: mat-gui:414 -msgid "Add non-supported (and so non-anonymised) file to output archive" -msgstr "" - -#: mat-gui:450 -#, python-format -msgid "Checking %s..." -msgstr "Vérification de %s ..." - -#: mat-gui:455 -msgid "dirty" -msgstr "compromettant" - -#: mat-gui:468 mat-gui:485 -#, python-format -msgid "Cleaning %s..." -msgstr "Nettoyage de %s..." - -#: mat-gui:474 -msgid "Clean(lossless)" -msgstr "Nettoyage (sans pertes)" - -#: mat-gui:484 -#, python-format -msgid "Cleaning (strict) %s" -msgstr "Nettoyage (strict) %s" -- cgit v1.3 From 84ef2a35bb531877c97df8d0e000dfec2b44efc6 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Jan 2012 19:19:21 +0100 Subject: Update Todo --- TODO | 3 --- 1 file changed, 3 deletions(-) diff --git a/TODO b/TODO index 6e8cbea..5ccf195 100644 --- a/TODO +++ b/TODO @@ -16,6 +16,3 @@ FORMATS: MISC: - a nautilus extension (right-clic -> clean with MAT) - -SETUP: - - handle l10n files -- cgit v1.3 From 9bad7d4ac4916b4ffeb528dea8ee4f1959f2f7fd Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 9 Jan 2012 22:49:54 +0100 Subject: Remove a debug instruction --- mat-gui | 1 - 1 file changed, 1 deletion(-) diff --git a/mat-gui b/mat-gui index 7561dd0..0c047f7 100755 --- a/mat-gui +++ b/mat-gui @@ -689,7 +689,6 @@ def translate(): # get the $LANG environnement's variable language = os.environ.get('LANG', None) if language: - print language langs += language.split(':') return gettext.translation('mat-gui', 'locale', langs, fallback=True).ugettext -- cgit v1.3