20 # |
20 # |
21 # You should have received a copy of the GNU General Public License |
21 # You should have received a copy of the GNU General Public License |
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 import os |
25 import os |
26 |
26 |
27 import wx |
27 import wx |
28 |
28 |
29 # Get the default language |
29 # Get the default language |
30 langid = wx.LANGUAGE_DEFAULT |
30 langid = wx.LANGUAGE_DEFAULT |
31 |
31 |
32 # Define locale for wx |
32 # Define locale for wx |
33 locale = wx.Locale(langid) |
33 locale = wx.Locale(langid) |
|
34 |
34 |
35 |
35 def GetDomain(path): |
36 def GetDomain(path): |
36 for name in os.listdir(path): |
37 for name in os.listdir(path): |
37 filepath = os.path.join(path, name) |
38 filepath = os.path.join(path, name) |
38 basename, fileext = os.path.splitext(name) |
39 basename, fileext = os.path.splitext(name) |
42 return result |
43 return result |
43 elif fileext == ".mo": |
44 elif fileext == ".mo": |
44 return basename |
45 return basename |
45 return None |
46 return None |
46 |
47 |
|
48 |
47 def AddCatalog(locale_dir): |
49 def AddCatalog(locale_dir): |
48 if os.path.exists(locale_dir) and os.path.isdir(locale_dir): |
50 if os.path.exists(locale_dir) and os.path.isdir(locale_dir): |
49 domain = GetDomain(locale_dir) |
51 domain = GetDomain(locale_dir) |
50 if domain is not None: |
52 if domain is not None: |
51 locale.AddCatalogLookupPathPrefix(locale_dir) |
53 locale.AddCatalogLookupPathPrefix(locale_dir) |
52 locale.AddCatalog(domain) |
54 locale.AddCatalog(domain) |
|
55 |
|
56 |
|
57 def NoTranslate(x): |
|
58 return x |