From 7e749a9e255ec99765b37013ca181bd593f50516 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 5 Mar 2013 17:26:00 +0000 Subject: [PATCH] [r21554]GrampsLocale:Move setlocale from _set_from_environment to __init_first_instance So that encoding is set for Mac as well. svn: r21555 --- gramps/gen/utils/grampslocale.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index e3077063b..cb810d96c 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -102,9 +102,6 @@ class GrampsLocale(object): return super(GrampsLocale, cls).__new__(cls) def __init_from_environment(self, lang=None, language=None): -#First, globally set the locale to what's in the environment: - locale.setlocale(locale.LC_ALL, '') - if not lang: lang = ' ' try: @@ -165,6 +162,9 @@ class GrampsLocale(object): def __init_first_instance(self, localedir=None, lang=None, domain=None, language=None): +#First, globally set the locale to what's in the environment: + locale.setlocale(locale.LC_ALL, '') + if localedir and os.path.exists(localedir): self.localedir = localedir else: @@ -217,7 +217,6 @@ class GrampsLocale(object): locale.setlocale(locale.LC_MONETARY, self.currency) #Next, we need to know what is the encoding from the native environment: self.encoding = locale.getlocale()[1] - #GtkBuilder depends on reading Glade files as UTF-8 and crashes if it #doesn't, so set $LANG to have a UTF-8 locale. NB: This does *not* #affect locale.getpreferredencoding() or sys.getfilesystemencoding()