- gettext support added in frontends
- first draft of frontends french translation
This commit is contained in:
Goffi 2010-03-05 20:33:10 +11:00
commit e3ebafd8f3
4 changed files with 1701 additions and 196 deletions

164
frontends/jp/fr.po Normal file
View file

@ -0,0 +1,164 @@
# JP French Translation.
# Copyright (C) 2009, 2010 Jérôme Poisson
# This file is distributed under the same license as the jp package.
# Jérôme Poisson <goffi@goffi.org>, 2009, 2010.
# Goffi <goffi@goffi.org>, 2010.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 0.0.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-03-05 19:08+1100\n"
"PO-Revision-Date: 2010-03-05 19:24+1100\n"
"Last-Translator: Goffi <goffi@goffi.org>\n"
"Language-Team: French <goffi@goffi.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: jp:63
msgid ""
"ProgressBar not available, please download it at http://pypi.python.org/pypi/"
"progressbar"
msgstr ""
"ProgressBar n'est pas disponible, veuillez le télécharger à http://pypi."
"python.org/pypi/progressbar"
#: jp:64
msgid ""
"Progress bar deactivated\n"
"--\n"
msgstr ""
"Barre de progression désactivée\n"
"--\n"
#: jp:77
msgid ""
"\n"
" %prog [options] [FILE1 FILE2 ...] JID\n"
" %prog -w [options] [JID1 JID2 ...]\n"
"\n"
" %prog --help for options list\n"
" "
msgstr ""
"\n"
" %prog [options] [FICHIER1 FICHIER2 ...] JID\n"
" %prog -w [options] [JID1 JID2 ...]\n"
"\n"
" %prog --help pour la liste des options\n"
" "
#: jp:86
msgid "Make a bzip2 tarball"
msgstr "Fait un fichier compressé bzip2"
#: jp:88
msgid "Wait for a file to be sent by a contact"
msgstr "Attend qu'un fichier soit envoyé par un contact"
#: jp:90
msgid "Accept multiple files (you'll have to stop manually)"
msgstr ""
"Accepte plusieurs fichiers (vous devrez arrêter le programme à la main)"
#: jp:92
msgid "Force overwritting of existing files"
msgstr "Force le remplacement des fichiers existants"
#: jp:94
msgid "Show progress bar"
msgstr "Affiche la barre de progression"
#: jp:96
msgid ""
"Separate xmpp messages: send one message per line instead of one message "
"alone."
msgstr ""
"Sépare les messages xmpp: envoi un message par ligne plutôt qu'un seul "
"message global."
#: jp:98
msgid "Add a new line at the beginning of the input (usefull for ascii art ;))"
msgstr ""
"Ajoute un saut de ligne au début de l'entrée (utile pour l'art ascii ;))"
#: jp:103
msgid "You must specify the destination JID (Jabber ID)"
msgstr "Vous devez préciser le JID (Jabber ID) de destination"
#: jp:112
#, python-format
msgid "%s is not a valid JID !"
msgstr "%s n'est pas un JID valide !"
#: jp:118
msgid "Option progress is not available, deactivated."
msgstr ""
"L'option « progress » (barre de progression) n'est pas disponible, elle est "
"désactivée."
#: jp:131
msgid "SAT is not conneted, please connect before using jp"
msgstr "SAT n'est pas connecté, veuillez le connecter avant d'utiliser jp"
#: jp:155
#, python-format
msgid "File [%s] doesn't exist !"
msgstr "Le fichier [%s] n'existe pas !"
#: jp:158
#, python-format
msgid "[%s] is a dir ! Please send files inside or use compression"
msgstr ""
"[%s] est un répertoire ! Veuillez envoyer les fichiers qu'il contient ou "
"utiliser la compression."
#: jp:164
#, python-format
msgid "tmp file (%s) already exists ! Please remove it"
msgstr "le fichier temporaire (%s) existe déjà ! Veuillez le supprimer"
#: jp:166
msgid "bz2 is an experimental option at an early dev stage, use with caution"
msgstr ""
"bz2 est une option expérimentale à un stade de développement peu avancé, "
"utilisez-là avec prudence"
#: jp:168
msgid "Starting compression, please wait..."
msgstr "Lancement de la compression, veuillez patienter..."
#: jp:172
#, python-format
msgid "Adding %s"
msgstr "Ajout de %s"
#: jp:175
msgid "OK !"
msgstr "C'est parti !"
#: jp:196
#, python-format
msgid "Accepted file [%(filename)s] from %(sender)s"
msgstr "Le fichier [%(filename)s] de %(sender)s a été accepté"
#: jp:200
#, python-format
msgid ""
"Refused file [%(filename)s] from %(sender)s: a file with the same name "
"already exist"
msgstr ""
"Le fichier [%(filename)s] de %(sender)s a été refusé: un fichier avec le "
"même nom existe déjà"
#: jp:209
msgid "FIXME: actionResult not implemented"
msgstr "CORRIGEZ-MOI: actionResult n'est pas implémenté"
#: jp:223
msgid "Progress: "
msgstr "Progression: "
#: jp:254
msgid "User interruption: good bye"
msgstr "Interrompu par l'utilisateur: au revoir"

Binary file not shown.

View file

@ -45,6 +45,9 @@ logging.basicConfig(level=logging.DEBUG,
format='%(message)s')
###
import gettext
gettext.install('jp', "i18n", unicode=True)
import sys
import os
from os.path import abspath, basename, dirname
@ -57,8 +60,8 @@ import tarfile
try:
from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed
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
@ -71,33 +74,33 @@ class JP():
def check_options(self):
"""Check command line options"""
usage="""
usage=_("""
%prog [options] [FILE1 FILE2 ...] JID
%prog -w [options] [JID1 JID2 ...]
%prog --help for options list
"""
""")
parser = OptionParser(usage=usage,version=about)
parser.add_option("-b", "--bz2", action="store_true", default=False,
help="Make a bzip2 tarball")
help=_("Make a bzip2 tarball"))
parser.add_option("-w", "--wait-file", action="store_true", default=False,
help="Wait for a file to be sent by a contact")
help=_("Wait for a file to be sent by a contact"))
parser.add_option("-m", "--multiple", action="store_true", default=False,
help="Accept multiple files (you'll have to stop manually)")
help=_("Accept multiple files (you'll have to stop manually)"))
parser.add_option("-f", "--force", action="store_true", default=False,
help="Force overwritting of existing files")
help=_("Force overwritting of existing files"))
parser.add_option("-p", "--progress", action="store_true", default=False,
help="Show progress bar")
help=_("Show progress bar"))
parser.add_option("-s", "--separate", action="store_true", default=False,
help="Separate xmpp messages: send one message per line instead of one message alone.")
help=_("Separate xmpp messages: send one message per line instead of one message alone."))
parser.add_option("-n", "--new-line", action="store_true", default=False,
help="Add a new line at the beginning of the input (usefull for ascii art ;))")
help=_("Add a new line at the beginning of the input (usefull for ascii art ;))"))
(self.options, args) = parser.parse_args()
if len(args) < 1 and not self.options.wait_file:
parser.error("You must specify the destination JID (Jabber ID)")
parser.error(_("You must specify the destination JID (Jabber ID)").encode('utf-8'))
if self.options.wait_file:
#several jid
@ -106,13 +109,13 @@ class JP():
#one dest_jid, other args are files
self.dest_jid = JID(args[-1])
if not self.dest_jid.is_valid:
error ("%s is not a valid JID !", self.dest_jid)
error (_("%s is not a valid JID !"), self.dest_jid)
exit(1)
self.files = args[:-1]
if not pbar_available and self.options.progress:
self.options.progress = False
error ("Option progress is not available, deactivated.")
error (_("Option progress is not available, deactivated."))
if self.options.progress or self.options.wait_file:
self.start_loop = True #We have to use loop for these options
@ -125,7 +128,7 @@ class JP():
def check_jabber_status(self):
"""Check that jabber status is allright"""
if not self.bridge.isConnected():
error("SAT is not conneted, please connect before using jp")
error(_("SAT is not conneted, please connect before using jp"))
exit(1)
@ -149,27 +152,27 @@ class JP():
for file in self.files:
if not os.path.exists(file):
error ("File [%s] doesn't exist !" % file)
error (_("File [%s] doesn't exist !") % file)
exit(1)
if not self.options.bz2 and os.path.isdir(file):
error ("[%s] is a dir ! Please send files inside or use compression" % file)
error (_("[%s] is a dir ! Please send files inside or use compression") % file)
exit(1)
if self.options.bz2:
tmpfile = (basename(self.files[0]) or basename(dirname(self.files[0])) ) + '.tar.bz2' #FIXME: tmp, need an algorithm to find a good name/path
if os.path.exists(tmpfile):
error ("tmp file (%s) already exists ! Please remove it", tmpfile)
error (_("tmp file (%s) already exists ! Please remove it"), tmpfile)
exit(1)
warning("bz2 is an experimental option at an early dev stage, use with caution")
warning(_("bz2 is an experimental option at an early dev stage, use with caution"))
#FIXME: check free space, writting perm, tmp dir, filename (watch for OS used)
info("Starting compression, please wait...")
info(_("Starting compression, please wait..."))
sys.stdout.flush()
bz2=tarfile.open(tmpfile, "w:bz2")
for file in self.files:
info("Adding %s", file)
info(_("Adding %s"), file)
bz2.add(file)
bz2.close()
info("OK !")
info(_("OK !"))
path = abspath(tmpfile)
self.transfert_id = self.bridge.sendFile(self.dest_jid, path)
else:
@ -190,11 +193,11 @@ class JP():
if self.options.force or not os.path.exists(answer_data["dest_path"]):
self.bridge.confirmationAnswer(id, True, answer_data)
info("Accepted file [%s] from %s", data['filename'], data['from'])
info(_("Accepted file [%(filename)s] from %(sender)s") % {'filename':data['filename'], 'sender':data['from']})
self.transfert_id = id
else:
self.bridge.confirmationAnswer(id, False, answer_data)
warning("Refused file [%s] from %s: a file with the same name already exist", data['filename'], data['from'])
warning(_("Refused file [%(filename)s] from %(sender)s: a file with the same name already exist") % {'filename':data['filename'], 'sender':data['from']})
if not self.options.multiple and not self.options.progress:
@ -203,7 +206,7 @@ class JP():
def actionResult(self, type, id, data):
#FIXME
info ("FIXME: actionResult not implemented")
info (_("FIXME: actionResult not implemented"))
def wait_file(self):
"""Wait for a file and write it on local dir"""
@ -217,7 +220,7 @@ class JP():
data['position'] = '0'
if not self.pbar:
#first answer, we must construct the bar
self.pbar = ProgressBar(int(data['size']),["Progress: ",Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()])
self.pbar = ProgressBar(int(data['size']),[_("Progress: "),Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()])
self.pbar.start()
self.pbar.update(int(data['position']))
@ -248,7 +251,7 @@ class JP():
try:
self.loop.run()
except KeyboardInterrupt:
info("User interruption: good bye")
info(_("User interruption: good bye"))
if __name__ == "__main__":

142
frontends/jp/jp.po Normal file
View file

@ -0,0 +1,142 @@
# 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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-03-05 19:08+1100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: jp:63
msgid ""
"ProgressBar not available, please download it at http://pypi.python.org/pypi/"
"progressbar"
msgstr ""
#: jp:64
msgid ""
"Progress bar deactivated\n"
"--\n"
msgstr ""
#: jp:77
msgid ""
"\n"
" %prog [options] [FILE1 FILE2 ...] JID\n"
" %prog -w [options] [JID1 JID2 ...]\n"
"\n"
" %prog --help for options list\n"
" "
msgstr ""
#: jp:86
msgid "Make a bzip2 tarball"
msgstr ""
#: jp:88
msgid "Wait for a file to be sent by a contact"
msgstr ""
#: jp:90
msgid "Accept multiple files (you'll have to stop manually)"
msgstr ""
#: jp:92
msgid "Force overwritting of existing files"
msgstr ""
#: jp:94
msgid "Show progress bar"
msgstr ""
#: jp:96
msgid ""
"Separate xmpp messages: send one message per line instead of one message "
"alone."
msgstr ""
#: jp:98
msgid "Add a new line at the beginning of the input (usefull for ascii art ;))"
msgstr ""
#: jp:103
msgid "You must specify the destination JID (Jabber ID)"
msgstr ""
#: jp:112
#, python-format
msgid "%s is not a valid JID !"
msgstr ""
#: jp:118
msgid "Option progress is not available, deactivated."
msgstr ""
#: jp:131
msgid "SAT is not conneted, please connect before using jp"
msgstr ""
#: jp:155
#, python-format
msgid "File [%s] doesn't exist !"
msgstr ""
#: jp:158
#, python-format
msgid "[%s] is a dir ! Please send files inside or use compression"
msgstr ""
#: jp:164
#, python-format
msgid "tmp file (%s) already exists ! Please remove it"
msgstr ""
#: jp:166
msgid "bz2 is an experimental option at an early dev stage, use with caution"
msgstr ""
#: jp:168
msgid "Starting compression, please wait..."
msgstr ""
#: jp:172
#, python-format
msgid "Adding %s"
msgstr ""
#: jp:175
msgid "OK !"
msgstr ""
#: jp:196
#, python-format
msgid "Accepted file [%(filename)s] from %(sender)s"
msgstr ""
#: jp:200
#, python-format
msgid ""
"Refused file [%(filename)s] from %(sender)s: a file with the same name "
"already exist"
msgstr ""
#: jp:209
msgid "FIXME: actionResult not implemented"
msgstr ""
#: jp:223
msgid "Progress: "
msgstr ""
#: jp:254
msgid "User interruption: good bye"
msgstr ""