From 3929a9b6dfa76fb03b9cbf95c86463b5005345b4 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 27 Sep 2010 13:09:42 +0800 Subject: [PATCH] gettext inclusion & French translation --- fr.po | 177 +++++++++++++++++++++++++++++++++++++ gcp | 76 ++++++++-------- gcp.po | 164 ++++++++++++++++++++++++++++++++++ i18n/fr/LC_MESSAGES/gcp.mo | Bin 0 -> 3753 bytes 4 files changed, 382 insertions(+), 35 deletions(-) create mode 100644 fr.po create mode 100644 gcp.po create mode 100644 i18n/fr/LC_MESSAGES/gcp.mo diff --git a/fr.po b/fr.po new file mode 100644 index 0000000..35f015b --- /dev/null +++ b/fr.po @@ -0,0 +1,177 @@ +# Goffi's CoPier. +# Copyright (C) 2010 Jérôme Poisson +# This file is distributed under the same license as the gcp package. +# Jérôme Poisson (Goffi) , 2010. +# Goffi , 2010. +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-27 12:42+0800\n" +"PO-Revision-Date: 2010-09-27 13:01+0800\n" +"Last-Translator: Goffi \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: gcp:43 +msgid "Error during import" +msgstr "Erreur pendant l'import de bibliothèques" + +#: gcp:44 +msgid "Please check dependecies:" +msgstr "Merci de vérifier les dépendances" + +#: gcp:50 +msgid "" +"ProgressBar not available, please download it at http://pypi.python.org/pypi/" +"progressbar" +msgstr "" +"«ProgressBar» n'est pas disponible, merci de le télécharger à http://pypi." +"python.org/pypi/progressbar" + +#: gcp:51 +msgid "" +"Progress bar deactivated\n" +"--\n" +msgstr "" +"Barre de progression désactivée\n" +"--\n" + +#: gcp:62 +msgid "" +"This program comes with ABSOLUTELY NO WARRANTY;\n" +"This is free software, and you are welcome to redistribute it\n" +"under certain conditions.\n" +"---\n" +"\n" +"This software is an advanced file copier\n" +"Get the latest version at http://www.goffi.org\n" +msgstr "" +"This program comes with ABSOLUTELY NO WARRANTY;\n" +"This is free software, and you are welcome to redistribute it\n" +"under certain conditions.\n" +"---\n" +"\n" +"Ce logiciel est un copieur de fichiers avancé\n" +"Vous pouvez télécharger la dernière version à http://www.goffi.org\n" + +#: gcp:82 +msgid "Init DbusObject..." +msgstr "Initialisation de «DbusObject»" + +#: gcp:102 +msgid "INTERNAL ERROR: invalid arguments" +msgstr "ERREUR INTERNE: arguments invalides" + +#: gcp:119 +msgid "gcp launched" +msgstr "gcp lancé" + +#: gcp:126 +msgid "Init DBus..." +msgstr "Initialisation de Dbus..." + +#: gcp:155 +msgid "Can't read mounts table" +msgstr "Impossible de lire la table des montages" + +#: gcp:162 +#, python-format +msgid "Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)" +msgstr "Ajout à la liste des copies: %(path)s ==> %(dest_path)s (%(fs_type)s)" + +#: gcp:170 gcp:192 +#, python-format +msgid "Can't copy %(path)s: %(exception)s" +msgstr "Impossible de copier %(path)s: %(exception)s" + +#: gcp:179 +#, python-format +msgid "Creating directory %s" +msgstr "Création du répertoire %s" + +#: gcp:200 +#, python-format +msgid "Invalid dest_path: %s" +msgstr "Chemin de destination invalide: %s" + +#: gcp:205 +#, python-format +msgid "The path given in arg doesn't exist or is not accessible: %s" +msgstr "Le chemin donné en argument n'existe pas ou n'est pas accessible: %s" + +#: gcp:210 +#, python-format +msgid "omitting directory \"%s\"" +msgstr "Répertoire \"%s\" ignoré" + +#: gcp:226 +#, python-format +msgid "File [%s] already exists, skipping it !" +msgstr "Le fichier [%s] existe déjà, je le saute !" + +#: gcp:233 +#, python-format +msgid "COPYING %(source)s ==> %(dest)s" +msgstr "COPIE %(source)s ==> %(dest)s" + +#: gcp:284 +msgid "Progress: " +msgstr "Progression: " + +#: gcp:315 +msgid "copy directories recursively" +msgstr "copie les répertoire récursivement" + +#: gcp:318 +msgid "force overwriting of existing files" +msgstr "force le remplacement des fichiers déjà existants" + +#: gcp:321 +msgid "preserve the specified attributes" +msgstr "garde les attributs spécifiés" + +#: gcp:324 +msgid "don't fixe name encoding errors" +msgstr "Ne corrige pas les erreurs dans l'encodage des noms" + +#: gcp:327 +msgid "deactivate progress bar" +msgstr "désactive la barre de progression" + +#: gcp:330 +msgid "Show what is currently done" +msgstr "Affiche les opérations effectuées" + +#: gcp:335 +msgid "Progress bar is not available, deactivating" +msgstr "La barre de progression n'est pas disponible, désactivation" + +#: gcp:345 +msgid "" +"Invalide --preserve value\n" +"valid values are:" +msgstr "" +"La valeur de «--preserve» est invalide\n" +"Les valeurs valides sont:" + +#: gcp:354 +#, python-format +msgid "There is already one instance of %s running, pluging to it" +msgstr "Il y a déjà une instance de %s lancée, je m'y connecte" + +#: gcp:360 +msgid "Wrong number of arguments" +msgstr "Nombre d'arguments invalide" + +#: gcp:362 +#, python-format +msgid "adding args to gcp: %s" +msgstr "ajout des arguments à gcp: %s" + +#: gcp:373 +msgid "User interruption: good bye" +msgstr "Interruption par l'utilisateur: au revoir" diff --git a/gcp b/gcp index cbbc880..00dcffe 100755 --- a/gcp +++ b/gcp @@ -25,6 +25,10 @@ from logging import debug, info, error, warning logging.basicConfig(level=logging.INFO, format='%(message)s') ### + +import gettext +gettext.install('gcp', "i18n", unicode=True) + import sys import os,os.path from optparse import OptionParser #To be replaced by argparse ASAP @@ -36,33 +40,33 @@ try: import dbus.service import dbus.mainloop.glib except ImportError,e: - error("Error during import") - error("Please check dependecies:",e) + error(_("Error during import")) + error(_("Please check dependecies:"),e) exit(2) try: from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed pbar_available=True except ImportError, e: - info ('ProgressBar not available, please download it at http://pypi.python.org/pypi/progressbar') - info ('Progress bar deactivated\n--\n') + info (_('ProgressBar not available, please download it at http://pypi.python.org/pypi/progressbar')) + info (_('Progress bar deactivated\n--\n')) pbar_available=False NAME = "gcp (Goffi's copier)" NAME_SHORT = "gcp" VERSION = '0.1' -ABOUT = NAME+" v"+VERSION+""" (c) Jérôme Poisson (aka Goffi) 2010 +ABOUT = NAME+u" v"+VERSION+u""" (c) Jérôme Poisson (aka Goffi) 2010 --- -"""+NAME+""" Copyright (C) 2010 Jérôme Poisson -This program comes with ABSOLUTELY NO WARRANTY; +"""+NAME+u""" Copyright (C) 2010 Jérôme Poisson +""" + _(u"""This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions. --- This software is an advanced file copier Get the latest version at http://www.goffi.org -""" +""") const_DBUS_INTERFACE = "org.goffi.gcp" const_DBUS_PATH = "/org/goffi/gcp" @@ -75,7 +79,7 @@ class DbusObject(dbus.service.Object): def __init__(self, gcp, bus, path): self._gcp = gcp dbus.service.Object.__init__(self, bus, path) - debug("Init DbusObject...") + debug(_("Init DbusObject...")) self.cb={} @dbus.service.method(const_DBUS_INTERFACE, @@ -95,7 +99,7 @@ class DbusObject(dbus.service.Object): try: args = pickle.loads(str(args)) except TypeError, pickle.UnpicklingError: - return (False, "INTERNAL ERROR: invalid arguments") + return (False, _("INTERNAL ERROR: invalid arguments")) return self._gcp.parseArguments(args, source_path) class GCP(): @@ -112,14 +116,14 @@ class GCP(): except dbus.exceptions.DBusException,e: if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown': self.launchDbusMainInstance() - debug ("gcp launched") + debug (_("gcp launched")) self._main_instance = True self.buffer_size = const_BUFF_SIZE else: raise e def launchDbusMainInstance(self): - debug ("Init DBus...") + debug (_("Init DBus...")) session_bus = dbus.SessionBus() self.dbus_name = dbus.service.BusName(const_DBUS_INTERFACE, session_bus) self.dbus_object = DbusObject(self, session_bus, const_DBUS_PATH) @@ -148,20 +152,22 @@ class GCP(): fs_spec, fs_file, fs_vfstype, fs_mntops, fs_freq, fs_passno = line.split(' ') ret[fs_file] = fs_vfstype except: - error ("Can't read mounts table") + error (_("Can't read mounts table")) return ret def __appendToList(self, path, dest_path, options): """Add a file to the copy list @param path: absolute path of file @param options: options as return by optparse""" - debug ("Adding to copy list: %s ==> %s (%s)", path, dest_path, self.getFsType(dest_path)) + debug (_("Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)") % {"path":path, + "dest_path":dest_path, + "fs_type":self.getFsType(dest_path)} ) try: self.bytes_total+=os.path.getsize(path) self.files_left+=1 self.copy_list.insert(0,(path, dest_path, options)) except OSError,e: - error("Can't copy %(path)s: %(exception)s" % {'path':path, 'exception':e.strerror}) + error(_("Can't copy %(path)s: %(exception)s") % {'path':path, 'exception':e.strerror}) def __appendDirToList(self, dirpath, dest_path, options): @@ -170,7 +176,7 @@ class GCP(): @param options: options as return by optparse""" #We first check that the dest path exists, and create it if needed if not os.path.exists(dest_path): - debug ("Creating directory %s" % dest_path) + debug (_("Creating directory %s") % dest_path) os.makedirs(dest_path) #TODO: check permissions #TODO: check that dest_path is an accessible dir, # and skip file/write error in log if needed @@ -183,7 +189,7 @@ class GCP(): else: self.__appendToList(filepath, dest_path, options) except OSError,e: - error("Can't copy %(path)s: %(exception)s" % {'path':dirpath, 'exception':e.strerror}) + error(_("Can't copy %(path)s: %(exception)s") % {'path':dirpath, 'exception':e.strerror}) def __checkArgs(self, options, source_path, args): """Check thats args are files, and add them to copy list""" @@ -191,17 +197,17 @@ class GCP(): try: dest_path = os.path.normpath(os.path.join(os.path.expanduser(source_path), args.pop())) except OSError,e: - error ("Invalid dest_path: %s",e) + error (_("Invalid dest_path: %s"),e) for path in args: abspath = os.path.normpath(os.path.join(os.path.expanduser(source_path), path)) if not os.path.exists(abspath): - warning("The path given in arg doesn't exist or is not accessible: %s",abspath) + warning(_("The path given in arg doesn't exist or is not accessible: %s") % abspath) else: if os.path.isdir(abspath): full_dest_path = dest_path if os.path.isabs(path) else os.path.normpath(os.path.join(dest_path, path)) if not options.recursive: - warning ('omitting directory "%s"' % abspath) + warning (_('omitting directory "%s"') % abspath) else: self.__appendDirToList(abspath, full_dest_path, options) else: @@ -217,14 +223,14 @@ class GCP(): assert(filename) dest_file = os.path.join(dest_path,filename) if os.path.exists(dest_file) and not options.force: - warning ("File [%s] already exists, skipping it !" % dest_file) + warning (_("File [%s] already exists, skipping it !") % dest_file) return True dest_fd = open(dest_file, 'wb') gobject.io_add_watch(source_fd,gobject.IO_IN,self._copyFile, (dest_fd, options), priority=gobject.PRIORITY_HIGH) if not self.progress: - info("COPYING %(source)s ==> %(dest)s" % {"source":source_path,"dest":dest_file}) + info(_("COPYING %(source)s ==> %(dest)s") % {"source":source_path,"dest":dest_file}) return True else: #Nothing left to copy, we quit @@ -275,7 +281,7 @@ class GCP(): if self.pbar.maxval != self.bytes_total: self.pbar.maxval = self.bytes_total except AttributeError: - self.pbar = ProgressBar(self.bytes_total,["Progress: ",Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()]) + self.pbar = ProgressBar(self.bytes_total,[_("Progress: "),Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()]) self.pbar.start() self.pbar.update(self.bytes_copied) @@ -306,27 +312,27 @@ class GCP(): parser = OptionParser(usage=_usage,version=ABOUT) parser.add_option("-r", "--recursive", action="store_true", default=False, - help="copy directories recursively") + help=_("copy directories recursively")) parser.add_option("-f", "--force", action="store_true", default=False, - help="force overwriting of existing files") + help=_("force overwriting of existing files")) parser.add_option("--preserve", action="store", default='mode,ownership,timestamps', - help="preserve the specified attributes") + help=_("preserve the specified attributes")) parser.add_option("--no-unicode-fix", action="store_true", default=False, - help="don't fixe name encoding errors") #TODO + help=_("don't fixe name encoding errors")) #TODO parser.add_option("--no-progress", action="store_false", dest="progress", default=True, - help="deactivate progress bar") + help=_("deactivate progress bar")) parser.add_option("-v", "--verbose", action="store_true", default=False, - help="Show what is currently done") + help=_("Show what is currently done")) (options, args) = parser.parse_args(full_args) #options check if options.progress and not pbar_available: - warning ("Progress bar is not available, deactivating") + warning (_("Progress bar is not available, deactivating")) options.progress = self.progress = False else: self.progress = options.progress @@ -336,7 +342,7 @@ class GCP(): preserve = set(options.preserve.split(',')) if not preserve.issubset(const_PRESERVE): - error ('Invalide --preserve value\nvalid values are:') + error (_("Invalide --preserve value\nvalid values are:")) for value in const_PRESERVE: error('- %s' % value) exit(2) @@ -345,15 +351,15 @@ class GCP(): #if there is an other instance of gcp, we send options to it if not self._main_instance: - info ("There is already one instance of %s running, pluging to it" % NAME_SHORT) + info (_("There is already one instance of %s running, pluging to it") % NAME_SHORT) #XXX: we have to serialize data as dbus only accept valid unicode, and filenames # can have invalid unicode. return self.gcp_main.addArgs(os.getcwd(),pickle.dumps(full_args)) else: if len(args) < 2: - _error_msg = "Wrong number of arguments" + _error_msg = _("Wrong number of arguments") return (False, _error_msg) - debug("adding args to gcp: %s",args) + debug(_("adding args to gcp: %s"),args) self.__checkArgs(options, source_path, args) gobject.idle_add(self.__copyNextFile) return (True,'') @@ -364,7 +370,7 @@ class GCP(): try: self.loop.run() except KeyboardInterrupt: - info("User interruption: good bye") + info(_("User interruption: good bye")) if __name__ == "__main__": diff --git a/gcp.po b/gcp.po new file mode 100644 index 0000000..b27c5fb --- /dev/null +++ b/gcp.po @@ -0,0 +1,164 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-09-27 13:03+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: gcp:43 +msgid "Error during import" +msgstr "" + +#: gcp:44 +msgid "Please check dependecies:" +msgstr "" + +#: gcp:50 +msgid "" +"ProgressBar not available, please download it at http://pypi.python.org/pypi/" +"progressbar" +msgstr "" + +#: gcp:51 +msgid "" +"Progress bar deactivated\n" +"--\n" +msgstr "" + +#: gcp:62 +msgid "" +"This program comes with ABSOLUTELY NO WARRANTY;\n" +"This is free software, and you are welcome to redistribute it\n" +"under certain conditions.\n" +"---\n" +"\n" +"This software is an advanced file copier\n" +"Get the latest version at http://www.goffi.org\n" +msgstr "" + +#: gcp:82 +msgid "Init DbusObject..." +msgstr "" + +#: gcp:102 +msgid "INTERNAL ERROR: invalid arguments" +msgstr "" + +#: gcp:119 +msgid "gcp launched" +msgstr "" + +#: gcp:126 +msgid "Init DBus..." +msgstr "" + +#: gcp:155 +msgid "Can't read mounts table" +msgstr "" + +#: gcp:162 +#, python-format +msgid "Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)" +msgstr "" + +#: gcp:170 gcp:192 +#, python-format +msgid "Can't copy %(path)s: %(exception)s" +msgstr "" + +#: gcp:179 +#, python-format +msgid "Creating directory %s" +msgstr "" + +#: gcp:200 +#, python-format +msgid "Invalid dest_path: %s" +msgstr "" + +#: gcp:205 +#, python-format +msgid "The path given in arg doesn't exist or is not accessible: %s" +msgstr "" + +#: gcp:210 +#, python-format +msgid "omitting directory \"%s\"" +msgstr "" + +#: gcp:226 +#, python-format +msgid "File [%s] already exists, skipping it !" +msgstr "" + +#: gcp:233 +#, python-format +msgid "COPYING %(source)s ==> %(dest)s" +msgstr "" + +#: gcp:284 +msgid "Progress: " +msgstr "" + +#: gcp:315 +msgid "copy directories recursively" +msgstr "" + +#: gcp:318 +msgid "force overwriting of existing files" +msgstr "" + +#: gcp:321 +msgid "preserve the specified attributes" +msgstr "" + +#: gcp:324 +msgid "don't fixe name encoding errors" +msgstr "" + +#: gcp:327 +msgid "deactivate progress bar" +msgstr "" + +#: gcp:330 +msgid "Show what is currently done" +msgstr "" + +#: gcp:335 +msgid "Progress bar is not available, deactivating" +msgstr "" + +#: gcp:345 +msgid "" +"Invalide --preserve value\n" +"valid values are:" +msgstr "" + +#: gcp:354 +#, python-format +msgid "There is already one instance of %s running, pluging to it" +msgstr "" + +#: gcp:360 +msgid "Wrong number of arguments" +msgstr "" + +#: gcp:362 +#, python-format +msgid "adding args to gcp: %s" +msgstr "" + +#: gcp:373 +msgid "User interruption: good bye" +msgstr "" diff --git a/i18n/fr/LC_MESSAGES/gcp.mo b/i18n/fr/LC_MESSAGES/gcp.mo new file mode 100644 index 0000000000000000000000000000000000000000..580097590122e474c6ebc219e6d1996e9130e609 GIT binary patch literal 3753 zcmd5;O>Y~=8J@&x-LmPI+azt=kJoMmS+JI(oC0+=QCdl+4HmRyFmw{5D1znga5>6y zXFD@Xiunftax2nHFF6$^eCVa=B{vZW8X)H$a>&K#ALyZ%q)483mLIa~0y%bp)wA4r zcjkSc_v6tg=bm^+;3C{V;`=cnE;BxkKe+x5+yQP_)z#rg!0c3vO0%BW#fpYO3+;}Cvi~IYyncHvU=GZu& z%ne-fxdwROi63x*Y5^Mk{>(8b5od67Uie~v7Z=wMUytKvKNi=scmO5-LJIuF^@Ozh zIK^&~s5~X7Db~e=GG$#zYnO`14K^(8?7V~@iL~zZ`I}2?m-_Z~H!0+X-4OeSx9+qK zZotOs(!_Xo>XQvC_M?2=RXZ>C%S0rK1a?b~s!0A*p;6Wh$Y_q~%cJWYNl%qicJmt=H@GAHC8Z_Kx5{^{V<}NeF`Bul!p{K~NZJ zr5Q=Wn^M*)YyWICc_*VGN^U4E zjTPM3-Fx}4eY@Li-=Tv;dUdzc**)mqd7hDnyh>rbXVeiCEQO#p=8^1(J+B_SLbZJOVi~kF}p6 za7i00`Wl0PG$I)rZ~~9uicdQ~bL>{Y0YqHp=z~P)p>hv(`o%SSQ7oIu6GXN^r}P#0 z13U9fST1qy&Y+b9uT zM$mXZxbjQdz7qc8%H_t@MgxXHM~)OH;}Lexg^lgXt{qtybWN07WKf%sZg8&XMW3=? zFBA7ttsUiQ8KpAl%4itUb+k-8c!b@}*3ITBlwy%-y9H(IDhUDb2+bS|t-3u5a zk+IV4-0ofvuCDCZo4zzbbDo)yuJ%x}V)sawj%M$IdOzqT1_#=g3(@je{_;b=)%>3$ zzlEV(H8gggSNU>pKIQcAf6zF?q-Wo}0C?Yq2pyb3NX%>sIY4J5CE>Y1<7qZu^O_(_ zLp)2P+)=h(=>i|$!(dU`4Q6+LUt*WGME%7B^j)PFzAC}OYEk|6@ zh2blp4j>XXiwW;(o=vUSpxIP<34$}2{Qqs3ud^#fgiVz#bk3t3inRFLhqV+U>3ZpuZ!8>*=0n%Z5jtKR=wXkmaDAz6%RUg1A8=g#t3@1n zO72uu3a2Lsp68;+{{)I<<-+pOB`*$mt{J1!sw%jlpndQYJ%G^*-@PVcaDf8;XKlDp zMU=9ULrm{j@?m~?$!Rr)DyhUETc{-SEIOw~9*ZNXG}rK4q>({+u?q`PMC+r_St`+k F;tO7CaA5!d literal 0 HcmV?d00001