util/TranslationCatalogs.py
changeset 1813 c18adf359d21
parent 1806 6b4d0f4f2fbc
child 1838 646245c1c0d9
equal deleted inserted replaced
1812:8626a4948d5e 1813:c18adf359d21
    24 
    24 
    25 import os
    25 import os
    26 import __builtin__
    26 import __builtin__
    27 import wx
    27 import wx
    28 
    28 
    29 # Get the default language
    29 locale = None
    30 langid = wx.LANGUAGE_DEFAULT
       
    31 
       
    32 # Define locale for wx
       
    33 locale = wx.Locale(langid)
       
    34 
    30 
    35 
    31 
    36 __builtin__.__dict__['_'] = wx.GetTranslation
    32 __builtin__.__dict__['_'] = wx.GetTranslation
    37 
    33 
    38 
    34 
    51 
    47 
    52 def AddCatalog(locale_dir):
    48 def AddCatalog(locale_dir):
    53     if os.path.exists(locale_dir) and os.path.isdir(locale_dir):
    49     if os.path.exists(locale_dir) and os.path.isdir(locale_dir):
    54         domain = GetDomain(locale_dir)
    50         domain = GetDomain(locale_dir)
    55         if domain is not None:
    51         if domain is not None:
       
    52             global locale
       
    53             if locale is None:
       
    54                 # Define locale for wx
       
    55                 locale = wx.Locale(wx.LANGUAGE_DEFAULT)
       
    56 
    56             locale.AddCatalogLookupPathPrefix(locale_dir)
    57             locale.AddCatalogLookupPathPrefix(locale_dir)
    57             locale.AddCatalog(domain)
    58             locale.AddCatalog(domain)
    58 
    59 
    59 
    60 
    60 def NoTranslate(x):
    61 def NoTranslate(x):