- related to #18
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gnome-abrt | 2 +-
src/gnome_abrt/Makefile.am | 11 ++++++++---
src/gnome_abrt/__init__.py | 20 --------------------
src/gnome_abrt/__init__.py.in | 23 +++++++++++++++++++++++
src/gnome_abrt/l10n.py | 15 ++++++++-------
5 files changed, 40 insertions(+), 31 deletions(-)
delete mode 100644 src/gnome_abrt/__init__.py
create mode 100644 src/gnome_abrt/__init__.py.in
diff --git a/src/gnome-abrt b/src/gnome-abrt
index 8d4cf36..63e25a7 100755
--- a/src/gnome-abrt
+++ b/src/gnome-abrt
@@ -234,7 +234,7 @@ class OopsApplication(Gtk.Application):
def on_action_about(self, action, parameter):
dialog = Gtk.AboutDialog()
dialog.set_icon_name("abrt")
- #dialog.set_version(VERSION)
+ dialog.set_version(gnome_abrt.VERSION)
dialog.set_logo_icon_name("abrt")
dialog.set_program_name("ABRT")
dialog.set_copyright("Copyright © 2012 Red Hat, Inc")
diff --git a/src/gnome_abrt/Makefile.am b/src/gnome_abrt/Makefile.am
index 2635832..387d788 100644
--- a/src/gnome_abrt/Makefile.am
+++ b/src/gnome_abrt/Makefile.am
@@ -20,6 +20,11 @@ gnome_abrtexec_PYTHON = \
controller.py: controller.py.in
sed -e s,\@libexecdir\@,$(libexecdir),g $< > $@
+__init__.py: __init__.py.in
+ sed -e s,\@PACKAGE\@,$(PACKAGE),g \
+ -e s,\@VERSION\@,$(VERSION),g \
+ -e s,\@localedir\@,$(localedir),g $< > $@
+
gnome_abrt_glade.py: oops.glade
{ \
echo '# coding=utf-8'; \
@@ -30,8 +35,8 @@ gnome_abrt_glade.py: oops.glade
gnome_abrtdir = $(pythondir)/gnome_abrt
-EXTRA_DIST = oops.glade controller.py.in
+EXTRA_DIST = __init__.py.in oops.glade controller.py.in
-DISTCLEANFILES = controller.py
+DISTCLEANFILES = __init__.py controller.py gnome_abrt_glade.py
-all-local: controller.py gnome_abrt_glade.py
+all-local: __init__.py controller.py gnome_abrt_glade.py
diff --git a/src/gnome_abrt/__init__.py b/src/gnome_abrt/__init__.py
deleted file mode 100644
index 178bbd2..0000000
--- a/src/gnome_abrt/__init__.py
+++ /dev/null
@@ -1,20 +0,0 @@
-## Copyright (C) 2012 ABRT team <abrt-devel-list(a)redhat.com>
-## Copyright (C) 2001-2005 Red Hat, Inc.
-
-## This program 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; either version 2 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 General Public License for more details.
-
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-def init():
- import gnome_abrt.l10n
- gnome_abrt.l10n.init()
diff --git a/src/gnome_abrt/__init__.py.in b/src/gnome_abrt/__init__.py.in
new file mode 100644
index 0000000..a4c151a
--- /dev/null
+++ b/src/gnome_abrt/__init__.py.in
@@ -0,0 +1,23 @@
+## Copyright (C) 2012 ABRT team <abrt-devel-list(a)redhat.com>
+## Copyright (C) 2001-2005 Red Hat, Inc.
+
+## This program 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; either version 2 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 General Public License for more details.
+
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+PACKAGE = "@PACKAGE@"
+VERSION = "@VERSION@"
+
+def init():
+ import gnome_abrt.l10n
+ gnome_abrt.l10n.init(PACKAGE, "@localedir@")
diff --git a/src/gnome_abrt/l10n.py b/src/gnome_abrt/l10n.py
index f9cab81..154d010 100644
--- a/src/gnome_abrt/l10n.py
+++ b/src/gnome_abrt/l10n.py
@@ -18,11 +18,13 @@
import gettext
import locale
-GETTEXT_PROGNAME = "gnome-abrt"
+GETTEXT_PROGNAME = None
_ = gettext.lgettext
-def init():
+def init(progname, localedir='/usr/share/locale'):
+ global GETTEXT_PROGNAME
+ GETTEXT_PROGNAME = progname
try:
locale.setlocale(locale.LC_ALL, "")
except locale.Error:
@@ -30,8 +32,7 @@ def init():
os.environ['LC_ALL'] = 'C'
locale.setlocale(locale.LC_ALL, "")
- gettext.bind_textdomain_codeset(GETTEXT_PROGNAME,
- locale.nl_langinfo(locale.CODESET))
- # TODO: configurable path to the binary
- gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
- gettext.textdomain(GETTEXT_PROGNAME)
+ gettext.bind_textdomain_codeset(progname,
+ locale.nl_langinfo(locale.CODESET))
+ gettext.bindtextdomain(progname, localedir)
+ gettext.textdomain(progname)
--
1.8.1.4