Beremiz_service.py
branchwxPython4
changeset 3738 9ce94d0d3764
parent 3642 cd3d15e8ef42
parent 3731 549763a28934
child 3750 f62625418bff
equal deleted inserted replaced
3730:87dac789bdaf 3738:9ce94d0d3764
   184 
   184 
   185 def Bpath(*args):
   185 def Bpath(*args):
   186     return os.path.join(beremiz_dir, *args)
   186     return os.path.join(beremiz_dir, *args)
   187 
   187 
   188 
   188 
       
   189 import locale
       
   190 # Matiec's standard library relies on libC's locale-dependent
       
   191 # string to/from number convertions, but IEC-61131 counts
       
   192 # on '.' for decimal point. Therefore locale is reset to "C" */
       
   193 locale.setlocale(locale.LC_NUMERIC, "C")
       
   194 
   189 def SetupI18n():
   195 def SetupI18n():
   190     # Get folder containing translation files
   196     # Get folder containing translation files
   191     localedir = os.path.join(beremiz_dir, "locale")
   197     localedir = os.path.join(beremiz_dir, "locale")
   192     # Get the default language
   198     # Get the default language
   193     langid = wx.LANGUAGE_DEFAULT
   199     langid = wx.LANGUAGE_DEFAULT
   204         # Define location for searching translation files
   210         # Define location for searching translation files
   205     loc.AddCatalogLookupPathPrefix(localedir)
   211     loc.AddCatalogLookupPathPrefix(localedir)
   206     # Define locale domain
   212     # Define locale domain
   207     loc.AddCatalog(domain)
   213     loc.AddCatalog(domain)
   208 
   214 
   209     import locale
       
   210     global default_locale
   215     global default_locale
   211     default_locale = locale.getdefaultlocale()[1]
   216     default_locale = locale.getdefaultlocale()[1]
   212 
   217 
   213     # sys.stdout.encoding = default_locale
   218     # sys.stdout.encoding = default_locale
   214     # if Beremiz_service is started from Beremiz IDE
   219     # if Beremiz_service is started from Beremiz IDE