Mercurial > libervia-backend
changeset 771:bfabeedbf32e
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)
line wrap: on
line diff
--- 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).
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from bridge_frontend import BridgeFrontend import dbus from logging import debug, error
--- 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 <http://www.gnu.org/licenses/>. -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
--- 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 <http://www.gnu.org/licenses/>. 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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from sat_frontends.tools.games import TarotCard
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from urwid_satext.files_management import FileDialog
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from sat_frontends.quick_frontend.quick_gateways import QuickGatewaysManager
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from urwid_satext.files_management import FileDialog
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid import copy from urwid_satext import sat_widgets
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import urwid from urwid_satext import sat_widgets from logging import debug, info, warning, error
--- 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 <http://www.gnu.org/licenses/>. +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"""
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from sat.tools.jid import JID import pdb
--- 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):
--- 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
--- 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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import sys import os.path import gettext
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import wx from sat_frontends.quick_frontend.quick_contact_list import QuickContactList from sat_frontends.wix.constants import Const
--- 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
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import wx import pdb from logging import debug, info, error
--- 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
--- 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
--- 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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from bridge_frontend import BridgeFrontend import dbus from logging import debug, error
--- /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 <http://www.gnu.org/licenses/>. + + +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 +
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from twisted.application import service from twisted.internet import defer
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. from __future__ import with_statement +from sat.core.i18n import _ import os.path import csv
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.enterprise import adbapi from twisted.internet import defer
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import jid
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from sat.core import exceptions from twisted.internet import reactor, defer, protocol
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.internet import defer from twisted.words.protocols.jabber import jid
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error import warnings from twisted.internet import protocol, defer
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.internet import reactor
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error import warnings from twisted.internet import protocol, defer
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from twisted.words.protocols.jabber import jid from logging import debug, info, warning, error
--- 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 <http://www.gnu.org/licenses/>. +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,
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import logging from sat.core import exceptions from wokkel import disco, iwokkel
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.internet import defer from twisted.words.protocols.jabber import jid
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error from twisted.internet import threads from twisted.internet.defer import inlineCallbacks, returnValue
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error from wokkel.pubsub import PubSubRequest from wokkel import disco, pubsub
--- 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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error from wokkel import disco, pubsub, iwokkel
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from sat.core import exceptions from logging import info from wokkel import disco, iwokkel
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error from twisted.words.xish import domish from twisted.internet import protocol
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error from twisted.internet import protocol from twisted.words.protocols.jabber import client, jid
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.xish import domish from twisted.internet import protocol, defer
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, warning, error from twisted.words.protocols.jabber import jid from twisted.internet import defer
--- 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 <http://www.gnu.org/licenses/>. -import gettext -gettext.install('sat', "i18n", unicode=True) - from twisted.application import service from twisted.internet import glib2reactor glib2reactor.install()
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ import __builtin__ from twisted.words.protocols.jabber.jid import JID from wokkel.xmppim import RosterItem
--- 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
--- 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 <http://www.gnu.org/licenses/>. +from sat.core.i18n import _ from logging import debug, info, error, warning from xml.dom import minidom from wokkel import data_form