[sabayon] Ignore errors from locale.setlocale()



commit 3b53e229f4028dd1eb6bc2cd6f0b43626b7664d5
Author: Scott Balneaves <sbalneav legalaid mb ca>
Date:   Tue Aug 18 13:43:58 2009 -0500

    Ignore errors from locale.setlocale()
    
    This way people with busted locales will still be able to run the program
    (a C app would probably just ignore the result of setlocale(3), anyway).
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 lib/util.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/lib/util.py b/lib/util.py
index 998c16c..5aa8bff 100755
--- a/lib/util.py
+++ b/lib/util.py
@@ -115,7 +115,10 @@ def init_gettext ():
     util.init_gettext() at the entry point to any script and you'll be
     able to use _(), gettext(), and ngettext() to mark strings for
     translation."""
-    locale.setlocale (locale.LC_ALL, "")
+    try:
+         locale.setlocale (locale.LC_ALL, "")
+    except locale.Error:
+         pass
     gettext.install (PACKAGE, LOCALEDIR)
     # Python 2.4 compatibility
     import __builtin__



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