diff --git a/0001-fix-to-run-with-translations-in-Python-3.patch b/0001-fix-to-run-with-translations-in-Python-3.patch new file mode 100644 index 0000000..72de4a1 --- /dev/null +++ b/0001-fix-to-run-with-translations-in-Python-3.patch @@ -0,0 +1,88 @@ +From 960089e713b8f9e3fa49c73190f2dc113a7ec1b9 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Tue, 18 Aug 2015 12:39:41 -0700 +Subject: [PATCH] fix to run with translations in Python 3 + +Defining '_' as 'gettext.gettext' was causing the app to hang +when run under Python 3 any time a translation was encountered, +due to a type problem (bytes vs. str). In all files, change the +_ definition to one Anaconda uses: I tested this works with +both Python 2 and Python 3. +--- + src/install_packages3.py | 2 +- + src/language_backend.py | 4 +--- + src/language_gui.py | 2 +- + src/language_tui.py | 2 +- + src/system-config-language.py | 2 +- + 5 files changed, 5 insertions(+), 7 deletions(-) + +diff --git a/src/install_packages3.py b/src/install_packages3.py +index 65ff093..0d2a2f1 100644 +--- a/src/install_packages3.py ++++ b/src/install_packages3.py +@@ -27,7 +27,7 @@ import os + from gi.repository import Gio, GLib + + import gettext +-_ = lambda x: gettext.ldgettext("system-config-language", x) ++_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" + N_ = lambda x: x + + +diff --git a/src/language_backend.py b/src/language_backend.py +index 87fd44e..e45ae27 100644 +--- a/src/language_backend.py ++++ b/src/language_backend.py +@@ -24,9 +24,7 @@ import string + import os + + import gettext +-gettext.bindtextdomain("system-config-language", "/usr/share/locale") +-gettext.textdomain("system-config-language") +-_ = gettext.gettext ++_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" + + class LanguageBackend(object): + def __init__(self): +diff --git a/src/language_gui.py b/src/language_gui.py +index 7f7b34d..21c0a2c 100644 +--- a/src/language_gui.py ++++ b/src/language_gui.py +@@ -27,7 +27,7 @@ import install_packages3 + import string + + import gettext +-_ = lambda x: gettext.ldgettext("system-config-language", x) ++_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" + N_ = lambda x: x + + class ChildWindow(Gtk.ApplicationWindow): +diff --git a/src/language_tui.py b/src/language_tui.py +index e0a83cf..5275cfd 100644 +--- a/src/language_tui.py ++++ b/src/language_tui.py +@@ -27,7 +27,7 @@ import gettext + import string + + locale.setlocale(locale.LC_ALL, "") +-_ = lambda x: gettext.ldgettext("system-config-language", x) ++_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" + N_ = lambda x: x + gettext.bind_textdomain_codeset("system-config-language", + locale.nl_langinfo(locale.CODESET)) +diff --git a/src/system-config-language.py b/src/system-config-language.py +index b116474..6259f23 100755 +--- a/src/system-config-language.py ++++ b/src/system-config-language.py +@@ -26,7 +26,7 @@ import getopt + import os + + import gettext +-_ = lambda x: gettext.ldgettext("system-config-language", x) ++_ = lambda x: gettext.translation("system-config-language", fallback=True).gettext(x) if x != "" else "" + N_ = lambda x: x + + class SystemConfigLanguage(object): +-- +2.5.0 + diff --git a/system-config-language.spec b/system-config-language.spec index b3d38f8..618d0c1 100644 --- a/system-config-language.spec +++ b/system-config-language.spec @@ -1,9 +1,11 @@ Summary: A graphical interface for modifying the system language Name: system-config-language Version: 3.0.0 -Release: 3%{?dist} +Release: 4%{?dist} URL: https://fedorahosted.org/system-config-language/ Source0: https://fedorahosted.org/releases/s/y/system-config-language/%{name}-%{version}.tar.xz +# Fix app to run under Python 3 with translations: RHBZ #1254775 +Patch0: 0001-fix-to-run-with-translations-in-Python-3.patch License: GPLv2+ BuildArch: noarch @@ -29,6 +31,7 @@ allows the user to change the default language of the system. %prep %setup -q +%patch0 -p1 -b .py3-trans sed -i "23 i gi.require_version('Gtk', '3.0')" src/language_gui.py sed -i "23 i import gi" src/language_gui.py @@ -75,7 +78,8 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %{_datadir}/polkit-1/actions/org.fedoraproject.config.language.policy %changelog -* Tue Aug 18 2015 Adam Williamson +* Tue Aug 18 2015 Adam Williamson - 3.0.0-4 +- fix running under Python 3 with translations (RHBZ #1254775) - fix package dependencies: add python3-dnf, drop pygtk2 and gtk3 * Mon Aug 17 2015 Parag Nemade - 3.0.0-3