# HG changeset patch # User Andrey Skvortsov # Date 1505496534 -10800 # Node ID c18adf359d218e02fbb783daa5b599f3af25e780 # Parent 8626a4948d5e50d046cc1512123a5e7ec83ff5b2 lazy locale initialization wx.Locale() can't be called without wx.App. So don't call it at import. It makes PLCOpenEditor simpler. diff -r 8626a4948d5e -r c18adf359d21 util/TranslationCatalogs.py --- a/util/TranslationCatalogs.py Fri Sep 15 20:05:41 2017 +0300 +++ b/util/TranslationCatalogs.py Fri Sep 15 20:28:54 2017 +0300 @@ -26,11 +26,7 @@ import __builtin__ import wx -# Get the default language -langid = wx.LANGUAGE_DEFAULT - -# Define locale for wx -locale = wx.Locale(langid) +locale = None __builtin__.__dict__['_'] = wx.GetTranslation @@ -53,6 +49,11 @@ if os.path.exists(locale_dir) and os.path.isdir(locale_dir): domain = GetDomain(locale_dir) if domain is not None: + global locale + if locale is None: + # Define locale for wx + locale = wx.Locale(wx.LANGUAGE_DEFAULT) + locale.AddCatalogLookupPathPrefix(locale_dir) locale.AddCatalog(domain)