2018-09-05 02:59:34 +02:00
|
|
|
# Copyright (C) 2010-2011 Denis Fomin <fominde AT gmail.com>
|
2011-08-30 14:23:16 +02:00
|
|
|
#
|
2018-09-05 02:59:34 +02:00
|
|
|
# This file is part of Gajim.
|
|
|
|
#
|
|
|
|
# Gajim is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published
|
|
|
|
# by the Free Software Foundation; version 3 only.
|
|
|
|
#
|
|
|
|
# Gajim 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 General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2018-09-13 23:56:12 +02:00
|
|
|
import os
|
2018-10-13 13:27:33 +02:00
|
|
|
import locale
|
2011-08-30 14:23:16 +02:00
|
|
|
import gettext
|
2018-09-13 23:56:12 +02:00
|
|
|
|
2018-04-25 20:49:37 +02:00
|
|
|
from gajim.common import configpaths
|
2011-08-30 14:23:16 +02:00
|
|
|
|
2018-10-05 00:08:35 +02:00
|
|
|
DOMAIN = 'gajim_plugins'
|
2018-09-23 14:40:49 +02:00
|
|
|
plugin_user_dir = configpaths.get('PLUGINS_USER')
|
2018-09-13 23:56:12 +02:00
|
|
|
plugins_locale_dir = os.path.join(plugin_user_dir, 'locale')
|
2011-08-30 14:23:16 +02:00
|
|
|
|
|
|
|
try:
|
2018-10-05 00:08:35 +02:00
|
|
|
t = gettext.translation(DOMAIN, plugins_locale_dir)
|
2011-08-30 14:23:16 +02:00
|
|
|
_ = t.gettext
|
2018-10-05 00:08:35 +02:00
|
|
|
except OSError:
|
2011-08-30 14:23:16 +02:00
|
|
|
_ = gettext.gettext
|
2018-10-13 13:27:33 +02:00
|
|
|
|
|
|
|
if hasattr(locale, 'bindtextdomain'):
|
|
|
|
locale.bindtextdomain(DOMAIN, plugins_locale_dir) # type: ignore
|