commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9614 - trunk/gnue-common/src/apps


From: johannes
Subject: [gnue] r9614 - trunk/gnue-common/src/apps
Date: Thu, 24 May 2007 03:46:51 -0500 (CDT)

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
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]