i18n first draft

- gettext support added in SàT
- first draft of french translation
- added README with a HOWTO for translators
This commit is contained in:
Goffi 2010-03-03 17:12:23 +11:00
commit 4a293cdaa1
11 changed files with 1463 additions and 153 deletions

25
README4TRANSLATORS Normal file
View file

@ -0,0 +1,25 @@
First of all, thank you for helping translating SàT :)
To translate a file, you can use a dedicated tool as the excellent gtranslator:
- use the template .po file (e.g. sat.po) and name it to your translated language (e.g. fr.po for french); you can preferably generate a new template directly from the source with the following command (eventually adapted):
> xgettext -L python -d sat sat.tac tools/*py plugins/*py
- use the choosed tool (a simple text editor can be sufficient) to edit the file: e.g. gtranslator fr.po
- once you translation is finished (or partly finished: the english sentences are used if there is no translation), you can test them by generating a binary and moving it to the right place with the following commands:
> msgfmt -o sat.mo fr
> mv sat.mo i18n/fr/LC_MESSAGES/sat.mo
/!\ Note that you don't need to precise the file extention mith the msgfmt command, here fr mean "use fr.po file"
- if you have already a translation, and want to update it (new translations to do, some sentences have changed), you can use the following commands:
> msgmerge fr.po sat.po > fr2.po
and if everything is allright
> mv fr2.po fr.po
Don't forget that you can use the version-control system (mercurial, the "hg" command) to keep history of you translations.
You can check the fr.po file to see how it's done and to know what to put while you set up you translation tool.
Trank you again for you help, don't forget to give me your name and contact mail so I can credit you, and don't hesitate to contact me if you need help (goffi@goffi.org).

647
fr.po Normal file
View file

@ -0,0 +1,647 @@
# SàT french translation.
# Copyright (C) 2009, 2010 Jérôme Poisson
# This file is distributed under the same license as the SàT package.
# Jérôme Poisson <goffi@goffi.org>, 2009, 2010.
# Goffi <goffi@goffi.org>, 2010.
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 0.0.2D\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-03-03 16:51+1100\n"
"PO-Revision-Date: 2010-03-03 16:52+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"
#: sat.tac:88
#, python-format
msgid "********** [%s] CONNECTED **********"
msgstr "********** [%s] CONNECTÉ **********"
#: sat.tac:94
msgid "XML stream is initialized"
msgstr "Le flux XML est initialisé"
#: sat.tac:114
#, python-format
msgid "********** [%s] DISCONNECTED **********"
msgstr "********** [%s] DÉCONNECTÉ **********"
#: sat.tac:118
msgid "No keep_alife"
msgstr "Pas de \"keep_alife\""
#: sat.tac:129
#, python-format
msgid "got message from: %s"
msgstr "message reçu de: %s"
#: sat.tac:171
#, python-format
msgid "new contact in roster list: %s"
msgstr "nouveau contact: %s"
#: sat.tac:178
#, python-format
msgid "removing %s from roster list"
msgstr "supppression du contact %s"
#: sat.tac:188
#, python-format
msgid "presence update for [%s]"
msgstr "mise à jour de l'information de présence pour [%s]"
#: sat.tac:218
#, python-format
msgid "subscription approved for [%s]"
msgstr "inscription approuvée pour [%s]"
#: sat.tac:223
#, python-format
msgid "unsubscription confirmed for [%s]"
msgstr "désinscription confirmée pour [%s]"
#: sat.tac:228
#, python-format
msgid "subscription request for [%s]"
msgstr "demande d'inscription pour [%s]"
#: sat.tac:233
#, python-format
msgid "unsubscription asked for [%s]"
msgstr "demande de désinscription pour [%s]"
#: sat.tac:259
msgid "Registration asked for"
msgstr "inscription demandée pour"
#: sat.tac:277 plugins/plugin_xep_0077.py:84 plugins/plugin_xep_0077.py:98
#, python-format
msgid "registration answer: %s"
msgstr "réponse à la demande d'inscription: %s"
#: sat.tac:279 plugins/plugin_xep_0077.py:100
msgid "Registration successfull"
msgstr "Inscription réussie"
#: sat.tac:284 plugins/plugin_xep_0077.py:76 plugins/plugin_xep_0077.py:107
#, python-format
msgid "Registration failure: %s"
msgstr "Échec de l'inscription: %s"
#: sat.tac:289 plugins/plugin_xep_0077.py:113
msgid "Username already exists, please choose an other one"
msgstr "Ce nom d'utilisateur existe déjà, veuillez en choisir un autre"
#: sat.tac:292
#, python-format
msgid "Registration failed (%s)"
msgstr "Éched de l'insciption (%s)"
#: sat.tac:305
msgid "Trying to access an undefined constant"
msgstr "Vous essayer d'utiliser une constante indéfinie"
#: sat.tac:312
msgid "Trying to redefine a constant"
msgstr "Vous essayez de ré-attribuer une constante"
#: sat.tac:373
#, python-format
msgid "importing plugin: %s"
msgstr "Importation du plugin: %s"
#: sat.tac:387
msgid "Trying to connect a non-exsitant profile"
msgstr "Vous essayer de connecter un profile qui n'existe pas"
#: sat.tac:391
msgid "already connected !"
msgstr "Vous êtes déjà connecté !"
#: sat.tac:415
msgid "setting plugins parents"
msgstr "Configuration des parents des extensions"
#: sat.tac:426
msgid "not connected !"
msgstr "Vous n'êtes pas connecté !"
#: sat.tac:429
msgid "Disconnecting..."
msgstr "Déconnexion..."
#: sat.tac:441
msgid "running app"
msgstr "Lancement de l'application"
#: sat.tac:445
msgid "stopping app"
msgstr "Arrêt de l'application"
#: sat.tac:483
msgid "No user or server given"
msgstr "L'utilisateur ou le serveur n'ont pas été spécifié"
#: sat.tac:485
msgid "No user, password or server given, can't register new account."
msgstr ""
"L'utilisateur, le mot de passe ou le serveur n'ont pas été spécifiés, "
"impossible d'inscrire un nouveau compte."
#: sat.tac:492
#, python-format
msgid "Are you sure to register new account [%(user)s] to server %(server)s ?"
msgstr ""
"Êtes vous sûr de vouloir inscrire le nouveau compte [%(user)s] au serveur %"
"(server)s ?"
#: sat.tac:500
#, python-format
msgid "register Confirmation CB ! (%s)"
msgstr "Callback de confirmation d'inscription !"
#: sat.tac:532
#, python-format
msgid "FIXME FIXME FIXME: Unmanaged action (%s) in submitForm"
msgstr ""
"CORRIGEZ-MOI CORRIGEZ-MOI CORRIGEZ-MOI: Action non gérée (%s) dans "
"\"submitForm\""
#: sat.tac:542
#, python-format
msgid "setting param: %(name)s=%(value)s in category %(category)s"
msgstr ""
"Le paramètre %(name)s vaut désormais %(value)s dans la catégorie %(category)s"
#: sat.tac:552
msgid "asking connection status for a non-existant profile"
msgstr "demande de l'état de connexion pour un profile qui n'existe pas"
#: sat.tac:569
msgid "Incomplete data"
msgstr "Données incomplétes"
#: sat.tac:575
msgid "Unknown action type"
msgstr "Type d'action inconnu"
#: sat.tac:587
#, python-format
msgid "Sending jabber message to %s..."
msgstr "Envoi du message jabber à %s"
#: sat.tac:610
#, python-format
msgid "subsciption request [%(type)s] for %(jid)s"
msgstr "demande d'inscription [%(type)s] pour %(jid)s"
#: sat.tac:617
msgid "sending automatic \"to\" subscription request"
msgstr "envoi automatique de la demande d'inscription \"to\""
#: sat.tac:648
#, python-format
msgid "Feature found: %s"
msgstr "Fonctionnalité trouvée: %s"
#: sat.tac:651
#, python-format
msgid "Identity found: [%(category)s/%(type)s] %(identity)s"
msgstr "Identité trouvée: [%(category)s/%(type)s] %(identity)s"
#: sat.tac:671
msgid "type for actionResultExt must be DICT_DICT, fixing it"
msgstr "Le type pour actionResultExt doit être DICT_DICT, correction"
#: sat.tac:685
msgid "Attempt to register two callbacks for the same confirmation"
msgstr "Tentative de déclaration de 2 callbacks pour la même configuration"
#: sat.tac:693
#, python-format
msgid "Received confirmation answer for id [%(id)s]: %(success)s"
msgstr "Réponse pour confirmation reçu (id [%(id)s]): %(success)s"
#: sat.tac:693
msgid "refused"
msgstr "refusé"
#: sat.tac:695
msgid "Received an unknown confirmation"
msgstr "Confirmation inconnue reçue"
#: sat.tac:708
msgid "Trying to remove an unknow progress callback"
msgstr "Tentative d'effacement d'une callback de progression inconnue."
#: sat.tac:732
msgid "Trying to remove an unknow general callback"
msgstr "Tentative d'effacement d'une callback générale inconnue."
#: sat.tac:741
msgid "Trying to call unknown function"
msgstr "Tentative d'appel d'une fonction inconnue"
#: tools/memory.py:77
msgid "general params data loaded"
msgstr "Paramètres généraux chargés"
#: tools/memory.py:79
msgid "Can't load general params data !"
msgstr "Impossible de charger les paramètres généraux !"
#: tools/memory.py:85
msgid "individual params data loaded"
msgstr "Paramètres individuels chargés"
#: tools/memory.py:87
msgid "Can't load individual params data !"
msgstr "Impossible de charger les paramètres individuels !"
#: tools/memory.py:124
msgid "The profile name already exists"
msgstr "Ce nom de profile existe déjà"
#: tools/memory.py:133
msgid "Trying to delete an unknown profile"
msgstr "Tentative d'appel d'un profile inconnue"
#: tools/memory.py:149
msgid "No default profile, returning first one"
msgstr "Pas de profile par défaut, envoi du premier"
#: tools/memory.py:154
msgid "Trying to access an unknown profile"
msgstr "Tentative d'accès à un profile inconnu"
#: tools/memory.py:194
#, python-format
msgid "Can't determine default value for [%(category)s/%(name)s]: %(reason)s"
msgstr ""
"Impossible de déterminer la valeur par défaut pour [%(category)s/%(name)s]: %"
"(reason)s"
#: tools/memory.py:207 tools/memory.py:225
#, python-format
msgid "Requested param [%(name)s] in category [%(category)s] doesn't exist !"
msgstr ""
"Le paramètre demandé [%(name)s] dans la catégorie [%(category)s] n'existe "
"pas !"
#: tools/memory.py:236
msgid "Requesting a param for an non-existant profile"
msgstr "Demande d'un paramètre pour un profile inconnu"
#: tools/memory.py:290 tools/memory.py:303
msgid "Asking params for inexistant profile"
msgstr "Demande de paramètres pour un profile inconnu"
#: tools/memory.py:349
#, python-format
msgid "Requesting an unknown parameter (%(category)s/%(name)s)"
msgstr "Demande d'un paramètre inconnu: (%(category)s/%(name)s)"
#: tools/memory.py:361
msgid "Trying to set parameter for an unknown profile"
msgstr "Tentative d'assigner un paramètre à un profile inconnu"
#: tools/memory.py:375
msgid "Memory manager init"
msgstr "Initialisation du gestionnaire de mémoire"
#: tools/memory.py:402
msgid "params template loaded"
msgstr "Modèle des paramètres chargé"
#: tools/memory.py:404
msgid "Can't load params template !"
msgstr "Impossible de charger le modèle des paramètres !"
#: tools/memory.py:407
msgid "No params template, using default template"
msgstr "Pas de modèle de paramètres, utilisation du modèle par défaut"
#: tools/memory.py:412
msgid "params loaded"
msgstr "paramètres chargés"
#: tools/memory.py:414
msgid "Can't load params !"
msgstr "Impossible de charger les paramètres !"
#: tools/memory.py:421
msgid "history loaded"
msgstr "Historique chargée"
#: tools/memory.py:423
msgid "Can't load history !"
msgstr "Impossible de charger l'historique !"
#: tools/memory.py:430
msgid "private values loaded"
msgstr "Données privées chargées"
#: tools/memory.py:432
msgid "Can't load private values !"
msgstr "Impossible de charger les données privées !"
#: tools/memory.py:448
msgid "params saved"
msgstr "Paramètres sauvés"
#: tools/memory.py:451
msgid "history saved"
msgstr "Historique sauvée"
#: tools/memory.py:454
msgid "private values saved"
msgstr "Données privées sauvées"
#: tools/memory.py:497
msgid "source JID not found !"
msgstr "JID source introuvable !"
#: tools/memory.py:501
msgid "dest JID not found !"
msgstr "JID destination introuvable !"
#: tools/memory.py:528
msgid "Trying to add a contact to a non-existant profile"
msgstr "Tentative d'ajout d'un contact à un profile inexistant"
#: tools/memory.py:540
msgid "Trying to delete a contact for a non-existant profile"
msgstr "Tentative de suppression d'un contact pour un profile inexistant"
#: tools/memory.py:548
msgid "Asking a contact for a non-existant profile"
msgstr "Demande d'un contact pour un profile inexistant"
#: tools/memory.py:562 tools/memory.py:611
msgid "Asking contacts for a non-existant profile"
msgstr "Demande de contacts pour un profile inexistant"
#: tools/memory.py:573
msgid "Trying to add presence status to a non-existant profile"
msgstr "Tentative d'ajout d'informations de présence à un profile inexistant"
#: tools/memory.py:601
msgid "Asking waiting subscriptions for a non-existant profile"
msgstr "Demande des inscriptions en attente pour un profile inexistant"
#: plugins/plugin_xep_0054.py:62
msgid "Implementation of vcard-temp"
msgstr "Implementation de vcard-temp"
#: plugins/plugin_xep_0054.py:68
msgid "Plugin XEP_0054 initialization"
msgstr "Initialisation du plugin XEP_0054"
#: plugins/plugin_xep_0054.py:111
#, python-format
msgid "Photo of type [%s] found"
msgstr "Photo du type [%s] trouvée"
#: plugins/plugin_xep_0054.py:113
msgid "Decoding binary"
msgstr "Décodage des données"
#: plugins/plugin_xep_0054.py:120
#, python-format
msgid "file saved to %s"
msgstr "fichier enregistré dans %s"
#: plugins/plugin_xep_0054.py:122
#, python-format
msgid "file [%s] already in cache"
msgstr "fichier [%s] déjà en cache"
#: plugins/plugin_xep_0054.py:128
msgid "parsing vcard"
msgstr "Analyse de la vcard"
#: plugins/plugin_xep_0054.py:154
#, python-format
msgid "FIXME: [%s] VCard tag is not managed yet"
msgstr "CORRIGEZ-MOI: la balise VCard [%s] VCard n'est pas encore gérée"
#: plugins/plugin_xep_0054.py:160
msgid "VCard found"
msgstr "VCard trouvée"
#: plugins/plugin_xep_0054.py:166
msgid "FIXME: vCard not found as first child element"
msgstr "CORRIGEZ-MOI: la vCard n'est pas le premier élément enfant"
#: plugins/plugin_xep_0054.py:171
#, python-format
msgid "Can't find VCard of %s"
msgstr "Impossible de trouver la VCard de %s"
#: plugins/plugin_xep_0054.py:180
msgid "Asking vcard for an non-existant or not connected profile"
msgstr "Demande de vcard pour un profile inexistant ou non connecté"
#: plugins/plugin_xep_0054.py:183
#, python-format
msgid "Asking for %s's VCard"
msgstr "Demande de la VCard de %s"
#: plugins/plugin_xep_0054.py:198
#, python-format
msgid "Asking for an uncached avatar [%s]"
msgstr "Demande d'un avatar qui n'est pas en cache [%s]"
#: plugins/plugin_xep_0054.py:245
msgid "New avatar found, requesting vcard"
msgstr "Nouvel avatar trouvé, demande de vcard"
#: plugins/plugin_xep_0065.py:89
msgid "Implementation of SOCKS5 Bytestreams"
msgstr "Implémentation du « SOCKS5 Bytestreams » (flux d'octets SOCKS5)"
#: plugins/plugin_xep_0065.py:135
msgid "Protocol init"
msgstr "Initialisation du protocole"
#: plugins/plugin_xep_0065.py:217
#, python-format
msgid "Adding connection: %(address)s, %(connection)s"
msgstr "Ajout d'une connexion: %(address)s, %(connection)s"
#: plugins/plugin_xep_0065.py:313
#, python-format
msgid "Saving file in %s."
msgstr "Sauvegarde du fichier dans %s."
#: plugins/plugin_xep_0065.py:364
msgid "File transfer completed, closing connection"
msgstr "Transfert de fichier terminé, fermeture de la connexion"
#: plugins/plugin_xep_0065.py:438
msgid "Socks 5 server connection started"
msgstr "Connexion du serveur SOCKS 5 démarrée"
#: plugins/plugin_xep_0065.py:441
#, python-format
msgid "Socks 5 server connection lost (reason: %s)"
msgstr "Connexion du serveur SOCKS5 perdue (raison: %s)"
#: plugins/plugin_xep_0065.py:448
msgid "Socks 5 client connection started"
msgstr "Connexion du client SOCKS 5 démarrée"
#: plugins/plugin_xep_0065.py:451
#, python-format
msgid "Socks 5 client connection lost (reason: %s)"
msgstr "Connexion du client SOCKS5 perdue (raison: %s)"
#: plugins/plugin_xep_0065.py:468
msgid "Plugin XEP_0065 initialization"
msgstr "Initialisation du plugin XEP_0065"
#: plugins/plugin_xep_0065.py:470
msgid "registering"
msgstr "enregistrement"
#: plugins/plugin_xep_0065.py:480
#, python-format
msgid "Launching Socks5 Stream server on port %d"
msgstr "Lancement du serveur de flux Socks5 sur le port %d"
#: plugins/plugin_xep_0065.py:496
msgid "Launching socks5 initiator"
msgstr "Lancement de socks5 en mode initiateur"
#: plugins/plugin_xep_0065.py:511
#, python-format
msgid "Stream proposed: host=[%(host)s] port=[%(post)s]"
msgstr "Flux proposé: serveur=[%(host)s] port=[%(post)s]"
#: plugins/plugin_xep_0065.py:527
msgid "activating stream"
msgstr "Lancement du flux"
#: plugins/plugin_xep_0077.py:41
msgid "Implementation of in-band registration"
msgstr "Implémentation de l'enregistrement en ligne"
#: plugins/plugin_xep_0077.py:47
msgid "Plugin XEP_0077 initialization"
msgstr "Initialisation du plugin XEP_0077"
#: plugins/plugin_xep_0077.py:62
msgid "No data form found"
msgstr "Aucune donnée trouvée"
#: plugins/plugin_xep_0077.py:65
msgid "This gateway can't be managed by SàT, sorry :("
msgstr "Ce transport ne peut être gérée par SàT, désolé :("
#: plugins/plugin_xep_0077.py:86
msgid "Your are now unregistred"
msgstr "Vous êtes maintenant désinscrit"
#: plugins/plugin_xep_0077.py:90
#, python-format
msgid "Unregistration failure: %s"
msgstr "Échec de la désinscription: %s"
#: plugins/plugin_xep_0077.py:94
#, python-format
msgid "Unregistration failed: %s"
msgstr "Échec de la désinscription: %s"
#: plugins/plugin_xep_0077.py:116
msgid "Registration failed"
msgstr "Échec de l'inscription"
#: plugins/plugin_xep_0077.py:134 plugins/plugin_xep_0096.py:154
msgid "Asking for an non-existant or not connected profile"
msgstr "Demande d'un profile inexistant ou non connecté"
#: plugins/plugin_xep_0077.py:137
#, python-format
msgid "Asking registration for [%s]"
msgstr "Demande d'enregistrement pour [%s]"
#: plugins/plugin_xep_0096.py:52
msgid "Implementation of SI File Transfert"
msgstr ""
"Implémentation de l'initialisation de flux pour le transfert de fichier "
#: plugins/plugin_xep_0096.py:58
msgid "Plugin XEP_0096 initialization"
msgstr "Initialisation du plugin XEP_0096"
#: plugins/plugin_xep_0096.py:67
msgid "XEP-0096 management"
msgstr "Gestion de XEP-0096"
#: plugins/plugin_xep_0096.py:75
#, python-format
msgid "File proposed: name=[%(name)s] size=%(size)s"
msgstr "Fichier proposé: nom=[%(name)s] taille=%(size)s"
#: plugins/plugin_xep_0096.py:91
#, python-format
msgid "Transfert [%s] refused"
msgstr "Transfert [%s] refusé"
#: plugins/plugin_xep_0096.py:96
#, python-format
msgid "Transfert [%s] accepted"
msgstr "Transfert [%s] accepté"
#: plugins/plugin_xep_0096.py:99
msgid "Approved unknow id !"
msgstr "id inconnue approuvée !"
#: plugins/plugin_xep_0096.py:111
msgid "Feature negociation"
msgstr "Négociation de fonctionnalités"
#: plugins/plugin_xep_0100.py:37
msgid "Implementation of Gateways protocol"
msgstr "Implémentation du protocole de transports"
#: plugins/plugin_xep_0100.py:43
msgid "Gateways plugin initialization"
msgstr "Initialisation de l'extension pour les transports"
#: plugins/plugin_xep_0100.py:53
#, python-format
msgid "All items checked for id [%s]"
msgstr "Tous les points ont été vérifiés pour l'id [%s]"
#: plugins/plugin_xep_0100.py:64
#, python-format
msgid "Found gateway (%(jid)s): %(identity)s"
msgstr "Transport trouvé (%(jid)s): %(identity)s"
#: plugins/plugin_xep_0100.py:75
#, python-format
msgid "Error when discovering [%(jid)s]: %(condition)s"
msgstr "Erreur en analysant [%(jid)s]: %(condition)s"
#: plugins/plugin_xep_0100.py:84
msgid "No gateway found"
msgstr "Aucun transport trouvé"
#: plugins/plugin_xep_0100.py:90
#, python-format
msgid "item found: %s"
msgstr "object trouvé: %s"
#: plugins/plugin_xep_0100.py:96
msgid "Registration successful, doing the rest"
msgstr "Inscription réussie, lancement du reste de la procédure"
#: plugins/plugin_xep_0100.py:113
#, python-format
msgid "find gateways (target = %s)"
msgstr "transports trouvée (cible = %s)"

BIN
i18n/fr/LC_MESSAGES/sat.mo Normal file

Binary file not shown.

View file

@ -59,13 +59,13 @@ PLUGIN_INFO = {
"dependencies": [],
"main": "XEP_0054",
"handler": "yes",
"description": """Implementation of vcard-temp"""
"description": _("""Implementation of vcard-temp""")
}
class XEP_0054():
def __init__(self, host):
info("Plugin XEP_0054 initialization")
info(_("Plugin XEP_0054 initialization"))
self.host = host
self.avatar_path = os.path.expanduser(self.host.get_const('local_dir') + AVATAR_PATH)
self.vcard_cache = host.memory.getPrivate("vcard_cache") or {} #used to store nicknames and avatar, key = jid
@ -108,24 +108,24 @@ class XEP_0054():
"""Parse a <PHOTO> elem and save the picture"""
for elem in photo_xml.elements():
if elem.name == 'TYPE':
info('Photo of type [%s] found' % str(elem))
info(_('Photo of type [%s] found') % str(elem))
if elem.name == 'BINVAL':
debug('Decoding binary')
debug(_('Decoding binary'))
decoded = b64decode(str(elem))
hash = sha1(decoded).hexdigest()
filename = self.avatar_path+'/'+hash
if not os.path.exists(filename):
with open(filename,'wb') as file:
file.write(decoded)
debug("file saved to %s" % hash)
debug(_("file saved to %s") % hash)
else:
debug("file [%s] already in cache" % hash)
debug(_("file [%s] already in cache") % hash)
return hash
@defer.deferredGenerator
def vCard2Dict(self, vcard, target):
"""Convert a VCard to a dict, and save binaries"""
debug ("parsing vcard")
debug (_("parsing vcard"))
dictionary = {}
d = defer.Deferred()
@ -151,24 +151,24 @@ class XEP_0054():
else:
self.update_cache(target, 'avatar', dictionary['avatar'])
else:
info ('FIXME: [%s] VCard tag is not managed yet' % elem.name)
info (_('FIXME: [%s] VCard tag is not managed yet') % elem.name)
yield dictionary
def vcard_ok(self, answer):
"""Called after the first get IQ"""
debug ("VCard found")
debug (_("VCard found"))
if answer.firstChildElement().name == "vCard":
d = self.vCard2Dict(answer.firstChildElement(), jid.JID(answer["from"]))
d.addCallback(lambda data: self.host.bridge.actionResult("RESULT", answer['id'], data))
else:
error ("FIXME: vCard not found as first child element")
error (_("FIXME: vCard not found as first child element"))
self.host.bridge.actionResult("SUPPRESS", answer['id'], {}) #FIXME: maybe an error message would be best
def vcard_err(self, failure):
"""Called when something is wrong with registration"""
error ("Can't find VCard of %s" % failure.value.stanza['from'])
error (_("Can't find VCard of %s") % failure.value.stanza['from'])
self.host.bridge.actionResult("SUPPRESS", failure.value.stanza['id'], {}) #FIXME: maybe an error message would be best
def getCard(self, target, profile_key='@DEFAULT@'):
@ -177,10 +177,10 @@ class XEP_0054():
@result: id to retrieve the profile"""
current_jid, xmlstream = self.host.getJidNStream(profile_key)
if not xmlstream:
error ('Asking profile for an non-existant or not connected profile')
error (_('Asking vcard for an non-existant or not connected profile'))
return ""
to_jid = jid.JID(target)
debug("Asking for %s's VCard" % to_jid.userhost())
debug(_("Asking for %s's VCard") % to_jid.userhost())
reg_request=IQ(xmlstream,'get')
reg_request["from"]=current_jid.full()
reg_request["to"] = to_jid.userhost()
@ -195,7 +195,7 @@ class XEP_0054():
"""
filename = self.avatar_path+'/'+hash
if not os.path.exists(filename):
error ("Asking for an uncached avatar [%s]" % hash)
error (_("Asking for an uncached avatar [%s]") % hash)
return ""
return filename
@ -242,5 +242,5 @@ class XEP_0054_handler(XMPPHandler):
hash = str(elem)
old_avatar = self.plugin_parent.get_cache(to_jid, 'avatar')
if not old_avatar or old_avatar != hash:
debug('New avatar found, requesting vcard')
debug(_('New avatar found, requesting vcard'))
self.plugin_parent.getCard(to_jid.userhost(), self.parent.profile)

View file

@ -86,7 +86,7 @@ PLUGIN_INFO = {
"protocols": ["XEP-0065"],
"main": "XEP_0065",
"handler": "yes",
"description": """Implementation of SOCKS5 Bytestreams"""
"description": _("""Implementation of SOCKS5 Bytestreams""")
}
STATE_INITIAL = 0
@ -132,7 +132,7 @@ REPLY_ADDR_NOT_SUPPORTED = 0x08
class SOCKSv5(protocol.Protocol, FileSender):
def __init__(self):
debug("Protocol init")
debug(_("Protocol init"))
self.state = STATE_INITIAL
self.buf = ""
self.supportedAuthMechs = [ AUTHMECH_ANON ]
@ -214,7 +214,7 @@ class SOCKSv5(protocol.Protocol, FileSender):
self.transport.loseConnection()
def addConnection(self, address, connection):
info("Adding connection: %s, %s", address, connection)
info(_("Adding connection: %(address)s, %(connection)s") % {'address':address, 'connection':connection})
olist = self.pendingConns.get(address, [])
if len(olist) <= 1:
olist.append(connection)
@ -310,7 +310,7 @@ class SOCKSv5(protocol.Protocol, FileSender):
self.loseConnection()
return
debug("Saving file in %s.", self.data["dest_path"])
debug(_("Saving file in %s."), self.data["dest_path"])
self.dest_file = open(self.data["dest_path"], 'w')
self.state = STATE_TARGET_READY
self.activateCB(self.target_jid, self.initiator_jid, self.sid, self.IQ_id, self.xmlstream)
@ -328,7 +328,7 @@ class SOCKSv5(protocol.Protocol, FileSender):
self._startNegotiation()
def connectRequested(self, addr, port):
debug(("connectRequested"))
debug("connectRequested")
# Check for special connect to the namespace -- this signifies that the client
# is just checking to ensure it can connect to the streamhost
if addr == "http://jabber.org/protocol/bytestreams":
@ -361,7 +361,7 @@ class SOCKSv5(protocol.Protocol, FileSender):
data["position"] = ""
def fileTransfered(self, d):
info("File transfer completed, closing connection")
info(_("File transfer completed, closing connection"))
self.transport.loseConnection()
def updateTransfered(self, data):
@ -435,20 +435,20 @@ class Socks5ServerFactory(protocol.ServerFactory):
def startedConnecting(self, connector):
debug ("Socks 5 server connection started")
debug (_("Socks 5 server connection started"))
def clientConnectionLost(self, connector, reason):
debug ("Socks 5 server connection lost (reason: %s)", reason)
debug (_("Socks 5 server connection lost (reason: %s)"), reason)
class Socks5ClientFactory(protocol.ClientFactory):
protocol = SOCKSv5
protocol.mode = "target" #FIXME: Q&D way, fix it
def startedConnecting(self, connector):
debug ("Socks 5 client connection started")
debug (_("Socks 5 client connection started"))
def clientConnectionLost(self, connector, reason):
debug ("Socks 5 client connection lost (reason: %s)", reason)
debug (_("Socks 5 client connection lost (reason: %s)"), reason)
class XEP_0065():
@ -465,9 +465,9 @@ class XEP_0065():
"""
def __init__(self, host):
info("Plugin XEP_0065 initialization")
info(_("Plugin XEP_0065 initialization"))
self.host = host
debug("registering")
debug(_("registering"))
self.server_factory = Socks5ServerFactory()
self.server_factory.protocol.host = self.host #needed for progress CB
self.client_factory = Socks5ClientFactory()
@ -477,7 +477,7 @@ class XEP_0065():
host.memory.setDefault("IP", "File Transfert", self.getExternalIP)
port = int(self.host.memory.getParamA("Port", "File Transfert"))
info("Launching Socks5 Stream server on port %d", port)
info(_("Launching Socks5 Stream server on port %d"), port)
reactor.listenTCP(port, self.server_factory)
def getHandler(self):
@ -493,7 +493,7 @@ class XEP_0065():
def sendFile(self, id, filepath, size):
#lauching socks5 initiator
debug("Launching socks5 initiator")
debug(_("Launching socks5 initiator"))
self.server_factory.protocol.mode = "initiator"
self.server_factory.protocol.filepath = filepath
self.server_factory.protocol.filesize = size
@ -508,7 +508,7 @@ class XEP_0065():
IQ_id = iq['id']
for element in SI_elem.elements():
if element.name == "streamhost":
info ("Stream proposed: host=[%s] port=[%s]", element['host'], element['port'])
info (_("Stream proposed: host=[%(host)s] port=[%(post)s]") % {'host':element['host'], 'port':element['port']})
factory = self.client_factory
self.server_factory.protocol.mode = "target"
factory.protocol.host = self.host #needed for progress CB
@ -524,7 +524,7 @@ class XEP_0065():
reactor.connectTCP(element['host'], int(element['port']), factory)
def activateStream(self, from_jid, to_jid, sid, IQ_id, xmlstream):
debug("activating stream")
debug(_("activating stream"))
result = domish.Element(('', 'iq'))
result['type'] = 'result'
result['id'] = IQ_id

View file

@ -38,13 +38,13 @@ PLUGIN_INFO = {
"protocols": ["XEP-0077"],
"dependencies": [],
"main": "XEP_0077",
"description": """Implementation of in-band registration"""
"description": _("""Implementation of in-band registration""")
}
class XEP_0077():
def __init__(self, host):
info("Plugin XEP_0077 initialization")
info(_("Plugin XEP_0077 initialization"))
self.host = host
self.triggers = {} #used by other protocol (e.g. XEP-0100) to finish registration. key = target_jid
host.bridge.addMethod("in_band_register", ".communication", in_sign='ss', out_sign='s', method=self.in_band_register)
@ -59,10 +59,10 @@ class XEP_0077():
try:
x_elem = filter (lambda x:x.name == "x", answer.firstChildElement().elements())[0] #We only want the "x" element (data form)
except IndexError:
info("No data form found")
info(_("No data form found"))
#TODO: manage registration without data form
answer_data = {}
answer_data={"reason": "unmanaged", "message":"This gateway can't be managed by SàT, sorry :("}
answer_data={"reason": "unmanaged", "message":_("This gateway can't be managed by SàT, sorry :(")}
answer_type = "ERROR"
self.host.bridge.actionResult(answer_type, answer['id'], answer_data)
return
@ -73,7 +73,7 @@ class XEP_0077():
def reg_err(self, failure):
"""Called when something is wrong with registration"""
info ("Registration failure: %s" % str(failure.value))
info (_("Registration failure: %s") % str(failure.value))
answer_data = {}
answer_data['reason'] = 'unknown'
answer_data={"message":"%s [code: %s]" % (failure.value.condition, failure.value.code)}
@ -81,39 +81,39 @@ class XEP_0077():
self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data)
def unregistrationAnswer(self, answer):
debug ("registration answer: %s" % answer.toXml())
debug (_("registration answer: %s") % answer.toXml())
answer_type = "SUCCESS"
answer_data={"message":"Your are now unregistred"}
answer_data={"message":_("Your are now unregistred")}
self.host.bridge.actionResult(answer_type, answer['id'], answer_data)
def unregistrationFailure(self, failure):
info ("Unregistration failure: %s" % str(failure.value))
info (_("Unregistration failure: %s") % str(failure.value))
answer_type = "ERROR"
answer_data = {}
answer_data['reason'] = 'unknown'
answer_data={"message":"Unregistration failed: %s" % failure.value.condition}
answer_data={"message":_("Unregistration failed: %s") % failure.value.condition}
self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data)
def registrationAnswer(self, answer):
debug ("registration answer: %s" % answer.toXml())
debug (_("registration answer: %s") % answer.toXml())
answer_type = "SUCCESS"
answer_data={"message":"Registration successfull"}
answer_data={"message":_("Registration successfull")}
self.host.bridge.actionResult(answer_type, answer['id'], answer_data)
if self.triggers.has_key(answer["from"]):
self.triggers[answer["from"]](answer["from"])
del self.triggers[answer["from"]]
def registrationFailure(self, failure):
info ("Registration failure: %s" % str(failure.value))
info (_("Registration failure: %s") % str(failure.value))
print failure.value.stanza.toXml()
answer_type = "ERROR"
answer_data = {}
if failure.value.condition == 'conflict':
answer_data['reason'] = 'conflict'
answer_data={"message":"Username already exists, please choose an other one"}
answer_data={"message":_("Username already exists, please choose an other one")}
else:
answer_data['reason'] = 'unknown'
answer_data={"message":"Registration failed"}
answer_data={"message":_("Registration failed")}
self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data)
if self.triggers.has_key(answer["from"]):
del self.triggers[answer["from"]]
@ -131,10 +131,10 @@ class XEP_0077():
"""register to a target JID"""
current_jid, xmlstream = self.host.getJidNStream(profile_key)
if not xmlstream:
error ('Asking profile for an non-existant or not connected profile')
error (_('Asking for an non-existant or not connected profile'))
return ""
to_jid = jid.JID(target)
debug("Asking registration for [%s]" % to_jid.full())
debug(_("Asking registration for [%s]") % to_jid.full())
reg_request=IQ(xmlstream,'get')
reg_request["from"]=current_jid.full()
reg_request["to"] = to_jid.full()

View file

@ -49,13 +49,13 @@ PLUGIN_INFO = {
"dependencies": ["XEP_0065"],
"main": "XEP_0096",
"handler": "yes",
"description": """Implementation of SI File Transfert"""
"description": _("""Implementation of SI File Transfert""")
}
class XEP_0096():
def __init__(self, host):
info("Plugin XEP_0096 initialization")
info(_("Plugin XEP_0096 initialization"))
self.host = host
self._waiting_for_approval = {}
host.bridge.addMethod("sendFile", ".communication", in_sign='sss', out_sign='s', method=self.sendFile)
@ -64,7 +64,7 @@ class XEP_0096():
return XEP_0096_handler(self)
def xep_96(self, IQ, profile):
info ("XEP-0096 management")
info (_("XEP-0096 management"))
IQ.handled=True
SI_elem = IQ.firstChildElement()
debug(SI_elem.toXml())
@ -72,7 +72,7 @@ class XEP_0096():
file_size = ""
for element in SI_elem.elements():
if element.name == "file":
info ("File proposed: name=[%s] size=%s", element['name'], element['size'])
info (_("File proposed: name=[%(name)s] size=%(size)s") % {'name':element['name'], 'size':element['size']})
filename = element["name"]
file_size = element["size"]
elif element.name == "feature":
@ -88,15 +88,15 @@ class XEP_0096():
self.host.plugins["XEP_0065"].setData(data, id)
self.approved(id)
else:
debug ("Transfert [%s] refused", id)
debug (_("Transfert [%s] refused"), id)
del(self._waiting_for_approval[id])
def approved(self, id):
"""must be called when a file transfert has be accepted by client"""
debug ("Transfert [%s] accepted", id)
debug (_("Transfert [%s] accepted"), id)
if ( not self._waiting_for_approval.has_key(id) ):
error ("Approved unknow id !")
error (_("Approved unknow id !"))
#TODO: manage this (maybe approved by several frontends)
else:
element, from_id, size, profile = self._waiting_for_approval[id]
@ -108,7 +108,7 @@ class XEP_0096():
#FIXME: over ultra mega ugly, need to be generic
client = self.host.getClient(profile)
assert(client)
info ("Feature negociation")
info (_("Feature negociation"))
data = feat_elem.firstChildElement()
field = data.firstChildElement()
#FIXME: several options ! Q&D code for test only
@ -151,7 +151,7 @@ class XEP_0096():
"""
current_jid, xmlstream = self.host.getJidNStream(profile_key)
if not xmlstream:
error ('Asking profile for an non-existant or not connected profile')
error (_('Asking for an non-existant or not connected profile'))
return ""
debug ("sendfile (%s) to %s", filepath, to )
print type(filepath), type(to)

View file

@ -34,13 +34,13 @@ PLUGIN_INFO = {
"protocols": ["XEP-0100"],
"dependencies": ["XEP_0077"],
"main": "XEP_0100",
"description": """Implementation of Gateways protocol"""
"description": _("""Implementation of Gateways protocol""")
}
class XEP_0100():
def __init__(self, host):
info("Gateways plugin initialization")
info(_("Gateways plugin initialization"))
self.host = host
self.__gateways = {} #dict used to construct the answer to findGateways. Key = target jid
host.bridge.addMethod("findGateways", ".communication", in_sign='ss', out_sign='s', method=self.findGateways)
@ -50,7 +50,7 @@ class XEP_0100():
self.__gateways[request_id]['__handled_items']+=1
if self.__gateways[request_id]['__total_items'] == self.__gateways[request_id]['__handled_items']:
debug ("All items checked for id [%s]" % str(request_id))
debug (_("All items checked for id [%s]") % str(request_id))
del self.__gateways[request_id]['__total_items']
del self.__gateways[request_id]['__handled_items']
@ -61,7 +61,7 @@ class XEP_0100():
for identity in disco.identities:
if identity[0] == 'gateway':
print ("Found gateway (%s): %s" % (entity.full(), disco.identities[identity]))
print (_("Found gateway (%(jid)s): %(identity)s") % {'jid':entity.full(), 'identity':disco.identities[identity]})
self.__gateways[request_id][entity.full()] = {
'name':disco.identities[identity],
'type':identity[1]
@ -72,7 +72,7 @@ class XEP_0100():
def discoInfoErr(self, failure, entity, request_id):
"""Something is going wrong with disco"""
failure.trap(jab_error.StanzaError)
error("Error when discovering [%s]: %s" % (entity.full(), failure.value.condition))
error(_("Error when discovering [%(jid)s]: %(condition)s") % {'jid':entity.full(), 'condition':failure.value.condition})
self.__inc_handled_items(request_id)
@ -81,19 +81,19 @@ class XEP_0100():
#FIXME: target is used as we can't find the original iq node (parent is None)
# an other way would avoid this useless parameter (is there a way with wokkel ?)
if len(disco._items) == 0:
debug ("No gateway found")
debug (_("No gateway found"))
self.host.actionResultExt(request_id,"DICT_DICT",{})
return
self.__gateways[request_id] = {'__total_items':len(disco._items), '__handled_items':0, '__private__':{'target':target.full()}}
for item in disco._items:
debug ("item found: %s", item.name)
debug (_("item found: %s"), item.name)
client.disco.requestInfo(item.entity).addCallback(self.discoInfo, entity=item.entity, request_id=request_id)
client.disco.requestInfo(item.entity).addErrback(self.discoInfoErr, entity=item.entity, request_id=request_id)
def registrationSuccessful(self, target):
"""Called when in_band registration is ok, we must now follow the rest of procedure"""
print "Registration successful, doing the rest"
debug (_("Registration successful, doing the rest"))
self.host.addContact(target)
self.host.setPresence(target)
@ -109,9 +109,8 @@ class XEP_0100():
"""
client = self.host.getClient(profile_key)
assert(client)
print "target ===>", target
to_jid = jid.JID(target)
debug ("find gateways (target = %s)" % to_jid.full())
debug (_("find gateways (target = %s)") % to_jid.full())
request_id = self.host.get_next_id()
client.disco.requestItems(to_jid).addCallback(self.discoItems, request_id=request_id, target = to_jid, client = client)
return request_id

635
sat.po Normal file
View file

@ -0,0 +1,635 @@
# 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-03 16:51+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=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: sat.tac:88
#, python-format
msgid "********** [%s] CONNECTED **********"
msgstr ""
#: sat.tac:94
msgid "XML stream is initialized"
msgstr ""
#: sat.tac:114
#, python-format
msgid "********** [%s] DISCONNECTED **********"
msgstr ""
#: sat.tac:118
msgid "No keep_alife"
msgstr ""
#: sat.tac:129
#, python-format
msgid "got message from: %s"
msgstr ""
#: sat.tac:171
#, python-format
msgid "new contact in roster list: %s"
msgstr ""
#: sat.tac:178
#, python-format
msgid "removing %s from roster list"
msgstr ""
#: sat.tac:188
#, python-format
msgid "presence update for [%s]"
msgstr ""
#: sat.tac:218
#, python-format
msgid "subscription approved for [%s]"
msgstr ""
#: sat.tac:223
#, python-format
msgid "unsubscription confirmed for [%s]"
msgstr ""
#: sat.tac:228
#, python-format
msgid "subscription request for [%s]"
msgstr ""
#: sat.tac:233
#, python-format
msgid "unsubscription asked for [%s]"
msgstr ""
#: sat.tac:259
msgid "Registration asked for"
msgstr ""
#: sat.tac:277 plugins/plugin_xep_0077.py:84 plugins/plugin_xep_0077.py:98
#, python-format
msgid "registration answer: %s"
msgstr ""
#: sat.tac:279 plugins/plugin_xep_0077.py:100
msgid "Registration successfull"
msgstr ""
#: sat.tac:284 plugins/plugin_xep_0077.py:76 plugins/plugin_xep_0077.py:107
#, python-format
msgid "Registration failure: %s"
msgstr ""
#: sat.tac:289 plugins/plugin_xep_0077.py:113
msgid "Username already exists, please choose an other one"
msgstr ""
#: sat.tac:292
#, python-format
msgid "Registration failed (%s)"
msgstr ""
#: sat.tac:305
msgid "Trying to access an undefined constant"
msgstr ""
#: sat.tac:312
msgid "Trying to redefine a constant"
msgstr ""
#: sat.tac:373
#, python-format
msgid "importing plugin: %s"
msgstr ""
#: sat.tac:387
msgid "Trying to connect a non-exsitant profile"
msgstr ""
#: sat.tac:391
msgid "already connected !"
msgstr ""
#: sat.tac:415
msgid "setting plugins parents"
msgstr ""
#: sat.tac:426
msgid "not connected !"
msgstr ""
#: sat.tac:429
msgid "Disconnecting..."
msgstr ""
#: sat.tac:441
msgid "running app"
msgstr ""
#: sat.tac:445
msgid "stopping app"
msgstr ""
#: sat.tac:483
msgid "No user or server given"
msgstr ""
#: sat.tac:485
msgid "No user, password or server given, can't register new account."
msgstr ""
#: sat.tac:492
#, python-format
msgid "Are you sure to register new account [%(user)s] to server %(server)s ?"
msgstr ""
#: sat.tac:500
#, python-format
msgid "register Confirmation CB ! (%s)"
msgstr ""
#: sat.tac:532
#, python-format
msgid "FIXME FIXME FIXME: Unmanaged action (%s) in submitForm"
msgstr ""
#: sat.tac:542
#, python-format
msgid "setting param: %(name)s=%(value)s in category %(category)s"
msgstr ""
#: sat.tac:552
msgid "asking connection status for a non-existant profile"
msgstr ""
#: sat.tac:569
msgid "Incomplete data"
msgstr ""
#: sat.tac:575
msgid "Unknown action type"
msgstr ""
#: sat.tac:587
#, python-format
msgid "Sending jabber message to %s..."
msgstr ""
#: sat.tac:610
#, python-format
msgid "subsciption request [%(type)s] for %(jid)s"
msgstr ""
#: sat.tac:617
msgid "sending automatic \"to\" subscription request"
msgstr ""
#: sat.tac:648
#, python-format
msgid "Feature found: %s"
msgstr ""
#: sat.tac:651
#, python-format
msgid "Identity found: [%(category)s/%(type)s] %(identity)s"
msgstr ""
#: sat.tac:671
msgid "type for actionResultExt must be DICT_DICT, fixing it"
msgstr ""
#: sat.tac:685
msgid "Attempt to register two callbacks for the same confirmation"
msgstr ""
#: sat.tac:693
#, python-format
msgid "Received confirmation answer for id [%(id)s]: %(success)s"
msgstr ""
#: sat.tac:693
msgid "refused"
msgstr ""
#: sat.tac:695
msgid "Received an unknown confirmation"
msgstr ""
#: sat.tac:708
msgid "Trying to remove an unknow progress callback"
msgstr ""
#: sat.tac:732
msgid "Trying to remove an unknow general callback"
msgstr ""
#: sat.tac:741
msgid "Trying to call unknown function"
msgstr ""
#: tools/memory.py:77
msgid "general params data loaded"
msgstr ""
#: tools/memory.py:79
msgid "Can't load general params data !"
msgstr ""
#: tools/memory.py:85
msgid "individual params data loaded"
msgstr ""
#: tools/memory.py:87
msgid "Can't load individual params data !"
msgstr ""
#: tools/memory.py:124
msgid "The profile name already exists"
msgstr ""
#: tools/memory.py:133
msgid "Trying to delete an unknown profile"
msgstr ""
#: tools/memory.py:149
msgid "No default profile, returning first one"
msgstr ""
#: tools/memory.py:154
msgid "Trying to access an unknown profile"
msgstr ""
#: tools/memory.py:194
#, python-format
msgid "Can't determine default value for [%(category)s/%(name)s]: %(reason)s"
msgstr ""
#: tools/memory.py:207 tools/memory.py:225
#, python-format
msgid "Requested param [%(name)s] in category [%(category)s] doesn't exist !"
msgstr ""
#: tools/memory.py:236
msgid "Requesting a param for an non-existant profile"
msgstr ""
#: tools/memory.py:290 tools/memory.py:303
msgid "Asking params for inexistant profile"
msgstr ""
#: tools/memory.py:349
#, python-format
msgid "Requesting an unknown parameter (%(category)s/%(name)s)"
msgstr ""
#: tools/memory.py:361
msgid "Trying to set parameter for an unknown profile"
msgstr ""
#: tools/memory.py:375
msgid "Memory manager init"
msgstr ""
#: tools/memory.py:402
msgid "params template loaded"
msgstr ""
#: tools/memory.py:404
msgid "Can't load params template !"
msgstr ""
#: tools/memory.py:407
msgid "No params template, using default template"
msgstr ""
#: tools/memory.py:412
msgid "params loaded"
msgstr ""
#: tools/memory.py:414
msgid "Can't load params !"
msgstr ""
#: tools/memory.py:421
msgid "history loaded"
msgstr ""
#: tools/memory.py:423
msgid "Can't load history !"
msgstr ""
#: tools/memory.py:430
msgid "private values loaded"
msgstr ""
#: tools/memory.py:432
msgid "Can't load private values !"
msgstr ""
#: tools/memory.py:448
msgid "params saved"
msgstr ""
#: tools/memory.py:451
msgid "history saved"
msgstr ""
#: tools/memory.py:454
msgid "private values saved"
msgstr ""
#: tools/memory.py:497
msgid "source JID not found !"
msgstr ""
#: tools/memory.py:501
msgid "dest JID not found !"
msgstr ""
#: tools/memory.py:528
msgid "Trying to add a contact to a non-existant profile"
msgstr ""
#: tools/memory.py:540
msgid "Trying to delete a contact for a non-existant profile"
msgstr ""
#: tools/memory.py:548
msgid "Asking a contact for a non-existant profile"
msgstr ""
#: tools/memory.py:562 tools/memory.py:611
msgid "Asking contacts for a non-existant profile"
msgstr ""
#: tools/memory.py:573
msgid "Trying to add presence status to a non-existant profile"
msgstr ""
#: tools/memory.py:601
msgid "Asking waiting subscriptions for a non-existant profile"
msgstr ""
#: plugins/plugin_xep_0054.py:62
msgid "Implementation of vcard-temp"
msgstr ""
#: plugins/plugin_xep_0054.py:68
msgid "Plugin XEP_0054 initialization"
msgstr ""
#: plugins/plugin_xep_0054.py:111
#, python-format
msgid "Photo of type [%s] found"
msgstr ""
#: plugins/plugin_xep_0054.py:113
msgid "Decoding binary"
msgstr ""
#: plugins/plugin_xep_0054.py:120
#, python-format
msgid "file saved to %s"
msgstr ""
#: plugins/plugin_xep_0054.py:122
#, python-format
msgid "file [%s] already in cache"
msgstr ""
#: plugins/plugin_xep_0054.py:128
msgid "parsing vcard"
msgstr ""
#: plugins/plugin_xep_0054.py:154
#, python-format
msgid "FIXME: [%s] VCard tag is not managed yet"
msgstr ""
#: plugins/plugin_xep_0054.py:160
msgid "VCard found"
msgstr ""
#: plugins/plugin_xep_0054.py:166
msgid "FIXME: vCard not found as first child element"
msgstr ""
#: plugins/plugin_xep_0054.py:171
#, python-format
msgid "Can't find VCard of %s"
msgstr ""
#: plugins/plugin_xep_0054.py:180
msgid "Asking vcard for an non-existant or not connected profile"
msgstr ""
#: plugins/plugin_xep_0054.py:183
#, python-format
msgid "Asking for %s's VCard"
msgstr ""
#: plugins/plugin_xep_0054.py:198
#, python-format
msgid "Asking for an uncached avatar [%s]"
msgstr ""
#: plugins/plugin_xep_0054.py:245
msgid "New avatar found, requesting vcard"
msgstr ""
#: plugins/plugin_xep_0065.py:89
msgid "Implementation of SOCKS5 Bytestreams"
msgstr ""
#: plugins/plugin_xep_0065.py:135
msgid "Protocol init"
msgstr ""
#: plugins/plugin_xep_0065.py:217
#, python-format
msgid "Adding connection: %(address)s, %(connection)s"
msgstr ""
#: plugins/plugin_xep_0065.py:313
#, python-format
msgid "Saving file in %s."
msgstr ""
#: plugins/plugin_xep_0065.py:364
msgid "File transfer completed, closing connection"
msgstr ""
#: plugins/plugin_xep_0065.py:438
msgid "Socks 5 server connection started"
msgstr ""
#: plugins/plugin_xep_0065.py:441
#, python-format
msgid "Socks 5 server connection lost (reason: %s)"
msgstr ""
#: plugins/plugin_xep_0065.py:448
msgid "Socks 5 client connection started"
msgstr ""
#: plugins/plugin_xep_0065.py:451
#, python-format
msgid "Socks 5 client connection lost (reason: %s)"
msgstr ""
#: plugins/plugin_xep_0065.py:468
msgid "Plugin XEP_0065 initialization"
msgstr ""
#: plugins/plugin_xep_0065.py:470
msgid "registering"
msgstr ""
#: plugins/plugin_xep_0065.py:480
#, python-format
msgid "Launching Socks5 Stream server on port %d"
msgstr ""
#: plugins/plugin_xep_0065.py:496
msgid "Launching socks5 initiator"
msgstr ""
#: plugins/plugin_xep_0065.py:511
#, python-format
msgid "Stream proposed: host=[%(host)s] port=[%(post)s]"
msgstr ""
#: plugins/plugin_xep_0065.py:527
msgid "activating stream"
msgstr ""
#: plugins/plugin_xep_0077.py:41
msgid "Implementation of in-band registration"
msgstr ""
#: plugins/plugin_xep_0077.py:47
msgid "Plugin XEP_0077 initialization"
msgstr ""
#: plugins/plugin_xep_0077.py:62
msgid "No data form found"
msgstr ""
#: plugins/plugin_xep_0077.py:65
msgid "This gateway can't be managed by SàT, sorry :("
msgstr ""
#: plugins/plugin_xep_0077.py:86
msgid "Your are now unregistred"
msgstr ""
#: plugins/plugin_xep_0077.py:90
#, python-format
msgid "Unregistration failure: %s"
msgstr ""
#: plugins/plugin_xep_0077.py:94
#, python-format
msgid "Unregistration failed: %s"
msgstr ""
#: plugins/plugin_xep_0077.py:116
msgid "Registration failed"
msgstr ""
#: plugins/plugin_xep_0077.py:134 plugins/plugin_xep_0096.py:154
msgid "Asking for an non-existant or not connected profile"
msgstr ""
#: plugins/plugin_xep_0077.py:137
#, python-format
msgid "Asking registration for [%s]"
msgstr ""
#: plugins/plugin_xep_0096.py:52
msgid "Implementation of SI File Transfert"
msgstr ""
#: plugins/plugin_xep_0096.py:58
msgid "Plugin XEP_0096 initialization"
msgstr ""
#: plugins/plugin_xep_0096.py:67
msgid "XEP-0096 management"
msgstr ""
#: plugins/plugin_xep_0096.py:75
#, python-format
msgid "File proposed: name=[%(name)s] size=%(size)s"
msgstr ""
#: plugins/plugin_xep_0096.py:91
#, python-format
msgid "Transfert [%s] refused"
msgstr ""
#: plugins/plugin_xep_0096.py:96
#, python-format
msgid "Transfert [%s] accepted"
msgstr ""
#: plugins/plugin_xep_0096.py:99
msgid "Approved unknow id !"
msgstr ""
#: plugins/plugin_xep_0096.py:111
msgid "Feature negociation"
msgstr ""
#: plugins/plugin_xep_0100.py:37
msgid "Implementation of Gateways protocol"
msgstr ""
#: plugins/plugin_xep_0100.py:43
msgid "Gateways plugin initialization"
msgstr ""
#: plugins/plugin_xep_0100.py:53
#, python-format
msgid "All items checked for id [%s]"
msgstr ""
#: plugins/plugin_xep_0100.py:64
#, python-format
msgid "Found gateway (%(jid)s): %(identity)s"
msgstr ""
#: plugins/plugin_xep_0100.py:75
#, python-format
msgid "Error when discovering [%(jid)s]: %(condition)s"
msgstr ""
#: plugins/plugin_xep_0100.py:84
msgid "No gateway found"
msgstr ""
#: plugins/plugin_xep_0100.py:90
#, python-format
msgid "item found: %s"
msgstr ""
#: plugins/plugin_xep_0100.py:96
msgid "Registration successful, doing the rest"
msgstr ""
#: plugins/plugin_xep_0100.py:113
#, python-format
msgid "find gateways (target = %s)"
msgstr ""

102
sat.tac
View file

@ -25,6 +25,7 @@ CONST = {
'local_dir' : '~/.sat'
}
from twisted.application import internet, service
from twisted.internet import glib2reactor, protocol, task
glib2reactor.install()
@ -49,6 +50,9 @@ from tools.memory import Memory
from tools.xml_tools import XMLTools
from glob import glob
import gettext
gettext.install('sat', "i18n", unicode=True)
try:
from twisted.words.protocols.xmlstream import XMPPHandler
except ImportError:
@ -81,13 +85,13 @@ class SatXMPPClient(client.XMPPClient):
print "SatXMPPClient"
client.XMPPClient._authd(self, xmlstream)
self.__connected=True
print "********** [%s] CONNECTED **********" % self.profile
info (_("********** [%s] CONNECTED **********") % self.profile)
self.streamInitialized()
self.host_app.bridge.connected(self.profile) #we send the signal to the clients
def streamInitialized(self):
"""Called after _authd"""
debug ("XML stream is initialized")
debug (_("XML stream is initialized"))
self.keep_alife = task.LoopingCall(self.xmlstream.send, " ") #Needed to avoid disconnection (specially with openfire)
self.keep_alife.start(180)
@ -107,11 +111,11 @@ class SatXMPPClient(client.XMPPClient):
def connectionLost(self, connector, unused_reason):
self.__connected=False
print "********** [%s] DISCONNECTED **********" % self.profile
info (_("********** [%s] DISCONNECTED **********") % self.profile)
try:
self.keep_alife.stop()
except AttributeError:
debug("No keep_alife")
debug (_("No keep_alife"))
self.host_app.bridge.disconnected(self.profile) #we send the signal to the clients
@ -122,7 +126,7 @@ class SatMessageProtocol(xmppim.MessageProtocol):
self.host = host
def onMessage(self, message):
debug (u"got_message from: %s", message["from"])
debug (_(u"got message from: %s"), message["from"])
for e in message.elements():
if e.name == "body":
type = message['type'] if message.hasAttribute('type') else 'chat' #FIXME: check specs
@ -164,14 +168,14 @@ class SatRosterProtocol(xmppim.RosterClientProtocol):
}
if item.name:
item_attr['name'] = item.name
info ("new contact in roster list: %s", item.jid.full())
info (_("new contact in roster list: %s"), item.jid.full())
self.host.memory.addContact(item.jid, item_attr, item.groups, self.parent.profile)
self.host.bridge.newContact(item.jid.full(), item_attr, item.groups, self.parent.profile)
def onRosterRemove(self, entity):
"""Called when a roster removal event is received"""
#TODO: send a signal to frontends
print "removing %s from roster list" % entity.full()
print _("removing %s from roster list") % entity.full()
self.host.memory.delContact(entity, self.parent.profile)
class SatPresenceProtocol(xmppim.PresenceClientProtocol):
@ -181,7 +185,7 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
self.host = host
def availableReceived(self, entity, show=None, statuses=None, priority=0):
info ("presence update for [%s]", entity)
info (_("presence update for [%s]"), entity)
if statuses.has_key(None): #we only want string keys
statuses["default"] = statuses[None]
@ -211,22 +215,22 @@ class SatPresenceProtocol(xmppim.PresenceClientProtocol):
xmppim.PresenceClientProtocol.available(self, entity, show, statuses, priority)
def subscribedReceived(self, entity):
debug ("subscription approved for [%s]" % entity.userhost())
debug (_("subscription approved for [%s]") % entity.userhost())
self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
self.host.bridge.subscribe('subscribed', entity.userhost(), self.parent.profile)
def unsubscribedReceived(self, entity):
debug ("unsubscription confirmed for [%s]" % entity.userhost())
debug (_("unsubscription confirmed for [%s]") % entity.userhost())
self.host.memory.delWaitingSub(entity.userhost(), self.parent.profile)
self.host.bridge.subscribe('unsubscribed', entity.userhost(), self.parent.profile)
def subscribeReceived(self, entity):
debug ("subscription request for [%s]" % entity.userhost())
debug (_("subscription request for [%s]") % entity.userhost())
self.host.memory.addWaitingSub('subscribe', entity.userhost(), self.parent.profile)
self.host.bridge.subscribe('subscribe', entity.userhost(), self.parent.profile)
def unsubscribeReceived(self, entity):
debug ("unsubscription asked for [%s]" % entity.userhost())
debug (_("unsubscription asked for [%s]") % entity.userhost())
self.host.memory.addWaitingSub('unsubscribe', entity.userhost(), self.parent.profile)
self.host.bridge.subscribe('unsubscribe', entity.userhost(), self.parent.profile)
@ -252,7 +256,7 @@ class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
self.user_login = user_login
self.user_pass = user_pass
self.answer_id = answer_id
print "Registration asked for",user_login, user_pass, jabber_host
print _("Registration asked for"),user_login, user_pass, jabber_host
def connectionMade(self):
print "connectionMade"
@ -270,22 +274,22 @@ class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
reg = iq.send(self.jabber_host).addCallbacks(self.registrationAnswer, self.registrationFailure)
def registrationAnswer(self, answer):
debug ("registration answer: %s" % answer.toXml())
debug (_("registration answer: %s") % answer.toXml())
answer_type = "SUCCESS"
answer_data={"message":"Registration successfull"}
answer_data={"message":_("Registration successfull")}
self.host.bridge.actionResult(answer_type, self.answer_id, answer_data)
self.xmlstream.sendFooter()
def registrationFailure(self, failure):
info ("Registration failure: %s" % str(failure.value))
info (_("Registration failure: %s") % str(failure.value))
answer_type = "ERROR"
answer_data = {}
if failure.value.condition == 'conflict':
answer_data['reason'] = 'conflict'
answer_data={"message":"Username already exists, please choose an other one"}
answer_data={"message":_("Username already exists, please choose an other one")}
else:
answer_data['reason'] = 'unknown'
answer_data={"message":"Registration failed (%s)" % str(failure.value.condition)}
answer_data={"message":_("Registration failed (%s)") % str(failure.value.condition)}
self.host.bridge.actionResult(answer_type, self.answer_id, answer_data)
self.xmlstream.sendFooter()
@ -298,14 +302,14 @@ class SAT(service.Service):
def get_const(self, name):
"""Return a constant"""
if not CONST.has_key(name):
error('Trying to access an undefined constant')
error(_('Trying to access an undefined constant'))
raise Exception
return CONST[name]
def set_const(self, name, value):
"""Save a constant"""
if CONST.has_key(name):
error('Trying to redefine a constant')
error(_('Trying to redefine a constant'))
raise Exception
CONST[name] = value
@ -366,7 +370,7 @@ class SAT(service.Service):
__import__(plug_path)
mod = sys.modules[plug_path]
plug_info = mod.PLUGIN_INFO
info ("importing plugin: %s", plug_info['name'])
info (_("importing plugin: %s"), plug_info['name'])
self.plugins[plug_info['import_name']] = getattr(mod, plug_info['main'])(self)
if plug_info.has_key('handler') and plug_info['handler'] == 'yes':
self.plugins[plug_info['import_name']].is_handler = True
@ -380,11 +384,11 @@ class SAT(service.Service):
profile = self.memory.getProfileName(profile_key)
if not profile_key:
error ('Trying to connect a non-exsitant profile')
error (_('Trying to connect a non-exsitant profile'))
return
if (self.isConnected()):
info("already connected !")
info(_("already connected !"))
return
print "connecting..."
current = self.profiles[profile] = SatXMPPClient(self, profile,
@ -408,7 +412,7 @@ class SAT(service.Service):
self.get_const('client_version'))
current.versionHandler.setHandlerParent(current)
debug ("setting plugins parents")
debug (_("setting plugins parents"))
for plugin in self.plugins.iteritems():
if plugin[1].is_handler:
@ -419,10 +423,10 @@ class SAT(service.Service):
def disconnect(self, profile_key='@DEFAULT@'):
"""disconnect from jabber server"""
if (not self.isConnected(profile_key)):
info("not connected !")
info(_("not connected !"))
return
profile = self.memory.getProfileName(profile_key)
info("Disconnecting...")
info(_("Disconnecting..."))
self.profiles[profile].stopService()
def startService(self):
@ -434,11 +438,11 @@ class SAT(service.Service):
info("Salut aussi à Rantanplan")
def run(self):
debug("running app")
debug(_("running app"))
reactor.run()
def stop(self):
debug("stopping app")
debug(_("stopping app"))
reactor.stop()
## Misc methods ##
@ -476,16 +480,16 @@ class SAT(service.Service):
server = self.memory.getParamA("Server", "Connection")
if not user or not password or not server:
info ('No user or server given')
info (_('No user or server given'))
#TODO: a proper error message must be sent to frontend
self.actionResult(id, "ERROR", {'message':"No user, password or server given, can't register new account."})
self.actionResult(id, "ERROR", {'message':_("No user, password or server given, can't register new account.")})
return
confirm_id = sat_next_id()
self.__private_data[confirm_id]=id
self.askConfirmation(confirm_id, "YES/NO",
{"message":"Are you sure to register new account [%s] to server %s ?" % (user, server)},
{"message":_("Are you sure to register new account [%(user)s] to server %(server)s ?") % {'user':user, 'server':server}},
self.regisConfirmCB)
print ("===============+++++++++++ REGISTER NEW ACCOUNT++++++++++++++============")
print "id=",id
@ -493,7 +497,7 @@ class SAT(service.Service):
def regisConfirmCB(self, id, accepted, data):
#FIXME: gof: profile not managed here !
print "register Confirmation CB ! (%s)" % str(accepted)
print _("register Confirmation CB ! (%s)") % str(accepted)
action_id = self.__private_data[id]
del self.__private_data[id]
user = jid.parse(self.memory.getParamA("JabberID", "Connection"))[0]
@ -525,7 +529,7 @@ class SAT(service.Service):
elif action=='CANCEL':
query.addElement('remove')
else:
error ("FIXME FIXME FIXME: Unmanaged action (%s) in submitForm" % action)
error (_("FIXME FIXME FIXME: Unmanaged action (%s) in submitForm") % action)
raise NotImplementedError
deferred = iq.send(target)
@ -535,7 +539,7 @@ class SAT(service.Service):
def setParam(self, name, value, category, profile_key='@DEFAULT@'):
"""set wanted paramater and notice observers"""
info ("setting param: %s=%s in category %s", name, value, category)
info (_("setting param: %(name)s=%(value)s in category %(category)s") % {'name':name, 'value':value, 'category':category})
self.memory.setParam(name, value, category, profile_key)
def isConnected(self, profile_key='@DEFAULT@'):
@ -545,7 +549,7 @@ class SAT(service.Service):
"""
profile = self.memory.getProfileName(profile_key)
if not profile:
error ('asking connection status for a non-existant profile')
error (_('asking connection status for a non-existant profile'))
raise Exception #TODO: raise a proper exception
if not self.profiles.has_key(profile):
return False
@ -562,13 +566,13 @@ class SAT(service.Service):
try:
cb_name = self.memory.getParamA(data["name"], data["category"], "callback")
except KeyError:
error ("Incomplete data")
error (_("Incomplete data"))
return ""
id = sat_next_id()
self.callGeneralCB(cb_name, id, data)
return id
else:
error ("Unknown action type")
error (_("Unknown action type"))
return ""
@ -580,7 +584,7 @@ class SAT(service.Service):
profile = self.memory.getProfileName(profile_key)
assert(profile)
current_jid = self.profiles[profile].jid
debug("Sending jabber message to %s...", to)
debug(_("Sending jabber message to %s..."), to)
message = domish.Element(('jabber:client','message'))
message["to"] = jid.JID(to).full()
message["from"] = current_jid.full()
@ -603,14 +607,14 @@ class SAT(service.Service):
profile = self.memory.getProfileName(profile_key)
assert(profile)
to_jid = jid.JID(raw_jid)
debug ('subsciption request [%s] for %s', type, to_jid.full())
debug (_('subsciption request [%(type)s] for %(jid)s') % {'type':type, 'jid':to_jid.full()})
if type=="subscribe":
self.profiles[profile].presence.subscribe(to_jid)
elif type=="subscribed":
self.profiles[profile].subscribed(to_jid)
contact = self.memory.getContact(to_jid)
if not contact or not bool(contact['to']): #we automatically subscribe to 'to' presence
debug('sending automatic "to" subscription request')
debug(_('sending automatic "to" subscription request'))
self.subscription('subscribe', to_jid.userhost())
elif type=="unsubscribe":
self.profiles[profile].presence.unsubscribe(to_jid)
@ -641,10 +645,10 @@ class SAT(service.Service):
def serverDisco(self, disco):
"""xep-0030 Discovery Protocol."""
for feature in disco.features:
debug ("Feature found: %s",feature)
debug (_("Feature found: %s"),feature)
self.server_features.append(feature)
for cat, type in disco.identities:
debug ("Identity found: [%s/%s] %s" % (cat, type, disco.identities[(cat,type)]))
debug (_("Identity found: [%(category)s/%(type)s] %(identity)s") % {'category':cat, 'type':type, 'identity':disco.identities[(cat,type)]})
## Generic HMI ##
@ -664,7 +668,7 @@ class SAT(service.Service):
@param data: dictionary of dictionaries
"""
if type != "DICT_DICT":
error("type for actionResultExt must be DICT_DICT, fixing it")
error(_("type for actionResultExt must be DICT_DICT, fixing it"))
type = "DICT_DICT"
self.bridge.actionResultExt(type, id, data)
@ -678,7 +682,7 @@ class SAT(service.Service):
@param cb: callback called with the answer
"""
if self.__waiting_conf.has_key(id):
error ("Attempt to register two callbacks for the same confirmation")
error (_("Attempt to register two callbacks for the same confirmation"))
else:
self.__waiting_conf[id] = cb
self.bridge.askConfirmation(type, id, data)
@ -686,9 +690,9 @@ class SAT(service.Service):
def confirmationAnswer(self, id, accepted, data):
"""Called by frontends to answer confirmation requests"""
debug ("Received confirmation answer for id [%s]: %s", id, "accepted" if accepted else "refused")
debug (_("Received confirmation answer for id [%(id)s]: %(success)s") % {'id': id, 'success':u("accepted") if accepted else _("refused")})
if not self.__waiting_conf.has_key(id):
error ("Received an unknown confirmation")
error (_("Received an unknown confirmation"))
else:
cb = self.__waiting_conf[id]
del self.__waiting_conf[id]
@ -701,7 +705,7 @@ class SAT(service.Service):
def removeProgressCB(self, id):
"""Remove a progress callback"""
if not self.__progress_cb_map.has_key(id):
error ("Trying to remove an unknow progress callback")
error (_("Trying to remove an unknow progress callback"))
else:
del self.__progress_cb_map[id]
@ -725,7 +729,7 @@ class SAT(service.Service):
def removeGeneralCB(self, name):
"""Remove a general callback"""
if not self.__general_cb_map.has_key(name):
error ("Trying to remove an unknow general callback")
error (_("Trying to remove an unknow general callback"))
else:
del self.__general_cb_map[name]
@ -734,7 +738,7 @@ class SAT(service.Service):
try:
return self.__general_cb_map[name](*args, **kwargs)
except KeyError:
error("Trying to call unknown function")
error(_("Trying to call unknown function"))
return None
application = service.Application('SàT')

View file

@ -74,17 +74,17 @@ class Param():
try:
with open(file_gen, 'r') as file_gen_pickle:
self.params_gen=pickle.load(file_gen_pickle)
debug("general params data loaded")
debug(_("general params data loaded"))
except:
error ("Can't load general params data !")
error (_("Can't load general params data !"))
if os.path.exists(file_ind):
try:
with open(file_ind, 'r') as file_ind_pickle:
self.params=pickle.load(file_ind_pickle)
debug("individual params data loaded")
debug(_("individual params data loaded"))
except:
error ("Can't load individual params data !")
error (_("Can't load individual params data !"))
def save_xml(self, file):
"""Save parameters template to xml file"""
@ -121,7 +121,7 @@ class Param():
"""Create a new profile
@param name: Name of the profile"""
if self.params.has_key(name):
info ('The profile name already exists')
info (_('The profile name already exists'))
return 1
self.params[name]={}
return 0
@ -130,7 +130,7 @@ class Param():
"""Delete an existing profile
@param name: Name of the profile"""
if not self.params.has_key(name):
error ('Trying to delete an unknown profile')
error (_('Trying to delete an unknown profile'))
return 1
del self.params[name]
return 0
@ -146,12 +146,12 @@ class Param():
return ""
default = self.host.memory.getPrivate('Profile_default')
if not default or not default in self.params:
info('No default profile, returning first one') #TODO: manage real default profile
info(_('No default profile, returning first one')) #TODO: manage real default profile
default = self.params.keys()[0]
self.host.memory.setPrivate('Profile_default', default)
return default #FIXME: gof: temporary, must use real default value, and fallback to first one if it doesn't exists
if not self.params.has_key(profile_key):
info ('Trying to access an unknown profile')
info (_('Trying to access an unknown profile'))
return ""
return profile_key
@ -191,7 +191,7 @@ class Param():
self.setParam(name, value, category) #FIXME: better to set param xml value ???
def __default_ko(self, failure, name, category):
error ("Can't determine default value for [%s/%s]: %s" % (category, name, str(failure.value)))
error (_("Can't determine default value for [%(category)s/%(name)s]: %(reason)s") % {'category':category, 'name':name, 'reason':str(failure.value)})
def setDefault(self, name, category, callback, errback=None):
"""Set default value of parameter
@ -204,7 +204,7 @@ class Param():
#TODO: send signal param update if value changed
node = self.__getParamNode(name, category, '@ALL@')
if not node:
error("Requested param [%s] in category [%s] doesn't exist !" , name, category)
error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name':name, 'category':category})
return
if node[1].getAttribute('default_cb') == 'yes':
del node[1].attributes['default_cb']
@ -222,7 +222,7 @@ class Param():
@return: attribute"""
node = self.__getParamNode(name, category)
if not node:
error("Requested param [%s] in category [%s] doesn't exist !" , name, category)
error(_("Requested param [%(name)s] in category [%(category)s] doesn't exist !") % {'name':name, 'category':category})
return None
if node[0] == 'general':
@ -233,7 +233,7 @@ class Param():
profile = self.getProfileName(profile_key)
if not profile:
error('Requesting a param for an non-existant profile')
error(_('Requesting a param for an non-existant profile'))
return None
if attr == "value":
@ -287,7 +287,7 @@ class Param():
Take params xml as skeleton"""
profile = self.getProfileName(profile_key)
if not profile:
error("Asking params for inexistant profile")
error(_("Asking params for inexistant profile"))
return ""
prof_xml = self.__constructProfileXml(profile)
return_xml = prof_xml.toxml()
@ -300,7 +300,7 @@ class Param():
#TODO: manage category of general type (without existant profile)
profile = self.getProfileName(profile_key)
if not profile:
error("Asking params for inexistant profile")
error(_("Asking params for inexistant profile"))
return ""
prof_xml = self.__constructProfileXml(profile)
@ -346,7 +346,7 @@ class Param():
node = self.__getParamNode(name, category, '@ALL@')
if not node:
error('Requesting an unknown parameter (%s/%s)' % (category, name))
error(_('Requesting an unknown parameter (%(category)s/%(name)s)') % {'category':category, 'name':name})
return
if node[0] == 'general':
@ -358,7 +358,7 @@ class Param():
profile = self.getProfileName(profile_key)
if not profile:
error('Trying to set parameter for an unknown profile')
error(_('Trying to set parameter for an unknown profile'))
return #TODO: throw an error
type = node[1].getAttribute("type")
@ -372,7 +372,7 @@ class Memory:
"""This class manage all persistent informations"""
def __init__(self, host):
info ("Memory manager init")
info (_("Memory manager init"))
self.host = host
self.contacts={}
self.presenceStatus={}
@ -399,37 +399,37 @@ class Memory:
if os.path.exists(param_file_xml):
try:
self.params.load_xml(param_file_xml)
debug("params template loaded")
debug(_("params template loaded"))
except:
error ("Can't load params template !")
error (_("Can't load params template !"))
self.params.load_default_params()
else:
info ("No params template, using default template")
info (_("No params template, using default template"))
self.params.load_default_params()
try:
self.params.load_data(param_file_data)
debug("params loaded")
debug(_("params loaded"))
except:
error ("Can't load params !")
error (_("Can't load params !"))
#history
if os.path.exists(history_file):
try:
with open(history_file, 'r') as history_pickle:
self.history=pickle.load(history_pickle)
debug("history loaded")
debug(_("history loaded"))
except:
error ("Can't load history !")
error (_("Can't load history !"))
#private
if os.path.exists(private_file):
try:
with open(private_file, 'r') as private_pickle:
self.private=pickle.load(private_pickle)
debug("private values loaded")
debug(_("private values loaded"))
except:
error ("Can't load private values !")
error (_("Can't load private values !"))
def save(self):
"""Save parameters and all memory things to file/db"""
@ -445,13 +445,13 @@ class Memory:
self.params.save_xml(param_file_xml)
self.params.save_data(param_file_data)
debug("params saved")
debug(_("params saved"))
with open(history_file, 'w') as history_pickle:
pickle.dump(self.history, history_pickle)
debug("history saved")
debug(_("history saved"))
with open(private_file, 'w') as private_pickle:
pickle.dump(self.private, private_pickle)
debug("private values saved")
debug(_("private values saved"))
def getProfilesList(self):
return self.params.getProfilesList()
@ -494,11 +494,11 @@ class Memory:
def getHistory(self, from_jid, to_jid, size):
ret={}
if not self.history.has_key(from_jid):
error("source JID not found !")
error(_("source JID not found !"))
#TODO: throw an error here
return {}
if not self.history[from_jid].has_key(to_jid):
error("dest JID not found !")
error(_("dest JID not found !"))
#TODO: throw an error here
return {}
stamps=self.history[from_jid][to_jid].keys()
@ -525,7 +525,7 @@ class Memory:
debug("Memory addContact: %s",contact_jid.userhost())
profile = self.getProfileName(profile_key)
if not profile:
error ('Trying to add a contact to a non-existant profile')
error (_('Trying to add a contact to a non-existant profile'))
return
assert(isinstance(attributes,dict))
assert(isinstance(groups,set))
@ -537,7 +537,7 @@ class Memory:
debug("Memory delContact: %s",contact_jid.userhost())
profile = self.getProfileName(profile_key)
if not profile:
error ('Trying to delete a contact for a non-existant profile')
error (_('Trying to delete a contact for a non-existant profile'))
return
if self.contacts.has_key(profile) and self.contacts[profile].has_key(contact_jid.userhost()):
del self.contacts[profile][contact_jid.userhost()]
@ -545,7 +545,7 @@ class Memory:
def getContact(self, contact_jid, profile_key='@DEFAULT@'):
profile = self.getProfileName(profile_key)
if not profile:
error('Asking a contact for a non-existant profile')
error(_('Asking a contact for a non-existant profile'))
return None
if self.contacts.has_key(profile) and self.contacts[profile].has_key(contact_jid.userhost()):
self.contacts[profile][contact_jid.userhost()]
@ -559,7 +559,7 @@ class Memory:
debug ("Memory getContact OK (%s)", self.contacts)
profile = self.getProfileName(profile_key)
if not profile:
error('Asking contacts for a non-existant profile')
error(_('Asking contacts for a non-existant profile'))
return []
ret=[]
for contact in self.contacts[profile]:
@ -570,7 +570,7 @@ class Memory:
def addPresenceStatus(self, contact_jid, show, priority, statuses, profile_key='@DEFAULT@'):
profile = self.getProfileName(profile_key)
if not profile:
error('Trying to add presence status to a non-existant profile')
error(_('Trying to add presence status to a non-existant profile'))
return
if not self.presenceStatus.has_key(profile):
self.presenceStatus[profile] = {}
@ -598,7 +598,7 @@ class Memory:
"""Called to get a list of currently waiting subscription requests"""
profile = self.getProfileName(profile_key)
if not profile:
error('Asking waiting subscriptions for a non-existant profile')
error(_('Asking waiting subscriptions for a non-existant profile'))
return {}
if not self.subscriptions.has_key(profile):
return {}
@ -608,7 +608,7 @@ class Memory:
def getPresenceStatus(self, profile_key='@DEFAULT@'):
profile = self.getProfileName(profile_key)
if not profile:
error('Asking contacts for a non-existant profile')
error(_('Asking contacts for a non-existant profile'))
return {}
if not self.presenceStatus.has_key(profile):
self.presenceStatus[profile] = {}