# HG changeset patch
# User laurent
# Date 1301566192 -7200
# Node ID fb787f6cbe33bed5c6adddb8f13e65dcae4786f7
# Parent  07a7989f58e49df65c49d7c2f8374f5fc85267a7
Adding support for disable language translation when default language not available in locale

diff -r 07a7989f58e4 -r fb787f6cbe33 PLCOpenEditor.py
--- a/PLCOpenEditor.py	Thu Mar 31 10:53:13 2011 +0200
+++ b/PLCOpenEditor.py	Thu Mar 31 12:09:52 2011 +0200
@@ -83,14 +83,19 @@
 # Get folder containing translation files
 localedir = os.path.join(CWD,"locale")
 # Get the default language
-langid = wx.LANGUAGE_DEFAULT
+langid = wx.LANGUAGE_SPANISH#wx.LANGUAGE_DEFAULT
 # Define translation domain (name of translation files)
 domain = "PLCOpenEditor"
 
 # 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)