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
import gtk.glade
import gtkgui_helpers import gtkgui_helpers
from common import gajim from common import gajim
from common import i18n
_ = i18n._
APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
( (
OPT_TYPE, OPT_TYPE,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,7 +19,6 @@
## ##
import gtk import gtk
import gtk.glade
import gobject import gobject
import os import os
import sys import sys
@ -42,12 +41,6 @@ from advanced import AdvancedConfigurationWindow
from common import gajim from common import gajim
from common import helpers 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 EditGroupsDialog:
'''Class for the edit group dialog window''' '''Class for the edit group dialog window'''

View file

@ -51,7 +51,6 @@ import inspect
import weakref import weakref
import gobject import gobject
import gtk import gtk
import gtk.glade
import pango import pango
import dialogs import dialogs
@ -60,12 +59,6 @@ import gtkgui_helpers
from common import gajim from common import gajim
from common import xmpp 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. # Dictionary mapping category, type pairs to browser class, image pairs.
# This is a function, so we can call it after the classes are declared. # This is a function, so we can call it after the classes are declared.

View file

@ -18,7 +18,6 @@
## ##
import gtk import gtk
import gtk.glade
import gobject import gobject
import pango import pango
import os import os
@ -30,12 +29,6 @@ import dialogs
from common import gajim from common import gajim
from common import helpers 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_IMAGE = 0
C_LABELS = 1 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 exceptions
from common import i18n from common import i18n
_ = i18n._
i18n.init()
try: try:
PREFERRED_ENCODING = locale.getpreferredencoding() PREFERRED_ENCODING = locale.getpreferredencoding()
except: except:

View file

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

View file

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

View file

@ -23,7 +23,6 @@
import os import os
import time import time
import gtk import gtk
import gtk.glade
import pango import pango
import gobject import gobject
import gtkgui_helpers import gtkgui_helpers
@ -40,13 +39,6 @@ from common import helpers
from chat_control import ChatControl from chat_control import ChatControl
from chat_control import ChatControlBase from chat_control import ChatControlBase
from conversation_textview import ConversationTextview 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) #(status_image, type, nick, shown_nick)
( (

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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