1 |
bh |
918 |
# Copyright (c) 2001, 2002, 2003 by Intevation GmbH |
2 |
bh |
6 |
# Authors: |
3 |
|
|
# Bernhard Herzog <[email protected]> |
4 |
|
|
# |
5 |
|
|
# This program is free software under the GPL (>=v2) |
6 |
|
|
# Read the file COPYING coming with Thuban for details. |
7 |
bh |
230 |
|
8 |
bh |
1871 |
|
9 |
|
|
_locale = None |
10 |
|
|
def install_wx_translation(): |
11 |
|
|
"""Install the wx translation function in Thuban. |
12 |
|
|
|
13 |
|
|
For more information about translations in Thuban see the comment in |
14 |
|
|
Thuban/__init__.py |
15 |
|
|
""" |
16 |
|
|
global _locale |
17 |
|
|
import Thuban |
18 |
|
|
if not Thuban.translation_function_installed(): |
19 |
|
|
# Only import wx modules when we actually can install the |
20 |
|
|
# function so that the test suite can inhibit this |
21 |
|
|
import wxPython.wx as wx |
22 |
|
|
wx.wxLocale_AddCatalogLookupPathPrefix(Thuban._message_dir) |
23 |
|
|
_locale = wx.wxLocale() |
24 |
|
|
_locale.AddCatalog("thuban") |
25 |
|
|
Thuban.install_translation_function(wx.wxGetTranslation) |
26 |
|
|
|
27 |
|
|
# Reset the python locale. This makes sure that the LC_NUMERIC |
28 |
|
|
# seen by the python interpreter and by C modules is "C" instead |
29 |
|
|
# of the user's locale. Python code will still see the user's |
30 |
|
|
# locale where it matters. Without this, drawing the map doesn't |
31 |
|
|
# work for some reason |
32 |
|
|
import locale |
33 |
|
|
locale.setlocale(locale.LC_NUMERIC, "") |
34 |
|
|
|
35 |
|
|
install_wx_translation() |