Adding support for disable language translation when default language not available in locale
authorlaurent
Thu, 31 Mar 2011 12:09:38 +0200
changeset 589 22e83880cdd9
parent 588 aa5a08d20ba1
child 590 d3fb687dd0b9
Adding support for disable language translation when default language not available in locale
Beremiz.py
--- a/Beremiz.py	Mon Mar 28 11:42:06 2011 +0200
+++ b/Beremiz.py	Thu Mar 31 12:09:38 2011 +0200
@@ -118,7 +118,12 @@
 # Define locale for wx
 loc = __builtin__.__dict__.get('loc', None)
 if loc is None:
-    loc = wx.Locale(langid)
+    test_loc = wx.Locale(langid)
+    test_loc.AddCatalogLookupPathPrefix(localedir)
+    if test_loc.AddCatalog(domain):
+        loc = wx.Locale(langid)
+    else:
+        loc = wx.Locale(wx.LANGUAGE_ENGLISH)
     __builtin__.__dict__['loc'] = loc
 # Define location for searching translation files
 loc.AddCatalogLookupPathPrefix(localedir)