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