use gettext.install. Fixes #497

This commit is contained in:
Yann Leboulanger 2006-06-15 06:49:04 +00:00
parent 4ae020946c
commit bc26593974
35 changed files with 9 additions and 171 deletions

View File

@ -25,16 +25,9 @@
##
import gtk
import gtk.glade
import gtkgui_helpers
from common import gajim
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
(
OPT_TYPE,

View File

@ -18,7 +18,6 @@
import os
import time
import gtk
import gtk.glade
import pango
import gobject
import gtkgui_helpers
@ -41,11 +40,6 @@ try:
except:
HAS_GTK_SPELL = False
####################
# FIXME: Can't this stuff happen once?
from common import i18n
_ = i18n._
APP = i18n.APP
################################################################################
class ChatControlBase(MessageControl):

View File

@ -28,10 +28,6 @@ import stat
from common import gajim
import logger
import i18n
_ = i18n._
Q_ = i18n.Q_
from pysqlite2 import dbapi2 as sqlite # DO NOT MOVE ABOVE OF import gajim

View File

@ -20,8 +20,6 @@
import sre
import copy
import i18n
_ = i18n._
(

View File

@ -42,9 +42,6 @@ from common import GnuPG
from connection_handlers import *
USE_GPG = GnuPG.USE_GPG
from common import i18n
_ = i18n._
class Connection(ConnectionHandlers):
'''Connection class'''
def __init__(self, name):

View File

@ -32,8 +32,6 @@ import common.xmpp
from common import GnuPG
from common import helpers
from common import gajim
from common import i18n
_ = i18n._
STATUS_LIST = ['offline', 'connecting', 'online', 'chat', 'away', 'xa', 'dnd',
'invisible']

View File

@ -23,9 +23,6 @@
## GNU General Public License for more details.
##
from common import i18n
_ = i18n._
class PysqliteNotAvailable(Exception):
'''sqlite2 is not installed or python bindings are missing'''
def __init__(self):

View File

@ -26,7 +26,7 @@ import sha
from encodings.punycode import punycode_encode
import gajim
import i18n
from i18n import Q_
from xmpp_stringprep import nodeprep, resourceprep, nameprep
try:
@ -36,9 +36,6 @@ try:
except:
pass
_ = i18n._
Q_ = i18n.Q_
special_groups = (_('Transports'), _('Not in Roster'), _('Observers'))
class InvalidFormat(Exception):

View File

@ -48,21 +48,11 @@ if os.name == 'nt':
if lang:
os.environ['LANG'] = lang
_translation = None
def init():
global _translation
try:
_translation = gettext.translation(APP, DIR)
except IOError:
_translation = gettext.NullTranslations()
init()
def _(s):
if s == '':
return s
return _translation.ugettext(s)
gettext.install(APP, DIR, unicode = True)
if gettext._translations:
_translation = gettext._translations.values()[0]
else:
_translation = gettext.NullTranslations()
def Q_(s):
# Qualified translatable strings

View File

@ -29,11 +29,8 @@ import time
import datetime
import exceptions
import i18n
import gajim
_ = i18n._
try:
from pysqlite2 import dbapi2 as sqlite
except ImportError:

View File

@ -26,8 +26,6 @@ import os
import sys
import locale
from common import gajim
from common import i18n
_ = i18n._
class OptionsParser:
def __init__(self, filename):

View File

@ -16,7 +16,6 @@
##
import gtk
import gtk.glade
import gobject
import os
import common.config
@ -38,12 +37,6 @@ except:
from common import helpers
from common import gajim
from common import connection
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
#---------- PreferencesWindow class -------------#
class PreferencesWindow:

View File

@ -24,7 +24,6 @@
##
import gtk
import gtk.glade
import pango
import gobject
import time
@ -36,14 +35,8 @@ import locale
import gtkgui_helpers
from common import gajim
from common import helpers
from common import i18n
from calendar import timegm
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
class ConversationTextview:
'''Class for the conversation textview (where user reads already said messages)
for chat/groupchat windows'''

View File

@ -20,8 +20,6 @@ import sys
from common import gajim
from common import exceptions
from common import i18n
_ = i18n._
try:
import dbus

View File

@ -19,7 +19,6 @@
##
import gtk
import gtk.glade
import gobject
import os
import sys
@ -42,12 +41,6 @@ from advanced import AdvancedConfigurationWindow
from common import gajim
from common import helpers
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
class EditGroupsDialog:
'''Class for the edit group dialog window'''

View File

@ -51,7 +51,6 @@ import inspect
import weakref
import gobject
import gtk
import gtk.glade
import pango
import dialogs
@ -60,12 +59,6 @@ import gtkgui_helpers
from common import gajim
from common import xmpp
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
# Dictionary mapping category, type pairs to browser class, image pairs.
# This is a function, so we can call it after the classes are declared.

View File

@ -18,7 +18,6 @@
##
import gtk
import gtk.glade
import gobject
import pango
import os
@ -30,12 +29,6 @@ import dialogs
from common import gajim
from common import helpers
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
C_IMAGE = 0
C_LABELS = 1

View File

@ -38,8 +38,6 @@ signal.signal(signal.SIGINT, signal.SIG_DFL) # ^C exits the application
from common import exceptions
from common import i18n
_ = i18n._
i18n.init()
try:
PREFERRED_ENCODING = locale.getpreferredencoding()
except:

View File

@ -33,14 +33,13 @@ import sys
import os
import urllib
from common import i18n
import message_control
from chat_control import ChatControlBase
from common import exceptions
from common import i18n
i18n.init()
_ = i18n._
try:
import gtk

View File

@ -25,17 +25,11 @@
##
import gtk
import gtk.glade
import pango
import dialogs
import gtkgui_helpers
from common import gajim
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
class GajimThemesWindow:

View File

@ -23,7 +23,6 @@
import os
import time
import gtk
import gtk.glade
import pango
import gobject
import gtkgui_helpers
@ -40,13 +39,6 @@ from common import helpers
from chat_control import ChatControl
from chat_control import ChatControlBase
from conversation_textview import ConversationTextview
from common import i18n
_ = i18n._
Q_ = i18n.Q_
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
#(status_image, type, nick, shown_nick)
(

View File

@ -37,9 +37,7 @@ import dialogs
from cStringIO import StringIO
from common import helpers
from common import i18n
_ = i18n._
_exception_in_progress = threading.Lock()
def _info(type, value, tb):

View File

@ -38,8 +38,6 @@ if os.name == 'nt':
HAS_PYWIN32 = False
from common import i18n
i18n.init()
_ = i18n._
from common import gajim
from common import helpers

View File

@ -24,7 +24,6 @@ import sys
import os
import signal
import gtk
import gtk.glade
import time
import locale
@ -36,9 +35,6 @@ from common.logger import LOG_DB_PATH, constants
from common import gajim
from common import i18n
from common import helpers
_ = i18n._
gtk.glade.bindtextdomain(i18n.APP, i18n.DIR)
gtk.glade.textdomain(i18n.APP)
# time, message, subject
(

View File

@ -24,7 +24,6 @@
##
import gtk
import gtk.glade
import gobject
import time
import calendar
@ -34,17 +33,11 @@ import conversation_textview
from common import gajim
from common import helpers
from common import i18n
from common.logger import Constants
constants = Constants()
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
# contact_name, date, message, time
(
C_CONTACT_NAME,

View File

@ -11,8 +11,6 @@
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
import gtk
import gtk.glade
import gtkgui_helpers
from common import gajim
@ -22,12 +20,6 @@ TYPE_CHAT = 'chat'
TYPE_GC = 'gc'
TYPE_PM = 'pm'
####################
# FIXME: Can't this stuff happen once?
from common import i18n
_ = i18n._
APP = i18n.APP
####################
class MessageControl:

View File

@ -22,7 +22,6 @@
##
import gtk
import gtk.glade
import common
import gtkgui_helpers
@ -31,12 +30,6 @@ from chat_control import ChatControlBase
from common import gajim
####################
# FIXME: Can't this stuff happen once?
from common import i18n
_ = i18n._
APP = i18n.APP
####################
class MessageWindow:

View File

@ -32,7 +32,6 @@ import time
from common import logger
from common import i18n
_ = i18n._
try:
PREFERRED_ENCODING = sys.getpreferredencoding()
except:

View File

@ -23,10 +23,7 @@ import dialogs
import gtkgui_helpers
from common import gajim
from common import i18n
from common import helpers
i18n.init()
_ = i18n._
import dbus_support
if dbus_support.supported:

View File

@ -31,9 +31,7 @@ import os
from common import gajim
from common import helpers
from time import time
from common import i18n
from dialogs import AddNewContactWindow, NewChatDialog
_ = i18n._
import dbus_support
if dbus_support.supported:

View File

@ -15,7 +15,6 @@
##
import gtk
import gtk.glade
import gobject
import os
import time
@ -33,17 +32,11 @@ import message_control
from common import gajim
from common import helpers
from common import i18n
from message_window import MessageWindowMgr
from chat_control import ChatControl
from groupchat_control import GroupchatControl
from groupchat_control import PrivateChatControl
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
#(icon, name, type, jid, account, editable, second pixbuf)
(
C_IMG, # image to show state (online, new message etc)

View File

@ -18,7 +18,6 @@
##
import gtk
import gtk.glade
import gobject
import os
@ -29,7 +28,6 @@ import gtkgui_helpers
from common import gajim
from common import helpers
from common import i18n
HAS_SYSTRAY_CAPABILITIES = True
@ -42,11 +40,6 @@ except:
gajim.log.debug('No trayicon module available')
HAS_SYSTRAY_CAPABILITIES = False
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
class Systray:
'''Class for icon in the notification area

View File

@ -42,10 +42,6 @@ WM_TRAYMESSAGE = win32con.WM_USER + 20
import gtkgui_helpers
from common import gajim
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
class SystrayWINAPI:
def __init__(self, gtk_window):

View File

@ -27,9 +27,6 @@ from common import gajim
from common import helpers
from common import i18n
_ = i18n._
APP = i18n.APP
class BaseTooltip:
''' Base Tooltip class;
Usage:

View File

@ -14,7 +14,6 @@
##
import gtk
import gtk.glade
import gobject
import base64
import mimetypes
@ -27,12 +26,7 @@ import dialogs
from common import helpers
from common import gajim
from common import i18n
_ = i18n._
Q_ = i18n.Q_
APP = i18n.APP
gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
from common.i18n import Q_
def get_avatar_pixbuf_encoded_mime(photo):
'''return the pixbuf of the image