diff --git a/README4TRANSLATORS b/README4TRANSLATORS index 98a7dcf5..af91b299 100644 --- a/README4TRANSLATORS +++ b/README4TRANSLATORS @@ -3,8 +3,11 @@ First of all, thank you for helping translating SàT :) 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 @@ To translate a file, you can use a dedicated tool as the excellent gtranslator: 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 --git a/frontends/src/bridge/DBus.py b/frontends/src/bridge/DBus.py index c996312e..c9704965 100644 --- a/frontends/src/bridge/DBus.py +++ b/frontends/src/bridge/DBus.py @@ -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 --git a/frontends/src/constants.py b/frontends/src/constants.py index 808ed06e..08627969 100644 --- a/frontends/src/constants.py +++ b/frontends/src/constants.py @@ -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 --git a/frontends/src/jp/jp b/frontends/src/jp/jp index d5fa0d18..51eea11c 100755 --- a/frontends/src/jp/jp +++ b/frontends/src/jp/jp @@ -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 @@ logging.basicConfig(level=logging.DEBUG, format='%(message)s') ### -import gettext -gettext.install('jp', unicode=True) - import sys import os from os.path import abspath, basename, dirname diff --git a/frontends/src/primitivus/card_game.py b/frontends/src/primitivus/card_game.py index aa66d4c0..faf8f516 100644 --- a/frontends/src/primitivus/card_game.py +++ b/frontends/src/primitivus/card_game.py @@ -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 --git a/frontends/src/primitivus/chat.py b/frontends/src/primitivus/chat.py index 41061e37..4857595a 100644 --- a/frontends/src/primitivus/chat.py +++ b/frontends/src/primitivus/chat.py @@ -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 --git a/frontends/src/primitivus/contact_list.py b/frontends/src/primitivus/contact_list.py index 537b4938..53ad98d2 100644 --- a/frontends/src/primitivus/contact_list.py +++ b/frontends/src/primitivus/contact_list.py @@ -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 --git a/frontends/src/primitivus/gateways.py b/frontends/src/primitivus/gateways.py index b78e4832..9de07c9b 100644 --- a/frontends/src/primitivus/gateways.py +++ b/frontends/src/primitivus/gateways.py @@ -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 --git a/frontends/src/primitivus/primitivus b/frontends/src/primitivus/primitivus index 0b302ca6..a766b6cc 100755 --- a/frontends/src/primitivus/primitivus +++ b/frontends/src/primitivus/primitivus @@ -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 --git a/frontends/src/primitivus/profile_manager.py b/frontends/src/primitivus/profile_manager.py index 7f4de090..7fab4ba5 100644 --- a/frontends/src/primitivus/profile_manager.py +++ b/frontends/src/primitivus/profile_manager.py @@ -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 --git a/frontends/src/primitivus/progress.py b/frontends/src/primitivus/progress.py index a2db9c2b..652ffab4 100644 --- a/frontends/src/primitivus/progress.py +++ b/frontends/src/primitivus/progress.py @@ -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 --git a/frontends/src/primitivus/status.py b/frontends/src/primitivus/status.py index 0aef556f..3395e923 100644 --- a/frontends/src/primitivus/status.py +++ b/frontends/src/primitivus/status.py @@ -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 --git a/frontends/src/primitivus/xmlui.py b/frontends/src/primitivus/xmlui.py index dbaad1ec..d3d0bc84 100644 --- a/frontends/src/primitivus/xmlui.py +++ b/frontends/src/primitivus/xmlui.py @@ -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 --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py index 3b35bb2c..e7aa5b8c 100644 --- a/frontends/src/quick_frontend/quick_app.py +++ b/frontends/src/quick_frontend/quick_app.py @@ -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 optparse import OptionParser 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 --git a/frontends/src/quick_frontend/quick_chat.py b/frontends/src/quick_frontend/quick_chat.py index 8d4adfda..d5d3c0b7 100644 --- a/frontends/src/quick_frontend/quick_chat.py +++ b/frontends/src/quick_frontend/quick_chat.py @@ -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 --git a/frontends/src/quick_frontend/quick_contact_list.py b/frontends/src/quick_frontend/quick_contact_list.py index fed9e9d6..718a58a5 100644 --- a/frontends/src/quick_frontend/quick_contact_list.py +++ b/frontends/src/quick_frontend/quick_contact_list.py @@ -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 --git a/frontends/src/quick_frontend/quick_contact_management.py b/frontends/src/quick_frontend/quick_contact_management.py index 4dd87a5a..5ff7cd06 100644 --- a/frontends/src/quick_frontend/quick_contact_management.py +++ b/frontends/src/quick_frontend/quick_contact_management.py @@ -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 --git a/frontends/src/quick_frontend/quick_gateways.py b/frontends/src/quick_frontend/quick_gateways.py index 585f2299..ab63a39d 100644 --- a/frontends/src/quick_frontend/quick_gateways.py +++ b/frontends/src/quick_frontend/quick_gateways.py @@ -20,6 +20,7 @@ +from sat.core.i18n import _ class QuickGatewaysManager(object): diff --git a/frontends/src/wix/card_game.py b/frontends/src/wix/card_game.py index b4693e29..728634df 100644 --- a/frontends/src/wix/card_game.py +++ b/frontends/src/wix/card_game.py @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import os.path, glob import pdb diff --git a/frontends/src/wix/chat.py b/frontends/src/wix/chat.py index 86611218..dc9643cf 100644 --- a/frontends/src/wix/chat.py +++ b/frontends/src/wix/chat.py @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import os.path import time diff --git a/frontends/src/wix/constants.py b/frontends/src/wix/constants.py index 39def933..89454c0f 100644 --- a/frontends/src/wix/constants.py +++ b/frontends/src/wix/constants.py @@ -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 --git a/frontends/src/wix/contact_list.py b/frontends/src/wix/contact_list.py index edbc34f3..e2791824 100644 --- a/frontends/src/wix/contact_list.py +++ b/frontends/src/wix/contact_list.py @@ -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 --git a/frontends/src/wix/gateways.py b/frontends/src/wix/gateways.py index b4ff3879..ff12f74e 100644 --- a/frontends/src/wix/gateways.py +++ b/frontends/src/wix/gateways.py @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from xml.dom import minidom diff --git a/frontends/src/wix/main_window.py b/frontends/src/wix/main_window.py index 3f7ea356..66ffac82 100644 --- a/frontends/src/wix/main_window.py +++ b/frontends/src/wix/main_window.py @@ -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 --git a/frontends/src/wix/param.py b/frontends/src/wix/param.py index aa5427df..d5c80324 100644 --- a/frontends/src/wix/param.py +++ b/frontends/src/wix/param.py @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from xml.dom import minidom diff --git a/frontends/src/wix/profile.py b/frontends/src/wix/profile.py index 3e3c340a..f6093323 100644 --- a/frontends/src/wix/profile.py +++ b/frontends/src/wix/profile.py @@ -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 --git a/frontends/src/wix/profile_manager.py b/frontends/src/wix/profile_manager.py index e2063af2..569599f3 100644 --- a/frontends/src/wix/profile_manager.py +++ b/frontends/src/wix/profile_manager.py @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from logging import debug, info, error diff --git a/frontends/src/wix/quiz_game.py b/frontends/src/wix/quiz_game.py index ae352cfc..d93845ff 100644 --- a/frontends/src/wix/quiz_game.py +++ b/frontends/src/wix/quiz_game.py @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import os.path, glob import pdb diff --git a/frontends/src/wix/xmlui.py b/frontends/src/wix/xmlui.py index 8c69ab7e..0467537b 100644 --- a/frontends/src/wix/xmlui.py +++ b/frontends/src/wix/xmlui.py @@ -19,6 +19,7 @@ +from sat.core.i18n import _ import wx import pdb from xml.dom import minidom diff --git a/src/bridge/bridge_constructor/dbus_frontend_template.py b/src/bridge/bridge_constructor/dbus_frontend_template.py index 7c55cd4d..bc9f5ff3 100644 --- a/src/bridge/bridge_constructor/dbus_frontend_template.py +++ b/src/bridge/bridge_constructor/dbus_frontend_template.py @@ -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 --git a/src/core/i18n.py b/src/core/i18n.py new file mode 100644 index 00000000..08eda9b1 --- /dev/null +++ b/src/core/i18n.py @@ -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 --git a/src/core/sat_main.py b/src/core/sat_main.py index a6661777..6e52a7e6 100644 --- a/src/core/sat_main.py +++ b/src/core/sat_main.py @@ -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 --git a/src/core/xmpp.py b/src/core/xmpp.py index 617c8e79..17e0af0c 100644 --- a/src/core/xmpp.py +++ b/src/core/xmpp.py @@ -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 --git a/src/memory/memory.py b/src/memory/memory.py index 04cde277..87785c19 100644 --- a/src/memory/memory.py +++ b/src/memory/memory.py @@ -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 --git a/src/memory/persistent.py b/src/memory/persistent.py index 77860327..13c5a5f7 100644 --- a/src/memory/persistent.py +++ b/src/memory/persistent.py @@ -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 --git a/src/memory/sqlite.py b/src/memory/sqlite.py index f2c6128f..b4896c7f 100644 --- a/src/memory/sqlite.py +++ b/src/memory/sqlite.py @@ -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 --git a/src/plugins/deprecated_misc_cs.py b/src/plugins/deprecated_misc_cs.py index 4151fad8..522bcdc7 100755 --- a/src/plugins/deprecated_misc_cs.py +++ b/src/plugins/deprecated_misc_cs.py @@ -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 --git a/src/plugins/plugin_exp_command_export.py b/src/plugins/plugin_exp_command_export.py index 2d3beb87..57fe2187 100755 --- a/src/plugins/plugin_exp_command_export.py +++ b/src/plugins/plugin_exp_command_export.py @@ -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 --git a/src/plugins/plugin_exp_parrot.py b/src/plugins/plugin_exp_parrot.py index ced47637..af76a22c 100755 --- a/src/plugins/plugin_exp_parrot.py +++ b/src/plugins/plugin_exp_parrot.py @@ -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 --git a/src/plugins/plugin_exp_pipe.py b/src/plugins/plugin_exp_pipe.py index 6819df28..1582eb7d 100755 --- a/src/plugins/plugin_exp_pipe.py +++ b/src/plugins/plugin_exp_pipe.py @@ -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 --git a/src/plugins/plugin_misc_account.py b/src/plugins/plugin_misc_account.py index 40b9d0e9..2dcad8b4 100755 --- a/src/plugins/plugin_misc_account.py +++ b/src/plugins/plugin_misc_account.py @@ -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 --git a/src/plugins/plugin_misc_groupblog.py b/src/plugins/plugin_misc_groupblog.py index 36683909..73570f8e 100755 --- a/src/plugins/plugin_misc_groupblog.py +++ b/src/plugins/plugin_misc_groupblog.py @@ -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 --git a/src/plugins/plugin_misc_imap.py b/src/plugins/plugin_misc_imap.py index d9f94e80..05d5f964 100755 --- a/src/plugins/plugin_misc_imap.py +++ b/src/plugins/plugin_misc_imap.py @@ -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 --git a/src/plugins/plugin_misc_maildir.py b/src/plugins/plugin_misc_maildir.py index e668f5f1..8d544fd7 100755 --- a/src/plugins/plugin_misc_maildir.py +++ b/src/plugins/plugin_misc_maildir.py @@ -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 --git a/src/plugins/plugin_misc_quiz.py b/src/plugins/plugin_misc_quiz.py index 68c428d3..3dc039dd 100755 --- a/src/plugins/plugin_misc_quiz.py +++ b/src/plugins/plugin_misc_quiz.py @@ -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 --git a/src/plugins/plugin_misc_radiocol.py b/src/plugins/plugin_misc_radiocol.py index 3351668e..fcc45dcf 100755 --- a/src/plugins/plugin_misc_radiocol.py +++ b/src/plugins/plugin_misc_radiocol.py @@ -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 --git a/src/plugins/plugin_misc_room_game.py b/src/plugins/plugin_misc_room_game.py index 087c15ea..a7c4463a 100644 --- a/src/plugins/plugin_misc_room_game.py +++ b/src/plugins/plugin_misc_room_game.py @@ -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 --git a/src/plugins/plugin_misc_smtp.py b/src/plugins/plugin_misc_smtp.py index 5aca4a56..c5a90f59 100755 --- a/src/plugins/plugin_misc_smtp.py +++ b/src/plugins/plugin_misc_smtp.py @@ -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 --git a/src/plugins/plugin_misc_tarot.py b/src/plugins/plugin_misc_tarot.py index f1a99f5b..a3e71287 100755 --- a/src/plugins/plugin_misc_tarot.py +++ b/src/plugins/plugin_misc_tarot.py @@ -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 --git a/src/plugins/plugin_misc_text_commands.py b/src/plugins/plugin_misc_text_commands.py index 528e12d2..e526ad06 100755 --- a/src/plugins/plugin_misc_text_commands.py +++ b/src/plugins/plugin_misc_text_commands.py @@ -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 --git a/src/plugins/plugin_misc_text_syntaxes.py b/src/plugins/plugin_misc_text_syntaxes.py index 661453eb..a6943566 100755 --- a/src/plugins/plugin_misc_text_syntaxes.py +++ b/src/plugins/plugin_misc_text_syntaxes.py @@ -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 @@ from lxml.html import clean import re -CATEGORY = "Composition" +CATEGORY = D_("Composition") NAME = "Syntax" _SYNTAX_XHTML = "XHTML" _SYNTAX_CURRENT = "@CURRENT@" @@ -85,7 +86,7 @@ class TextSyntaxes(object): 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 --git a/src/plugins/plugin_misc_xmllog.py b/src/plugins/plugin_misc_xmllog.py index 00329fd3..becaac76 100755 --- a/src/plugins/plugin_misc_xmllog.py +++ b/src/plugins/plugin_misc_xmllog.py @@ -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 --git a/src/plugins/plugin_xep_0020.py b/src/plugins/plugin_xep_0020.py index 6da4436f..4abf219a 100755 --- a/src/plugins/plugin_xep_0020.py +++ b/src/plugins/plugin_xep_0020.py @@ -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 --git a/src/plugins/plugin_xep_0033.py b/src/plugins/plugin_xep_0033.py index 38e20247..9d753a2e 100644 --- a/src/plugins/plugin_xep_0033.py +++ b/src/plugins/plugin_xep_0033.py @@ -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 --git a/src/plugins/plugin_xep_0045.py b/src/plugins/plugin_xep_0045.py index 0194afca..1bf57d13 100755 --- a/src/plugins/plugin_xep_0045.py +++ b/src/plugins/plugin_xep_0045.py @@ -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 --git a/src/plugins/plugin_xep_0047.py b/src/plugins/plugin_xep_0047.py index 1950e0af..eb7ceb11 100644 --- a/src/plugins/plugin_xep_0047.py +++ b/src/plugins/plugin_xep_0047.py @@ -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 --git a/src/plugins/plugin_xep_0050.py b/src/plugins/plugin_xep_0050.py index 229e7755..b750a9ee 100644 --- a/src/plugins/plugin_xep_0050.py +++ b/src/plugins/plugin_xep_0050.py @@ -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 --git a/src/plugins/plugin_xep_0054.py b/src/plugins/plugin_xep_0054.py index 0b933b5c..8c87f69e 100755 --- a/src/plugins/plugin_xep_0054.py +++ b/src/plugins/plugin_xep_0054.py @@ -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 --git a/src/plugins/plugin_xep_0055.py b/src/plugins/plugin_xep_0055.py index a60706df..af71e1ec 100644 --- a/src/plugins/plugin_xep_0055.py +++ b/src/plugins/plugin_xep_0055.py @@ -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 --git a/src/plugins/plugin_xep_0060.py b/src/plugins/plugin_xep_0060.py index 234cf8e3..c2d291d5 100755 --- a/src/plugins/plugin_xep_0060.py +++ b/src/plugins/plugin_xep_0060.py @@ -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 --git a/src/plugins/plugin_xep_0065.py b/src/plugins/plugin_xep_0065.py index c93a5ff8..2f068a0c 100755 --- a/src/plugins/plugin_xep_0065.py +++ b/src/plugins/plugin_xep_0065.py @@ -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 --git a/src/plugins/plugin_xep_0071.py b/src/plugins/plugin_xep_0071.py index 41996fec..a495b774 100644 --- a/src/plugins/plugin_xep_0071.py +++ b/src/plugins/plugin_xep_0071.py @@ -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 --git a/src/plugins/plugin_xep_0077.py b/src/plugins/plugin_xep_0077.py index fd6cbcac..c3b6f6b6 100755 --- a/src/plugins/plugin_xep_0077.py +++ b/src/plugins/plugin_xep_0077.py @@ -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 --git a/src/plugins/plugin_xep_0085.py b/src/plugins/plugin_xep_0085.py index 5c9115a3..a6cc7b20 100755 --- a/src/plugins/plugin_xep_0085.py +++ b/src/plugins/plugin_xep_0085.py @@ -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 --git a/src/plugins/plugin_xep_0095.py b/src/plugins/plugin_xep_0095.py index 24662fa4..6c9c2a71 100644 --- a/src/plugins/plugin_xep_0095.py +++ b/src/plugins/plugin_xep_0095.py @@ -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 --git a/src/plugins/plugin_xep_0096.py b/src/plugins/plugin_xep_0096.py index 38d3e592..db9b3be1 100755 --- a/src/plugins/plugin_xep_0096.py +++ b/src/plugins/plugin_xep_0096.py @@ -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 --git a/src/plugins/plugin_xep_0100.py b/src/plugins/plugin_xep_0100.py index 0641d5d0..38ba5f0d 100755 --- a/src/plugins/plugin_xep_0100.py +++ b/src/plugins/plugin_xep_0100.py @@ -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 --git a/src/plugins/plugin_xep_0115.py b/src/plugins/plugin_xep_0115.py index 868c7cd8..c803ac6e 100755 --- a/src/plugins/plugin_xep_0115.py +++ b/src/plugins/plugin_xep_0115.py @@ -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 --git a/src/plugins/plugin_xep_0163.py b/src/plugins/plugin_xep_0163.py index 137797ab..af844f6c 100755 --- a/src/plugins/plugin_xep_0163.py +++ b/src/plugins/plugin_xep_0163.py @@ -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 --git a/src/plugins/plugin_xep_0249.py b/src/plugins/plugin_xep_0249.py index 0aecd4f8..853b3e85 100755 --- a/src/plugins/plugin_xep_0249.py +++ b/src/plugins/plugin_xep_0249.py @@ -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 --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py index 202b2895..8e145214 100755 --- a/src/plugins/plugin_xep_0277.py +++ b/src/plugins/plugin_xep_0277.py @@ -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 --git a/src/sat.tac b/src/sat.tac index 7f0aeb38..3d20f946 100644 --- a/src/sat.tac +++ b/src/sat.tac @@ -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 --git a/src/test/helpers.py b/src/test/helpers.py index 9504b243..d6822706 100644 --- a/src/test/helpers.py +++ b/src/test/helpers.py @@ -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 --git a/src/tools/misc.py b/src/tools/misc.py index a1f2961d..89664c69 100644 --- a/src/tools/misc.py +++ b/src/tools/misc.py @@ -19,6 +19,7 @@ """Misc usefull classes""" +from sat.core.i18n import _ import sys from logging import debug, warning diff --git a/src/tools/xml_tools.py b/src/tools/xml_tools.py index 14278083..d20dd618 100644 --- a/src/tools/xml_tools.py +++ b/src/tools/xml_tools.py @@ -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