use gettext.install. Fixes #497
This commit is contained in:
parent
4ae020946c
commit
bc26593974
|
@ -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,
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
import sre
|
||||
import copy
|
||||
import i18n
|
||||
_ = i18n._
|
||||
|
||||
|
||||
(
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -29,11 +29,8 @@ import time
|
|||
import datetime
|
||||
|
||||
import exceptions
|
||||
import i18n
|
||||
import gajim
|
||||
|
||||
_ = i18n._
|
||||
|
||||
try:
|
||||
from pysqlite2 import dbapi2 as sqlite
|
||||
except ImportError:
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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'''
|
||||
|
|
|
@ -20,8 +20,6 @@ import sys
|
|||
|
||||
from common import gajim
|
||||
from common import exceptions
|
||||
from common import i18n
|
||||
_ = i18n._
|
||||
|
||||
try:
|
||||
import dbus
|
||||
|
|
|
@ -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'''
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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)
|
||||
(
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -32,7 +32,6 @@ import time
|
|||
from common import logger
|
||||
from common import i18n
|
||||
|
||||
_ = i18n._
|
||||
try:
|
||||
PREFERRED_ENCODING = sys.getpreferredencoding()
|
||||
except:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue