i18n support for internationalisation

This commit is contained in:
Yann Leboulanger 2004-05-16 23:47:14 +00:00
parent 87363cc247
commit 6e84e5746b
9 changed files with 840 additions and 81 deletions

Binary file not shown.

View File

@ -0,0 +1,704 @@
# French translations for gajim package
# Traduction anglaise du package gajim.
# Copyright (C) 2004 THE gajim'S COPYRIGHT HOLDER
# This file is distributed under the same license as the gajim package.
# Automatically generated, 2004.
#
msgid ""
msgstr ""
"Project-Id-Version: gajim 2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-05-16 19:40-0400\n"
"PO-Revision-Date: 2004-05-16 19:40-0400\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: runCore.py:34
msgid "Core Stopped"
msgstr ""
#: plugins/gtkgui/toto.c:7 plugins/gtkgui/toto.c:35
msgid "Gajim"
msgstr ""
#: plugins/gtkgui/toto.c:8
msgid "_Menu"
msgstr ""
#: plugins/gtkgui/toto.c:9
msgid "_Preferences"
msgstr ""
#: plugins/gtkgui/toto.c:10
msgid "A_ccounts"
msgstr ""
#: plugins/gtkgui/toto.c:11
msgid "_Browse agents"
msgstr ""
#: plugins/gtkgui/toto.c:12
msgid "Add"
msgstr ""
#: plugins/gtkgui/toto.c:13
msgid "Show Offline"
msgstr ""
#: plugins/gtkgui/toto.c:14
msgid "_About"
msgstr ""
#: plugins/gtkgui/toto.c:15
msgid "_Quit"
msgstr ""
#: plugins/gtkgui/toto.c:16 plugins/gtkgui/gtkgui.py:658
msgid "Online"
msgstr ""
#: plugins/gtkgui/toto.c:17 plugins/gtkgui/gtkgui.py:661
msgid "Away"
msgstr ""
#: plugins/gtkgui/toto.c:18 plugins/gtkgui/gtkgui.py:664
msgid "NA"
msgstr ""
#: plugins/gtkgui/toto.c:19 plugins/gtkgui/gtkgui.py:667
msgid "DND"
msgstr ""
#: plugins/gtkgui/toto.c:20
msgid "Invisible"
msgstr ""
#: plugins/gtkgui/toto.c:21 plugins/gtkgui/gtkgui.py:672
msgid "Offline"
msgstr ""
#: plugins/gtkgui/toto.c:22
msgid "Chat"
msgstr ""
#: plugins/gtkgui/toto.c:23 plugins/gtkgui/gtkgui.py:585
msgid "History"
msgstr ""
#: plugins/gtkgui/toto.c:24
msgid "Clear"
msgstr ""
#: plugins/gtkgui/toto.c:25
msgid "Anonymous <id@server/res>"
msgstr ""
#: plugins/gtkgui/toto.c:26
msgid "Accounts"
msgstr ""
#: plugins/gtkgui/toto.c:27
msgid "_Modify"
msgstr ""
#: plugins/gtkgui/toto.c:28 plugins/gtkgui/toto.c:148
#: plugins/gtkgui/toto.c:184
msgid "About"
msgstr ""
#: plugins/gtkgui/toto.c:29
msgid "Account Modification"
msgstr ""
#: plugins/gtkgui/toto.c:30
msgid "Name : "
msgstr ""
#: plugins/gtkgui/toto.c:31 plugins/gtkgui/toto.c:36 plugins/gtkgui/toto.c:37
#: plugins/gtkgui/toto.c:38 plugins/gtkgui/toto.c:43 plugins/gtkgui/toto.c:45
#: plugins/gtkgui/toto.c:54 plugins/gtkgui/toto.c:74 plugins/gtkgui/toto.c:93
#: plugins/gtkgui/toto.c:101 plugins/gtkgui/toto.c:108
#: plugins/gtkgui/toto.c:120 plugins/gtkgui/toto.c:121
#: plugins/gtkgui/toto.c:122 plugins/gtkgui/toto.c:123
#: plugins/gtkgui/toto.c:124 plugins/gtkgui/toto.c:125
#: plugins/gtkgui/toto.c:132 plugins/gtkgui/toto.c:133
#: plugins/gtkgui/toto.c:134 plugins/gtkgui/toto.c:135
#: plugins/gtkgui/toto.c:136 plugins/gtkgui/toto.c:137
#: plugins/gtkgui/toto.c:143 plugins/gtkgui/toto.c:144
#: plugins/gtkgui/toto.c:145 plugins/gtkgui/toto.c:146
#: plugins/gtkgui/toto.c:156 plugins/gtkgui/toto.c:157
#: plugins/gtkgui/toto.c:158 plugins/gtkgui/toto.c:159
#: plugins/gtkgui/toto.c:160 plugins/gtkgui/toto.c:161
#: plugins/gtkgui/toto.c:168 plugins/gtkgui/toto.c:169
#: plugins/gtkgui/toto.c:170 plugins/gtkgui/toto.c:171
#: plugins/gtkgui/toto.c:172 plugins/gtkgui/toto.c:173
#: plugins/gtkgui/toto.c:179 plugins/gtkgui/toto.c:180
#: plugins/gtkgui/toto.c:181 plugins/gtkgui/toto.c:182
msgid "*"
msgstr ""
#: plugins/gtkgui/toto.c:32
msgid "Ressource: "
msgstr ""
#: plugins/gtkgui/toto.c:33
msgid "Password:"
msgstr ""
#: plugins/gtkgui/toto.c:34
msgid "Jabber ID:"
msgstr ""
#: plugins/gtkgui/toto.c:39
msgid "Register new account"
msgstr ""
#: plugins/gtkgui/toto.c:40
msgid "<b>Account</b>"
msgstr ""
#: plugins/gtkgui/toto.c:41
msgid "Empty"
msgstr ""
#: plugins/gtkgui/toto.c:42
msgid "<b>Preferences</b>"
msgstr ""
#: plugins/gtkgui/toto.c:44
msgid "Port:"
msgstr ""
#: plugins/gtkgui/toto.c:46
msgid "Host:"
msgstr ""
#: plugins/gtkgui/toto.c:47
msgid "Use proxy"
msgstr ""
#: plugins/gtkgui/toto.c:48
msgid "Proxy"
msgstr ""
#: plugins/gtkgui/toto.c:49
msgid "<b>Connection</b>"
msgstr ""
#: plugins/gtkgui/toto.c:50
msgid "Edit personal details..."
msgstr ""
#: plugins/gtkgui/toto.c:51
msgid "<b>Details</b>"
msgstr ""
#: plugins/gtkgui/toto.c:52
msgid "Add user"
msgstr ""
#: plugins/gtkgui/toto.c:53
msgid "Send subscription to :"
msgstr ""
#: plugins/gtkgui/toto.c:55 plugins/gtkgui/gtkgui.py:572
msgid "I would like to add you to my contact list, please."
msgstr ""
#: plugins/gtkgui/toto.c:56
msgid "Subscribe"
msgstr ""
#: plugins/gtkgui/toto.c:57
msgid "Sure ?"
msgstr ""
#: plugins/gtkgui/toto.c:58
msgid "Subscription request"
msgstr ""
#: plugins/gtkgui/toto.c:59
msgid "Subscription request from"
msgstr ""
#: plugins/gtkgui/toto.c:60 plugins/gtkgui/toto.c:65
msgid "_Close"
msgstr ""
#: plugins/gtkgui/toto.c:61
msgid "_Deny"
msgstr ""
#: plugins/gtkgui/toto.c:62
msgid "_Authorize"
msgstr ""
#: plugins/gtkgui/toto.c:63
msgid "Agents browser"
msgstr ""
#: plugins/gtkgui/toto.c:64
msgid "_Refresh"
msgstr ""
#: plugins/gtkgui/toto.c:66
msgid "Register to"
msgstr ""
#: plugins/gtkgui/toto.c:67
msgid "_OK"
msgstr ""
#: plugins/gtkgui/toto.c:68
msgid "_Cancel"
msgstr ""
#: plugins/gtkgui/toto.c:69
msgid "Warning"
msgstr ""
#: plugins/gtkgui/toto.c:70 plugins/gtkgui/toto.c:90
msgid "Message"
msgstr ""
#: plugins/gtkgui/toto.c:71
msgid "Look&Feel"
msgstr ""
#: plugins/gtkgui/toto.c:72 plugins/gtkgui/toto.c:83
msgid "Events"
msgstr ""
#: plugins/gtkgui/toto.c:73 plugins/gtkgui/toto.c:89
msgid "Presence"
msgstr ""
#: plugins/gtkgui/toto.c:75
msgid "Icon Style"
msgstr ""
#: plugins/gtkgui/toto.c:76
msgid "Outgoing Messages"
msgstr ""
#: plugins/gtkgui/toto.c:77
msgid "Status Messages"
msgstr ""
#: plugins/gtkgui/toto.c:78
msgid "Incoming Messages"
msgstr ""
#: plugins/gtkgui/toto.c:79
msgid "Color"
msgstr ""
#: plugins/gtkgui/toto.c:80
msgid "Look"
msgstr ""
#: plugins/gtkgui/toto.c:81
msgid "checkbutton5"
msgstr ""
#: plugins/gtkgui/toto.c:82
msgid "AutoPopup"
msgstr ""
#: plugins/gtkgui/toto.c:84
msgid "Auto Away After"
msgstr ""
#: plugins/gtkgui/toto.c:85 plugins/gtkgui/toto.c:87
msgid "Minutes"
msgstr ""
#: plugins/gtkgui/toto.c:86
msgid "Auto eXtanded Away After"
msgstr ""
#: plugins/gtkgui/toto.c:88
msgid "Auto Status"
msgstr ""
#: plugins/gtkgui/toto.c:91
msgid "Enter your message :"
msgstr ""
#: plugins/gtkgui/toto.c:92
msgid "Or choose your message :"
msgstr ""
#: plugins/gtkgui/toto.c:94
msgid "Information"
msgstr ""
#: plugins/gtkgui/toto.c:95
msgid "name"
msgstr ""
#: plugins/gtkgui/toto.c:96
msgid "ID"
msgstr ""
#: plugins/gtkgui/toto.c:97
msgid "id"
msgstr ""
#: plugins/gtkgui/toto.c:98
msgid "status"
msgstr ""
#: plugins/gtkgui/toto.c:99 plugins/gtkgui/gtkgui.py:653
msgid "Status"
msgstr ""
#: plugins/gtkgui/toto.c:100 plugins/gtkgui/toto.c:114
#: plugins/gtkgui/toto.c:150
msgid "Name"
msgstr ""
#: plugins/gtkgui/toto.c:102
msgid "Resource :"
msgstr ""
#: plugins/gtkgui/toto.c:103
msgid "resource"
msgstr ""
#: plugins/gtkgui/toto.c:104
msgid "Subscription :"
msgstr ""
#: plugins/gtkgui/toto.c:105
msgid "sub"
msgstr ""
#: plugins/gtkgui/toto.c:106 plugins/gtkgui/toto.c:126
#: plugins/gtkgui/toto.c:162
msgid "General"
msgstr ""
#: plugins/gtkgui/toto.c:107
msgid "New Group :"
msgstr ""
#: plugins/gtkgui/toto.c:109
msgid "Available groups"
msgstr ""
#: plugins/gtkgui/toto.c:110
msgid "Add ->"
msgstr ""
#: plugins/gtkgui/toto.c:111
msgid "<- Remove"
msgstr ""
#: plugins/gtkgui/toto.c:112
msgid "Current groups"
msgstr ""
#: plugins/gtkgui/toto.c:113
msgid "Groups"
msgstr ""
#: plugins/gtkgui/toto.c:115 plugins/gtkgui/toto.c:151
msgid "Nickname"
msgstr ""
#: plugins/gtkgui/toto.c:116 plugins/gtkgui/toto.c:152
msgid "Birthday"
msgstr ""
#: plugins/gtkgui/toto.c:117 plugins/gtkgui/toto.c:153
msgid "E-Mail"
msgstr ""
#: plugins/gtkgui/toto.c:118 plugins/gtkgui/toto.c:154
msgid "Homepage"
msgstr ""
#: plugins/gtkgui/toto.c:119 plugins/gtkgui/toto.c:155
msgid "Phone #"
msgstr ""
#: plugins/gtkgui/toto.c:127 plugins/gtkgui/toto.c:163
msgid "Street"
msgstr ""
#: plugins/gtkgui/toto.c:128 plugins/gtkgui/toto.c:164
msgid "City"
msgstr ""
#: plugins/gtkgui/toto.c:129 plugins/gtkgui/toto.c:165
msgid "State"
msgstr ""
#: plugins/gtkgui/toto.c:130 plugins/gtkgui/toto.c:166
msgid "Postal Code"
msgstr ""
#: plugins/gtkgui/toto.c:131 plugins/gtkgui/toto.c:167
msgid "Country"
msgstr ""
#: plugins/gtkgui/toto.c:138 plugins/gtkgui/toto.c:174
msgid "Location"
msgstr ""
#: plugins/gtkgui/toto.c:139 plugins/gtkgui/toto.c:175
msgid "Company"
msgstr ""
#: plugins/gtkgui/toto.c:140 plugins/gtkgui/toto.c:176
msgid "Department"
msgstr ""
#: plugins/gtkgui/toto.c:141 plugins/gtkgui/toto.c:177
msgid "Position"
msgstr ""
#: plugins/gtkgui/toto.c:142 plugins/gtkgui/toto.c:178
msgid "Role"
msgstr ""
#: plugins/gtkgui/toto.c:147 plugins/gtkgui/toto.c:183
msgid "Work"
msgstr ""
#: plugins/gtkgui/toto.c:149
msgid "jid"
msgstr ""
#: plugins/gtkgui/toto.c:185
msgid "Publish"
msgstr ""
#: plugins/gtkgui/toto.c:186
msgid "Retrieve"
msgstr ""
#: plugins/gtkgui/toto.c:187
msgid "Close"
msgstr ""
#: plugins/gtkgui/toto.c:188
msgid "Log"
msgstr ""
#: plugins/gtkgui/toto.c:189
msgid "earliest"
msgstr ""
#: plugins/gtkgui/toto.c:190
msgid "Previous"
msgstr ""
#: plugins/gtkgui/toto.c:191
msgid "latest"
msgstr ""
#: plugins/gtkgui/config.py:100 plugins/gtkgui/config.py:473
msgid "You must be connected to get your informations"
msgstr ""
#: plugins/gtkgui/config.py:104
msgid "You must be connected to publish your informations"
msgstr ""
#: plugins/gtkgui/config.py:386
msgid "You must enter a name for this account"
msgstr ""
#: plugins/gtkgui/config.py:389
msgid "Spaces are not permited in account name"
msgstr ""
#: plugins/gtkgui/config.py:392
msgid ""
"You must enter a Jabber ID for this account\n"
"For example : login@hostname"
msgstr ""
#: plugins/gtkgui/config.py:398
msgid "Proxy Port must be a port number"
msgstr ""
#: plugins/gtkgui/config.py:437
msgid "An account already has this name"
msgstr ""
#: plugins/gtkgui/config.py:532
#, python-format
msgid "Are you sure you want to remove this account (%s) ?"
msgstr ""
#: plugins/gtkgui/config.py:632
#, python-format
msgid "Register to %s"
msgstr ""
#: plugins/gtkgui/config.py:706
msgid "You must be connected to view Agents"
msgstr ""
#: plugins/gtkgui/dialogs.py:299
#, python-format
msgid "Subscription request from %s"
msgstr ""
#: plugins/gtkgui/gtkgui.py:57
msgid "bad arguments"
msgstr ""
#: plugins/gtkgui/gtkgui.py:279
msgid "Status is now : "
msgstr ""
#: plugins/gtkgui/gtkgui.py:525
#, python-format
msgid "%s is now %s (%s)"
msgstr ""
#: plugins/gtkgui/gtkgui.py:553
msgid "Start chat"
msgstr ""
#: plugins/gtkgui/gtkgui.py:556
msgid "Rename"
msgstr ""
#: plugins/gtkgui/gtkgui.py:561
msgid "Subscription"
msgstr ""
#: plugins/gtkgui/gtkgui.py:566
msgid "Resend authorization to"
msgstr ""
#: plugins/gtkgui/gtkgui.py:569
msgid "Rerequest authorization from"
msgstr ""
#: plugins/gtkgui/gtkgui.py:576
msgid "Remove"
msgstr ""
#: plugins/gtkgui/gtkgui.py:582
msgid "Informations"
msgstr ""
#: plugins/gtkgui/gtkgui.py:595
msgid "grp1"
msgstr ""
#: plugins/gtkgui/gtkgui.py:597
msgid "grp2"
msgstr ""
#: plugins/gtkgui/gtkgui.py:599
msgid "grp3"
msgstr ""
#: plugins/gtkgui/gtkgui.py:612
msgid "Log on"
msgstr ""
#: plugins/gtkgui/gtkgui.py:618
msgid "Log off"
msgstr ""
#: plugins/gtkgui/gtkgui.py:679
msgid "Edit account"
msgstr ""
#: plugins/gtkgui/gtkgui.py:722
#, python-format
msgid "Are you sure you want to remove %s (%s) from your roster ?"
msgstr ""
#: plugins/gtkgui/gtkgui.py:753
msgid "You must setup an account before connecting to jabber network."
msgstr ""
#: plugins/gtkgui/gtkgui.py:840
msgid "plugin gtkgui stopped"
msgstr ""
#: plugins/gtkgui/gtkgui.py:1215
#, python-format
msgid "You are now authorized by %s"
msgstr ""
#: plugins/gtkgui/gtkgui.py:1217
#, python-format
msgid "You are now unsubscribed by %s"
msgstr ""
#: plugins/gtkgui/gtkgui.py:1226
#, python-format
msgid "error contacting %s"
msgstr ""
#: plugins/gtkgui/gtkgui.py:1332
msgid "plugin gtkgui loaded"
msgstr ""
#: plugins/logger/logger.py:44
msgid "plugin logger stopped"
msgstr ""
#: plugins/logger/logger.py:97
msgid "creating ~/.gajim/"
msgstr ""
#: plugins/logger/logger.py:102
msgid "creating ~/.gajim/logs/"
msgstr ""
#: plugins/logger/logger.py:109
msgid "plugin logger loaded"
msgstr ""
#: core/core.py:75
#, python-format
msgid "Can't create %s"
msgstr ""
#: core/core.py:80
#, python-format
msgid "creating %s"
msgstr ""
#: core/core.py:154 core/core.py:334
msgid "I would like to add you to my roster."
msgstr ""
#: core/core.py:211
#, python-format
msgid "Couldn't connect to %s"
msgstr ""
#: core/core.py:217
#, python-format
msgid "Couldn't connect to %s : %s"
msgstr ""
#: core/core.py:249
#, python-format
msgid "Authentification failed with %s, check your login and password"
msgstr ""
#: core/core.py:454
#, python-format
msgid "Unknown Command %s"
msgstr ""
#: core/core.py:508
msgid "Keyboard Interrupt : Bye!"
msgstr ""

38
common/i18n.py Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env python
## common/i18n.py
##
## Gajim Team:
## - Yann Le Boulanger <asterix@crans.org>
## - Vincent Hanquez <tab@tuxfamily.org>
##
## Copyright (C) 2003 Gajim Team
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 2 only.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
APP='gajim'
DIR='Messages'
import locale, gettext
_translation = None
def init():
global _translation
try:
_translation = gettext.translation(APP, DIR)
except IOError:
_translation = gettext.NullTranslations()
def _(s):
if s == '':
return s
assert s
return _translation.gettext(s)

View File

@ -28,6 +28,9 @@ import common.hub
import common.jabber
import common.optparser
from common import i18n
_ = i18n._
log = logging.getLogger('core.core')
log.setLevel(logging.DEBUG)
@ -69,12 +72,12 @@ class GajimCore:
try:
os.mkdir(os.path.expanduser(path))
except:
print "Can't create %s" % path
print _("Can't create %s") % path
sys.exit
try:
os.stat(fname)
except:
print "creating %s" % fname
print _("creating %s") % fname
fic = open(fname, "w")
fic.write("[Profile]\naccounts = \nlog = 0\n\n[Core]\ndelauth = 1\nalwaysauth = 0\nmodules = logger gtkgui\ndelroster = 1\n")
fic.close()
@ -148,7 +151,7 @@ class GajimCore:
else:
txt = prs.getStatus()
if not txt:
txt = "I would like to add you to my roster."
txt = _("I would like to add you to my roster.")
self.hub.sendPlugin('SUBSCRIBE', self.connexions[con], (who, 'txt'))
elif type == 'subscribed':
jid = prs.getFrom()
@ -205,13 +208,13 @@ class GajimCore:
except IOError, e:
log.debug("Couldn't connect to %s %s" % (hostname, e))
self.hub.sendPlugin('STATUS', account, 'offline')
self.hub.sendPlugin('WARNING', None, "Couldn't connect to %s" \
self.hub.sendPlugin('WARNING', None, _("Couldn't connect to %s") \
% hostname)
return 0
except common.xmlstream.socket.error, e:
log.debug("Couldn't connect to %s %s" % (hostname, e))
self.hub.sendPlugin('STATUS', account, 'offline')
self.hub.sendPlugin('WARNING', None, "Couldn't connect to %s : %s" \
self.hub.sendPlugin('WARNING', None, _("Couldn't connect to %s : %s") \
% (hostname, e))
return 0
else:
@ -243,8 +246,7 @@ class GajimCore:
log.debug("Couldn't authentificate to %s" % hostname)
self.hub.sendPlugin('STATUS', account, 'offline')
self.hub.sendPlugin('WARNING', None, \
'Authentification failed with %s, check your login and password'\
% hostname)
_("Authentification failed with %s, check your login and password") % hostname)
return 0
# END connect
@ -329,7 +331,7 @@ class GajimCore:
if ev[2][1]:
pres.setStatus(ev[2][1])
else:
pres.setStatus("I would like to add you to my roster.")
pres.setStatus(_("I would like to add you to my roster."))
con.send(pres)
#('REQ', account, jid)
elif ev[0] == 'AUTH':
@ -449,7 +451,7 @@ class GajimCore:
lineSplited[0], lineSplited[1], lineSplited[2:]))
fic.close()
else:
log.debug("Unknown Command %s" % ev[0])
log.debug(_("Unknown Command %s") % ev[0])
else:
for con in self.connexions:
if self.connected[self.connexions[con]] == 1:
@ -503,7 +505,7 @@ def start():
try:
gc.mainLoop()
except KeyboardInterrupt:
print "Keyboard Interrupt : Bye!"
print _("Keyboard Interrupt : Bye!")
gc.hub.sendPlugin('QUIT', None, ())
return 0
# except:

View File

@ -22,8 +22,12 @@ pygtk.require('2.0')
import gtk
from gtk import TRUE, FALSE
import gtk.glade,gobject
import os,string#,time,Queue
#import common.optparser,common.sleepy
import os,string
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
from dialogs import *
@ -93,11 +97,11 @@ class vCard_Window:
if self.plugin.connected[self.account]:
self.plugin.send('ASK_VCARD', self.account, self.jid)
else:
warning_Window("You must be connected to get your informations")
warning_Window(_("You must be connected to get your informations"))
def on_publish(self, widget):
if not self.plugin.connected[self.account]:
warning_Window("You must be connected to publish your informations")
warning_Window(_("You must be connected to publish your informations"))
return
vcard = self.make_vcard()
nick = ''
@ -109,7 +113,7 @@ class vCard_Window:
self.plugin.send('VCARD', self.account, vcard)
def __init__(self, jid, plugin, account):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'vcard')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'vcard', APP)
self.jid = jid
self.plugin = plugin
self.account = account
@ -235,7 +239,7 @@ class preference_Window:
def __init__(self, plugin):
"""Initialize Preference window"""
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Preferences')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Preferences', APP)
self.plugin = plugin
self.da_in = self.xml.get_widget('drawing_in')
self.da_out = self.xml.get_widget('drawing_out')
@ -379,20 +383,19 @@ class accountPreference_Window:
name = entryName.get_text()
jid = entryJid.get_text()
if (name == ''):
warning_Window('You must enter a name for this account')
warning_Window(_("You must enter a name for this account"))
return 0
if name.find(' ') != -1:
warning_Window('Spaces are not permited in account name')
warning_Window(_("Spaces are not permited in account name"))
return 0
if (jid == '') or (string.count(jid, '@') != 1):
warning_Window('You must enter a Jabber ID for this account\n\
For example : login@hostname')
warning_Window(_("You must enter a Jabber ID for this account\nFor example : login@hostname"))
return 0
if proxyPort != '':
try:
proxyPort = string.atoi(proxyPort)
except ValueError:
warning_Window('Proxy Port must be a port number')
warning_Window(_("Proxy Port must be a port number"))
return 0
(login, hostname) = string.split(jid, '@')
#if we are modifying an account
@ -431,7 +434,7 @@ class accountPreference_Window:
#if it's a new account
else:
if name in self.plugin.accounts.keys():
warning_Window('An account already has this name')
warning_Window(_("An account already has this name"))
return
#if we neeed to register a new account
if check.get_active():
@ -467,11 +470,11 @@ class accountPreference_Window:
if self.plugin.connected[self.account]:
self.plugin.send('ASK_VCARD', self.account, entryJid.get_text())
else:
warning_Window("You must be connected to get your informations")
warning_Window(_("You must be connected to get your informations"))
#info must be a dictionnary
def __init__(self, plugin, infos = {}):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Account')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Account', APP)
self.plugin = plugin
self.account = ''
self.modify = False
@ -526,8 +529,7 @@ class accounts_Window:
sel = self.treeview.get_selection()
(model, iter) = sel.get_selected()
account = model.get_value(iter, 0)
window = confirm_Window('Are you sure you want to remove this account (' \
+ account + ') ?')
window = confirm_Window(_("Are you sure you want to remove this account (%s) ?") % account)
if window.wait() == gtk.RESPONSE_OK:
if self.plugin.connected[account]:
self.plugin.send('STATUS', account, ('offline', 'offline'))
@ -568,7 +570,7 @@ class accounts_Window:
def __init__(self, plugin):
self.plugin = plugin
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Accounts')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Accounts', APP)
self.treeview = self.xml.get_widget("treeview")
model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
self.treeview.set_model(model)
@ -622,12 +624,12 @@ class agentRegistration_Window:
widget.get_toplevel().destroy()
def __init__(self, agent, infos, plugin, account):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_reg')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'agent_reg', APP)
self.agent = agent
self.infos = infos
self.plugin = plugin
self.account = account
self.xml.get_widget('agent_reg').set_title('Register to ' + agent)
self.xml.get_widget('agent_reg').set_title(_("Register to %s") % agent)
self.xml.get_widget('label').set_text(infos['instructions'])
self.entries = {}
self.draw_table()
@ -679,7 +681,7 @@ class browseAgent_Window:
widget.get_toplevel().destroy()
def __init__(self, plugin, account):
xml = gtk.glade.XML(GTKGUI_GLADE, 'browser')
xml = gtk.glade.XML(GTKGUI_GLADE, 'browser', APP)
self.treeview = xml.get_widget('treeview')
self.plugin = plugin
self.account = account
@ -701,4 +703,4 @@ class browseAgent_Window:
if self.plugin.connected[account]:
self.browse()
else:
warning_Window("You must be connected to view Agents")
warning_Window(_("You must be connected to view Agents"))

View File

@ -22,8 +22,11 @@ pygtk.require('2.0')
import gtk
from gtk import TRUE, FALSE
import gtk.glade,gobject
#import os,string,time,Queue
#import common.optparser,common.sleepy
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
@ -146,7 +149,7 @@ class infoUser_Window:
self.list2.append_column(column)
def __init__(self, user, plugin, account):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Info_user')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Info_user', APP)
self.plugin = plugin
self.user = user
self.account = account
@ -193,7 +196,7 @@ class awayMsg_Window:
return msg
def __init__(self):
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Away_msg')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Away_msg', APP)
txt = self.xml.get_widget("textview")
self.txtBuffer = txt.get_buffer()
@ -222,7 +225,7 @@ class addContact_Window:
def __init__(self, plugin, account, jid=None):
self.plugin = plugin
self.account = account
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Add')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Add', APP)
if jid:
self.xml.get_widget('entry_who').set_text(jid)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
@ -236,7 +239,7 @@ class warning_Window:
widget.get_toplevel().destroy()
def __init__(self, txt):
xml = gtk.glade.XML(GTKGUI_GLADE, 'Warning')
xml = gtk.glade.XML(GTKGUI_GLADE, 'Warning', APP)
xml.get_widget('label').set_text(txt)
xml.signal_connect('on_close_clicked', self.on_close)
@ -251,7 +254,7 @@ class about_Window:
widget.get_toplevel().destroy()
def __init__(self, plugin):
xml = gtk.glade.XML(GTKGUI_GLADE, 'About')
xml = gtk.glade.XML(GTKGUI_GLADE, 'About', APP)
self.plugin = plugin
xml.signal_connect('gtk_widget_destroy', self.delete_event)
xml.signal_connect('on_close_clicked', self.on_close)
@ -265,7 +268,7 @@ class confirm_Window:
return out
def __init__(self, label):
xml = gtk.glade.XML(GTKGUI_GLADE, 'Confirm')
xml = gtk.glade.XML(GTKGUI_GLADE, 'Confirm', APP)
xml.get_widget('label_confirm').set_text(label)
self.win = xml.get_widget('Confirm')
@ -289,11 +292,11 @@ class authorize_Window:
widget.get_toplevel().destroy()
def __init__(self, plugin, jid, txt, account):
xml = gtk.glade.XML(GTKGUI_GLADE, 'Sub_req')
xml = gtk.glade.XML(GTKGUI_GLADE, 'Sub_req', APP)
self.plugin = plugin
self.jid = jid
self.account = account
xml.get_widget('label').set_text('Subscription request from ' + self.jid)
xml.get_widget('label').set_text(_("Subscription request from %s") % self.jid)
xml.get_widget("textview").get_buffer().set_text(txt)
xml.signal_connect('on_button_auth_clicked', self.auth)
xml.signal_connect('on_button_deny_clicked', self.deny)

View File

@ -24,6 +24,11 @@ from gtk import TRUE, FALSE
import gtk.glade,gobject
import os,string,time,Queue
import common.optparser,common.sleepy
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
from config import *
from dialogs import *
@ -49,7 +54,7 @@ class user:
self.status = args[4]
self.sub = args[5]
self.resource = args[6]
else: raise TypeError, 'bad arguments'
else: raise TypeError, _('bad arguments')
class message_Window:
@ -131,7 +136,7 @@ class message_Window:
self.user = user
self.plugin = plugin
self.account = account
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Chat')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Chat', APP)
self.window = self.xml.get_widget('Chat')
# hbox = xml.get_widget('hbox1')
# hbox.set_property('resize-mode', 2)
@ -271,7 +276,7 @@ class log_Window:
else:
msg = string.join(infos[3][1:], ':')
msg = string.replace(msg, '\\n', '\n')
buffer.insert_with_tags_by_name(start_iter, 'Status is now : ' + \
buffer.insert_with_tags_by_name(start_iter, _('Status is now : ') + \
infos[3][0]+' : ' + msg, 'status')
def set_nb_line(self, nb_line):
@ -283,7 +288,7 @@ class log_Window:
self.jid = jid
self.nb_line = 0
self.num_begin = 0
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Log')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Log', APP)
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
self.xml.signal_connect('on_close_clicked', self.on_close)
self.xml.signal_connect('on_earliest_clicked', self.on_earliest)
@ -517,7 +522,7 @@ class roster_Window:
self.plugin.windows[account]['chats'][user.jid].\
img.set_from_pixbuf(self.pixbufs[show])
self.plugin.windows[account]['chats'][user.jid].print_conversation(\
"%s is now %s (%s)" % (user.name, show, status), 'status')
_("%s is now %s (%s)") % (user.name, show, status), 'status')
def on_info(self, widget, user, account):
"""Call infoUser_Window class to display user's information"""
@ -545,39 +550,39 @@ class roster_Window:
user = self.contacts[account][jid]
menu = gtk.Menu()
item = gtk.MenuItem("Start chat")
item = gtk.MenuItem(_("Start chat"))
menu.append(item)
item.connect("activate", self.on_row_activated, path)
item = gtk.MenuItem("Rename")
item = gtk.MenuItem(_("Rename"))
menu.append(item)
#item.connect("activate", self.on_rename, iter)
item = gtk.MenuItem()
menu.append(item)
item = gtk.MenuItem("Subscription")
item = gtk.MenuItem(_("Subscription"))
menu.append(item)
menu_sub = gtk.Menu()
item.set_submenu(menu_sub)
item = gtk.MenuItem("Resend authorization to")
item = gtk.MenuItem(_("Resend authorization to"))
menu_sub.append(item)
item.connect("activate", self.authorize, jid, account)
item = gtk.MenuItem("Rerequest authorization from")
item = gtk.MenuItem(_("Rerequest authorization from"))
menu_sub.append(item)
item.connect("activate", self.req_sub, jid, \
'I would like to add you to my contact list, please.', account)
_('I would like to add you to my contact list, please.'), account)
item = gtk.MenuItem()
menu.append(item)
item = gtk.MenuItem("Remove")
item = gtk.MenuItem(_("Remove"))
menu.append(item)
item.connect("activate", self.on_req_usub, user, account)
item = gtk.MenuItem()
menu.append(item)
item = gtk.MenuItem("Informations")
item = gtk.MenuItem(_("Informations"))
menu.append(item)
item.connect("activate", self.on_info, user, account)
item = gtk.MenuItem("History")
item = gtk.MenuItem(_("History"))
menu.append(item)
item.connect("activate", self.on_history, user)
@ -587,11 +592,11 @@ class roster_Window:
def mk_menu_g(self, event):
"""Make group's popup menu"""
menu = gtk.Menu()
item = gtk.MenuItem("grp1")
item = gtk.MenuItem(_("grp1"))
# menu.append(item)
item = gtk.MenuItem("grp2")
item = gtk.MenuItem(_("grp2"))
# menu.append(item)
item = gtk.MenuItem("grp3")
item = gtk.MenuItem(_("grp3"))
# menu.append(item)
menu.popup(None, None, None, event.button, event.time)
menu.show_all()
@ -604,13 +609,13 @@ class roster_Window:
acct_iter = model.get_iter((path[0]))
account = model.get_value(acct_iter, 3)
menu = gtk.Menu()
item = gtk.MenuItem("Log on")
item = gtk.MenuItem(_("Log on"))
if self.contacts[account][jid].show != 'offline':
item.set_sensitive(FALSE)
menu.append(item)
item.connect("activate", self.on_agent_logging, jid, 'available', account)
item = gtk.MenuItem("Log off")
item = gtk.MenuItem(_("Log off"))
if self.contacts[account][jid].show == 'offline':
item.set_sensitive(FALSE)
menu.append(item)
@ -645,33 +650,33 @@ class roster_Window:
account = model.get_value(iter, 3)
menu = gtk.Menu()
item = gtk.MenuItem("Status")
item = gtk.MenuItem(_("Status"))
menu.append(item)
menu_sub = gtk.Menu()
item.set_submenu(menu_sub)
item = gtk.MenuItem("Online")
item = gtk.MenuItem(_("Online"))
menu_sub.append(item)
item.connect("activate", self.change_status, account, 'online')
item = gtk.MenuItem("Away")
item = gtk.MenuItem(_("Away"))
menu_sub.append(item)
item.connect("activate", self.change_status, account, 'away')
item = gtk.MenuItem("NA")
item = gtk.MenuItem(_("NA"))
menu_sub.append(item)
item.connect("activate", self.change_status, account, 'na')
item = gtk.MenuItem("DND")
item = gtk.MenuItem(_("DND"))
menu_sub.append(item)
item.connect("activate", self.change_status, account, 'dnd')
item = gtk.MenuItem()
menu_sub.append(item)
item = gtk.MenuItem("Offline")
item = gtk.MenuItem(_("Offline"))
menu_sub.append(item)
item.connect("activate", self.change_status, account, 'offline')
item = gtk.MenuItem()
menu.append(item)
item = gtk.MenuItem("Edit account")
item = gtk.MenuItem(_("Edit account"))
menu.append(item)
item.connect("activate", self.on_edit_account, account)
@ -714,8 +719,7 @@ class roster_Window:
def on_req_usub(self, widget, user, account):
"""Remove a user"""
window = confirm_Window('Are you sure you want to remove ' + user.name + \
' (' + user.jid + ') from your roster ?')
window = confirm_Window(_("Are you sure you want to remove %s (%s) from your roster ?") % (user.name, user.jid))
if window.wait() == gtk.RESPONSE_OK:
self.plugin.send('UNSUB', account, user.jid)
self.remove_user(user, account)
@ -746,7 +750,7 @@ class roster_Window:
txt = status
accounts = self.plugin.accounts.keys()
if len(accounts) == 0:
warning_Window("You must setup an account before connecting to jabber network.")
warning_Window(_("You must setup an account before connecting to jabber network."))
return
for acct in accounts:
self.plugin.send('STATUS', acct, (status, txt))
@ -833,7 +837,7 @@ class roster_Window:
"""When we quit the gtk plugin :
tell that to the core and exit gtk"""
self.plugin.send('QUIT', None, '')
print "plugin gtkgui stopped"
print _("plugin gtkgui stopped")
gtk.mainquit()
def on_row_activated(self, widget, path, col=0):
@ -1011,7 +1015,7 @@ class roster_Window:
def __init__(self, plugin):
# FIXME : handle no file ...
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Gajim')
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Gajim', APP)
self.tree = self.xml.get_widget('treeview')
self.plugin = plugin
self.groups = {}
@ -1208,9 +1212,9 @@ class plugin:
user1 = user(ev[2][0], ev[2][0], ['general'], 'online', \
'online', 'to', ev[2][2])
self.roster.add_user(user1)
warning_Window("You are now authorized by " + ev[2][0])
warning_Window(_("You are now authorized by %s") % ev[2][0])
elif ev[0] == 'UNSUBSCRIBED':
warning_Window("You are now unsubscribed by " + ev[2])
warning_Window(_("You are now unsubscribed by %s") % ev[2])
#TODO: change icon
#('AGENTS', account, agents)
elif ev[0] == 'AGENTS':
@ -1219,7 +1223,7 @@ class plugin:
#('AGENTS_INFO', account, (agent, infos))
elif ev[0] == 'AGENT_INFO':
if not ev[2][1].has_key('instructions'):
warning_Window('error contacting %s' % ev[2][0])
warning_Window(_("error contacting %s") % ev[2][0])
else:
agentRegistration_Window(ev[2][0], ev[2][1], self, ev[1])
#('ACC_OK', account, (hostname, login, pasword, name, ressource))
@ -1325,4 +1329,4 @@ class plugin:
if __name__ == "__main__":
plugin(None, None)
print "plugin gtkgui loaded"
print _("plugin gtkgui loaded")

View File

@ -21,7 +21,9 @@ import os
import string
import time
import common.optparser
from common import i18n
LOGPATH = os.path.expanduser("~/.gajim/logs/")
_ = i18n._
class plugin:
def read_queue(self):
@ -39,7 +41,7 @@ class plugin:
ev = self.queueIN.get()
if ev[0] == 'QUIT':
print "plugin logger stopped"
print _("plugin logger stopped")
return
elif ev[0] == 'NOTIFY':
status = ev[2][2]
@ -92,16 +94,16 @@ class plugin:
os.stat(os.path.expanduser("~/.gajim"))
except OSError:
os.mkdir(os.path.expanduser("~/.gajim"))
print "creating ~/.gajim/"
print _("creating ~/.gajim/")
try:
os.stat(LOGPATH)
except OSError:
os.mkdir(LOGPATH)
print "creating ~/.gajim/logs/"
print _("creating ~/.gajim/logs/")
self.read_queue()
if __name__ == "__main__":
plugin(None, None)
print "plugin logger loaded"
print _("plugin logger loaded")

View File

@ -26,5 +26,9 @@ sys.path.append("..")
import common
import core
from common import i18n
i18n.init()
_ = i18n._
core.core.start()
print "Core Stopped"
print _("Core Stopped")