Mercurial > libervia-backend
diff plugins/plugin_xep_0096.py @ 69:86f1f7f6d332
i18n first draft
- gettext support added in SàT
- first draft of french translation
- added README with a HOWTO for translators
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 03 Mar 2010 17:12:23 +1100 |
parents | d46f849664aa |
children | f271fff3a713 |
line wrap: on
line diff
--- a/plugins/plugin_xep_0096.py Thu Feb 25 17:09:18 2010 +1100 +++ b/plugins/plugin_xep_0096.py Wed Mar 03 17:12:23 2010 +1100 @@ -49,13 +49,13 @@ "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 @@ 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 @@ 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 @@ 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 @@ #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 @@ """ 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)