Adding support for disable language translation when default language not available in locale
--- 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)