# HG changeset patch # User Goffi # Date 1388333161 -3600 # Node ID bfabeedbf32e86a4f9286ebe3f1966503ccb9956 # Parent 64dd7c0f4febb70817e6ee1747eee135c1ea535d core: i18n refactoring: - _() is no more installed in __builtin__ - instead, there is a new sat.core.i18n module - added D_() method for deferred translation - languageSwitch method allow to dynamically change translation language - import gettext is tested against ImportError, and dummy methods are used when not available (mainly useful for Libervia) diff -r 64dd7c0f4feb -r bfabeedbf32e README4TRANSLATORS --- a/README4TRANSLATORS Thu Dec 19 13:54:40 2013 +0100 +++ b/README4TRANSLATORS Sun Dec 29 17:06:01 2013 +0100 @@ -3,8 +3,11 @@ NOTE: *.po files are in i18n directory To translate a file, you can use a dedicated tool as the excellent gtranslator: -- use the template .po file (e.g. sat.po) and name it to your translated language (e.g. fr.po for french); you can preferably generate a new template directly from the source with the following command (eventually adapted): -> xgettext -L python -d sat sat.tac tools/*py plugins/*py + +- use the template .po file (e.g. sat.po) and name it to your translated language (e.g. fr.po for french); you can preferably generate a new template directly from the source with the following command (eventually adapted, the following command use zsh's globbing syntax), launched from root sat dir: +> xgettext -L python -d sat --keyword=D_ -p i18n **/*(.py|.tac|primitivus|wix|jp)(.) + +- then to start a new translation, copy i18n/sat.po to your language file, e.g. cd i18n; cp sat.po fr.po - use the choosed tool (a simple text editor can be sufficient) to edit the file: e.g. gtranslator fr.po @@ -19,9 +22,9 @@ and if everything is allright > mv fr2.po fr.po -Don't forget that you can use the version-control system (mercurial, the "hg" command) to keep history of you translations. +Don't forget that you can (and should !) use the version-control system (mercurial, the "hg" command) to keep history of you translations. You can check the fr.po file to see how it's done and to know what to put while you set up you translation tool. -Trank you again for you help, don't forget to give me your name and contact mail so I can credit you, and don't hesitate to contact me if you need help (goffi@goffi.org). +Trank you again for you help, don't forget to give me your name and contact email so I can credit you, and don't hesitate to contact me if you need help (goffi@goffi.org, or the sat XMPP room at sat@chat.jabberfr.org). diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/bridge/DBus.py --- a/frontends/src/bridge/DBus.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/bridge/DBus.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from bridge_frontend import BridgeFrontend import dbus from logging import debug, error diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/constants.py --- a/frontends/src/constants.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/constants.py Sun Dec 29 17:06:01 2013 +0100 @@ -18,10 +18,7 @@ # along with this program. If not, see . -try: - _("dummy") -except: # libervia doesn't allow to explicit the exception here - _ = lambda text: text +from sat.core.i18n import _ try: from collections import OrderedDict # only available from python 2.7 diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/jp/jp --- a/frontends/src/jp/jp Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/jp/jp Sun Dec 29 17:06:01 2013 +0100 @@ -18,6 +18,7 @@ # along with this program. If not, see . from __future__ import with_statement +from sat.core.i18n import _ #consts name = u"jp" @@ -44,9 +45,6 @@ format='%(message)s') ### -import gettext -gettext.install('jp', unicode=True) - import sys import os from os.path import abspath, basename, dirname diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/card_game.py --- a/frontends/src/primitivus/card_game.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/card_game.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from sat_frontends.tools.games import TarotCard diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/chat.py --- a/frontends/src/primitivus/chat.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/chat.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from urwid_satext.files_management import FileDialog diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/contact_list.py --- a/frontends/src/primitivus/contact_list.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/contact_list.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from sat_frontends.quick_frontend.quick_contact_list import QuickContactList diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/gateways.py --- a/frontends/src/primitivus/gateways.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/gateways.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from sat_frontends.quick_frontend.quick_gateways import QuickGatewaysManager diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/primitivus Sun Dec 29 17:06:01 2013 +0100 @@ -18,6 +18,7 @@ # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from urwid_satext.files_management import FileDialog diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/profile_manager.py --- a/frontends/src/primitivus/profile_manager.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/profile_manager.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext.sat_widgets import AdvancedEdit,Password,List,InputDialog,ConfirmDialog,Alert,FocusFrame from sat.tools.jid import JID diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/progress.py --- a/frontends/src/primitivus/progress.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/progress.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/status.py --- a/frontends/src/primitivus/status.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/status.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid import copy from urwid_satext import sat_widgets diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/primitivus/xmlui.py --- a/frontends/src/primitivus/xmlui.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/primitivus/xmlui.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from logging import debug, info, warning, error diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/quick_frontend/quick_app.py --- a/frontends/src/quick_frontend/quick_app.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import sys from logging import debug, info, warning, error from sat.tools.jid import JID @@ -27,9 +28,6 @@ from sat_frontends.quick_frontend.constants import Const -import gettext -gettext.install('sat_frontend', unicode=True) - class QuickApp(object): """This class contain the main methods needed for the frontend""" diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/quick_frontend/quick_chat.py --- a/frontends/src/quick_frontend/quick_chat.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from sat.tools.jid import JID from sat_frontends.quick_frontend.quick_utils import unescapePrivate diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/quick_frontend/quick_contact_list.py --- a/frontends/src/quick_frontend/quick_contact_list.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/quick_frontend/quick_contact_list.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/quick_frontend/quick_contact_management.py --- a/frontends/src/quick_frontend/quick_contact_management.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/quick_frontend/quick_contact_management.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from sat.tools.jid import JID import pdb diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/quick_frontend/quick_gateways.py --- a/frontends/src/quick_frontend/quick_gateways.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/quick_frontend/quick_gateways.py Sun Dec 29 17:06:01 2013 +0100 @@ -20,6 +20,7 @@ +from sat.core.i18n import _ class QuickGatewaysManager(object): diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/card_game.py --- a/frontends/src/wix/card_game.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/card_game.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import os.path, glob import pdb diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/chat.py --- a/frontends/src/wix/chat.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/chat.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import os.path import time diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/constants.py --- a/frontends/src/wix/constants.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/constants.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import sys import os.path import gettext diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/contact_list.py --- a/frontends/src/wix/contact_list.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/contact_list.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import wx from sat_frontends.quick_frontend.quick_contact_list import QuickContactList from sat_frontends.wix.constants import Const diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/gateways.py --- a/frontends/src/wix/gateways.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/gateways.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from xml.dom import minidom diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/main_window.py --- a/frontends/src/wix/main_window.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/main_window.py Sun Dec 29 17:06:01 2013 +0100 @@ -18,6 +18,7 @@ # along with this program. If not, see . +from sat.core.i18n import _ from sat_frontends.quick_frontend.quick_chat_list import QuickChatList from sat_frontends.quick_frontend.quick_app import QuickApp import wx diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/param.py --- a/frontends/src/wix/param.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/param.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from xml.dom import minidom diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/profile.py --- a/frontends/src/wix/profile.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/profile.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import wx import pdb from logging import debug, info, error diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/profile_manager.py --- a/frontends/src/wix/profile_manager.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/profile_manager.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from logging import debug, info, error diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/quiz_game.py --- a/frontends/src/wix/quiz_game.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/quiz_game.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import os.path, glob import pdb diff -r 64dd7c0f4feb -r bfabeedbf32e frontends/src/wix/xmlui.py --- a/frontends/src/wix/xmlui.py Thu Dec 19 13:54:40 2013 +0100 +++ b/frontends/src/wix/xmlui.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from xml.dom import minidom diff -r 64dd7c0f4feb -r bfabeedbf32e src/bridge/bridge_constructor/dbus_frontend_template.py --- a/src/bridge/bridge_constructor/dbus_frontend_template.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/bridge/bridge_constructor/dbus_frontend_template.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from bridge_frontend import BridgeFrontend import dbus from logging import debug, error diff -r 64dd7c0f4feb -r bfabeedbf32e src/core/i18n.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/core/i18n.py Sun Dec 29 17:06:01 2013 +0100 @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# SAT: a jabber client +# Copyright (C) 2009, 2010, 2011, 2012, 2013 Jérôme Poisson (goffi@goffi.org) + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# 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 Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + + +try: + + import gettext + + _ = gettext.translation('sat', 'i18n', fallback=True).ugettext + _translators = {None: gettext.NullTranslations()} + + def languageSwitch(lang=None): + if not lang in _translators: + _translators[lang] = gettext.translation('sat', languages=[lang], fallback=True) + _translators[lang].install(unicode=True) + +except ImportError: + + print "WARNING: gettext support disabled" + _ = lambda msg: msg # Libervia doesn't support gettext + def languageSwitch(lang=None): + pass + + +D_ = lambda msg: msg # used for deferred translations + diff -r 64dd7c0f4feb -r bfabeedbf32e src/core/sat_main.py --- a/src/core/sat_main.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/core/sat_main.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from twisted.application import service from twisted.internet import defer diff -r 64dd7c0f4feb -r bfabeedbf32e src/core/xmpp.py --- a/src/core/xmpp.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/core/xmpp.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from twisted.internet import task, defer from twisted.words.protocols.jabber import jid, xmlstream from wokkel import client, disco, xmppim, generic, compat, delay, iwokkel diff -r 64dd7c0f4feb -r bfabeedbf32e src/memory/memory.py --- a/src/memory/memory.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/memory/memory.py Sun Dec 29 17:06:01 2013 +0100 @@ -18,6 +18,7 @@ # along with this program. If not, see . from __future__ import with_statement +from sat.core.i18n import _ import os.path import csv diff -r 64dd7c0f4feb -r bfabeedbf32e src/memory/persistent.py --- a/src/memory/persistent.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/memory/persistent.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error diff -r 64dd7c0f4feb -r bfabeedbf32e src/memory/sqlite.py --- a/src/memory/sqlite.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/memory/sqlite.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.enterprise import adbapi from twisted.internet import defer diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/deprecated_misc_cs.py --- a/src/plugins/deprecated_misc_cs.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/deprecated_misc_cs.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.internet import protocol, defer, threads, reactor diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_exp_command_export.py --- a/src/plugins/plugin_exp_command_export.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_exp_command_export.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import jid from twisted.internet import reactor, protocol diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_exp_parrot.py --- a/src/plugins/plugin_exp_parrot.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_exp_parrot.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_exp_pipe.py --- a/src/plugins/plugin_exp_pipe.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_exp_pipe.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.words.protocols.jabber import jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_account.py --- a/src/plugins/plugin_misc_account.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_account.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from sat.core import exceptions from twisted.internet import reactor, defer, protocol diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_groupblog.py --- a/src/plugins/plugin_misc_groupblog.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_groupblog.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.internet import defer from twisted.words.protocols.jabber import jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_imap.py --- a/src/plugins/plugin_misc_imap.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_imap.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error import warnings from twisted.internet import protocol, defer diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_maildir.py --- a/src/plugins/plugin_misc_maildir.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_maildir.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error import warnings warnings.filterwarnings('ignore', 'the MimeWriter', DeprecationWarning, 'twisted') # FIXME: to be removed, see http://twistedmatrix.com/trac/ticket/4038 diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_quiz.py --- a/src/plugins/plugin_misc_quiz.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_quiz.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.internet import protocol, defer, threads, reactor diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_radiocol.py --- a/src/plugins/plugin_misc_radiocol.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_radiocol.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.internet import reactor diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_room_game.py --- a/src/plugins/plugin_misc_room_game.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_room_game.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, warning, error from twisted.words.protocols.jabber.jid import JID from twisted.words.xish import domish diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_smtp.py --- a/src/plugins/plugin_misc_smtp.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_smtp.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error import warnings from twisted.internet import protocol, defer diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_tarot.py --- a/src/plugins/plugin_misc_tarot.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_tarot.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.words.protocols.jabber import jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_text_commands.py --- a/src/plugins/plugin_misc_text_commands.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_text_commands.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from twisted.words.protocols.jabber import jid from logging import debug, info, warning, error diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_text_syntaxes.py --- a/src/plugins/plugin_misc_text_syntaxes.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_text_syntaxes.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _, D_ from logging import debug, info, error, warning from wokkel import disco, pubsub @@ -28,7 +29,7 @@ import re -CATEGORY = "Composition" +CATEGORY = D_("Composition") NAME = "Syntax" _SYNTAX_XHTML = "XHTML" _SYNTAX_CURRENT = "@CURRENT@" @@ -85,7 +86,7 @@ params_data = { 'category_name': CATEGORY, - 'category_label': _(CATEGORY), #FIXME: check that gettext can handle this + 'category_label': _(CATEGORY), 'name': NAME, 'label': _(NAME), 'default': _SYNTAX_XHTML, diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_misc_xmllog.py --- a/src/plugins/plugin_misc_xmllog.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_misc_xmllog.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from twisted.words.protocols.jabber.xmlstream import XmlStream from twisted.words.xish import domish diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0020.py --- a/src/plugins/plugin_xep_0020.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0020.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import client, jid from twisted.words.xish import domish diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0033.py --- a/src/plugins/plugin_xep_0033.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0033.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import logging from sat.core import exceptions from wokkel import disco, iwokkel diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0045.py --- a/src/plugins/plugin_xep_0045.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0045.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.internet import defer from twisted.words.protocols.jabber import jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0047.py --- a/src/plugins/plugin_xep_0047.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0047.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import client as jabber_client, jid from twisted.words.xish import domish diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0050.py --- a/src/plugins/plugin_xep_0050.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0050.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import jid from twisted.words.protocols.jabber import error as xmpp_error diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0054.py --- a/src/plugins/plugin_xep_0054.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0054.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from twisted.internet import threads from twisted.internet.defer import inlineCallbacks, returnValue diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0055.py --- a/src/plugins/plugin_xep_0055.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0055.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber.xmlstream import IQ from twisted.words.protocols.jabber import jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0060.py --- a/src/plugins/plugin_xep_0060.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0060.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from wokkel.pubsub import PubSubRequest from wokkel import disco, pubsub diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0065.py --- a/src/plugins/plugin_xep_0065.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0065.py Sun Dec 29 17:06:01 2013 +0100 @@ -54,6 +54,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.internet import protocol, reactor from twisted.internet import error as jab_error diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0071.py --- a/src/plugins/plugin_xep_0071.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0071.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from wokkel import disco, pubsub, iwokkel diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0077.py --- a/src/plugins/plugin_xep_0077.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0077.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from twisted.words.protocols.jabber import jid from twisted.words.protocols.jabber.xmlstream import IQ diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0085.py --- a/src/plugins/plugin_xep_0085.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0085.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from sat.core import exceptions from logging import info from wokkel import disco, iwokkel diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0095.py --- a/src/plugins/plugin_xep_0095.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0095.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from twisted.words.xish import domish from twisted.internet import protocol diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0096.py --- a/src/plugins/plugin_xep_0096.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0096.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.words.protocols.jabber import jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0100.py --- a/src/plugins/plugin_xep_0100.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0100.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from twisted.words.protocols.jabber import client as jabber_client, jid from twisted.words.protocols.jabber import error as jab_error diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0115.py --- a/src/plugins/plugin_xep_0115.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0115.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error, warning from twisted.words.xish import domish from twisted.words.protocols.jabber import client, jid, xmlstream diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0163.py --- a/src/plugins/plugin_xep_0163.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0163.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error from twisted.internet import protocol from twisted.words.protocols.jabber import client, jid diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0249.py --- a/src/plugins/plugin_xep_0249.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0249.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.internet import protocol, defer diff -r 64dd7c0f4feb -r bfabeedbf32e src/plugins/plugin_xep_0277.py --- a/src/plugins/plugin_xep_0277.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/plugins/plugin_xep_0277.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import jid from twisted.internet import defer diff -r 64dd7c0f4feb -r bfabeedbf32e src/sat.tac --- a/src/sat.tac Thu Dec 19 13:54:40 2013 +0100 +++ b/src/sat.tac Sun Dec 29 17:06:01 2013 +0100 @@ -17,9 +17,6 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -import gettext -gettext.install('sat', "i18n", unicode=True) - from twisted.application import service from twisted.internet import glib2reactor glib2reactor.install() diff -r 64dd7c0f4feb -r bfabeedbf32e src/test/helpers.py --- a/src/test/helpers.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/test/helpers.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ import __builtin__ from twisted.words.protocols.jabber.jid import JID from wokkel.xmppim import RosterItem diff -r 64dd7c0f4feb -r bfabeedbf32e src/tools/misc.py --- a/src/tools/misc.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/tools/misc.py Sun Dec 29 17:06:01 2013 +0100 @@ -19,6 +19,7 @@ """Misc usefull classes""" +from sat.core.i18n import _ import sys from logging import debug, warning diff -r 64dd7c0f4feb -r bfabeedbf32e src/tools/xml_tools.py --- a/src/tools/xml_tools.py Thu Dec 19 13:54:40 2013 +0100 +++ b/src/tools/xml_tools.py Sun Dec 29 17:06:01 2013 +0100 @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +from sat.core.i18n import _ from logging import debug, info, error, warning from xml.dom import minidom from wokkel import data_form