[nanny] Add locale support to win32
- From: Roberto Majadas <telemaco src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nanny] Add locale support to win32
- Date: Sat, 5 Feb 2011 12:04:25 +0000 (UTC)
commit 4bd61a76dc810c7958fb4e0cf8367986f351742e
Author: Roberto Majadas <roberto majadas openshine com>
Date: Sat Feb 5 13:03:10 2011 +0100
Add locale support to win32
client/gnome/__init__.py.in | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/client/gnome/__init__.py.in b/client/gnome/__init__.py.in
index ba9fff4..ea4c2f8 100644
--- a/client/gnome/__init__.py.in
+++ b/client/gnome/__init__.py.in
@@ -47,5 +47,20 @@ elif os.name == "nt":
locale_dir = os.path.join(root_path, "share" ,"locale")
print "LOCALE PATH = %s" % locale_dir
-gettext.bindtextdomain(GETTEXT_DOMAIN, locale_dir)
-gettext.textdomain(GETTEXT_DOMAIN)
+if os.name == "posix" :
+ gettext.bindtextdomain(GETTEXT_DOMAIN, locale_dir)
+ gettext.textdomain(GETTEXT_DOMAIN)
+else:
+ locale.setlocale(locale.LC_ALL, '')
+ if os.name == 'nt':
+ # windows hack for locale setting
+ lang = os.getenv('LANG')
+ if lang is None:
+ defaultLang, defaultEnc = locale.getdefaultlocale()
+ if defaultLang:
+ lang = defaultLang
+ if lang:
+ os.environ['LANG'] = lang
+
+ gettext.bindtextdomain(GETTEXT_DOMAIN, locale_dir)
+ gettext.textdomain(GETTEXT_DOMAIN)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]