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

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)