Author: johannes
Date: 2007-05-24 03:46:51 -0500 (Thu, 24 May 2007)
New Revision: 9614
Modified:
trunk/gnue-common/src/apps/i18n.py
Log:
Use proper language and encoding on OS X
Modified: trunk/gnue-common/src/apps/i18n.py
===================================================================
--- trunk/gnue-common/src/apps/i18n.py 2007-05-23 15:01:44 UTC (rev 9613)
+++ trunk/gnue-common/src/apps/i18n.py 2007-05-24 08:46:51 UTC (rev 9614)
@@ -30,6 +30,7 @@
import gettext
import locale
+import os
import os.path
import sys
@@ -287,9 +288,17 @@
# Module initialization
# -----------------------------------------------------------------------------
-# Initialize locale. This has been reported to fail on Mac.
+# Initialize locale. On Mac locale.setlocale() does not return the default
+# locale. Instead we have to query the system preferences for the AppleLocale
+if sys.platform == 'darwin':
+ pipe = os.popen('defaults read -g AppleLocale')
+ deflc = pipe.read().strip() + '.UTF-8'
+ pipe.close()
+else:
+ deflc = ''
+
try:
- locale.setlocale (locale.LC_ALL, '')
+ locale.setlocale (locale.LC_ALL, deflc)
except:
pass
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.