From d3e2e0ebcb2f9ba803576e48e7b9c752cc7e9f1a Mon Sep 17 00:00:00 2001 From: Tong Li Date: Mon, 12 Dec 2016 13:10:08 +0800 Subject: [PATCH] Fix 'an unknown error has occurred' issue when selecting languages using non-latin characters Now when kdump_anaconda_addon is enabled and languages which use non-latin characters are selected in anaconda, e.g. Chinese and Japanese, it will raise an error and unable to continue to finish the installation process. This is because 'gettext.ldgettext' will return a byte object when translation includes non-latin character, while anaconda's core code requires a string. To fix this, we apply the mothod used by pyanaconda, which is invoking gettext after getting a translation instance. This can make sure that a str object will be returned. --- com_redhat_kdump/i18n.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com_redhat_kdump/i18n.py b/com_redhat_kdump/i18n.py index a8cd27a..0c1cbd9 100644 --- a/com_redhat_kdump/i18n.py +++ b/com_redhat_kdump/i18n.py @@ -23,5 +23,5 @@ import gettext -_ = lambda x: gettext.ldgettext("kdump-anaconda-addon", x) +_ = lambda x: gettext.translation("kdump-anaconda-addon", fallback=True).gettext(x) if x != "" else "" N_ = lambda x: x