[r21554]GrampsLocale:Move setlocale from _set_from_environment to
__init_first_instance So that encoding is set for Mac as well. svn: r21555
This commit is contained in:
parent
3e0fd433b5
commit
7e749a9e25
@ -102,9 +102,6 @@ class GrampsLocale(object):
|
|||||||
return super(GrampsLocale, cls).__new__(cls)
|
return super(GrampsLocale, cls).__new__(cls)
|
||||||
|
|
||||||
def __init_from_environment(self, lang=None, language=None):
|
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:
|
if not lang:
|
||||||
lang = ' '
|
lang = ' '
|
||||||
try:
|
try:
|
||||||
@ -165,6 +162,9 @@ class GrampsLocale(object):
|
|||||||
def __init_first_instance(self, localedir=None, lang=None,
|
def __init_first_instance(self, localedir=None, lang=None,
|
||||||
domain=None, language=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):
|
if localedir and os.path.exists(localedir):
|
||||||
self.localedir = localedir
|
self.localedir = localedir
|
||||||
else:
|
else:
|
||||||
@ -217,7 +217,6 @@ class GrampsLocale(object):
|
|||||||
locale.setlocale(locale.LC_MONETARY, self.currency)
|
locale.setlocale(locale.LC_MONETARY, self.currency)
|
||||||
#Next, we need to know what is the encoding from the native environment:
|
#Next, we need to know what is the encoding from the native environment:
|
||||||
self.encoding = locale.getlocale()[1]
|
self.encoding = locale.getlocale()[1]
|
||||||
|
|
||||||
#GtkBuilder depends on reading Glade files as UTF-8 and crashes if it
|
#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*
|
#doesn't, so set $LANG to have a UTF-8 locale. NB: This does *not*
|
||||||
#affect locale.getpreferredencoding() or sys.getfilesystemencoding()
|
#affect locale.getpreferredencoding() or sys.getfilesystemencoding()
|
||||||
|
Loading…
Reference in New Issue
Block a user