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:
parent
595a594b64
commit
4a293cdaa1
1 changed files with 1463 additions and 153 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue