81 import __builtin__ |
81 import __builtin__ |
82 |
82 |
83 # Get folder containing translation files |
83 # Get folder containing translation files |
84 localedir = os.path.join(CWD,"locale") |
84 localedir = os.path.join(CWD,"locale") |
85 # Get the default language |
85 # Get the default language |
86 langid = wx.LANGUAGE_DEFAULT |
86 langid = wx.LANGUAGE_SPANISH#wx.LANGUAGE_DEFAULT |
87 # Define translation domain (name of translation files) |
87 # Define translation domain (name of translation files) |
88 domain = "PLCOpenEditor" |
88 domain = "PLCOpenEditor" |
89 |
89 |
90 # Define locale for wx |
90 # Define locale for wx |
91 loc = __builtin__.__dict__.get('loc', None) |
91 loc = __builtin__.__dict__.get('loc', None) |
92 if loc is None: |
92 if loc is None: |
93 loc = wx.Locale(langid) |
93 test_loc = wx.Locale(langid) |
|
94 test_loc.AddCatalogLookupPathPrefix(localedir) |
|
95 if test_loc.AddCatalog(domain): |
|
96 loc = wx.Locale(langid) |
|
97 else: |
|
98 loc = wx.Locale(wx.LANGUAGE_ENGLISH) |
94 __builtin__.__dict__['loc'] = loc |
99 __builtin__.__dict__['loc'] = loc |
95 # Define location for searching translation files |
100 # Define location for searching translation files |
96 loc.AddCatalogLookupPathPrefix(localedir) |
101 loc.AddCatalogLookupPathPrefix(localedir) |
97 # Define locale domain |
102 # Define locale domain |
98 loc.AddCatalog(domain) |
103 loc.AddCatalog(domain) |