16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2000-2002 Free Software Foundation |
# Copyright 2000-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# GBaseApp.py |
# GBaseApp.py |
43 |
import locale |
import locale |
44 |
|
|
45 |
locale.setlocale(locale.LC_ALL, '') |
locale.setlocale(locale.LC_ALL, '') |
46 |
try: |
|
47 |
# gettext.install('gnue',GConfig.getInstalledBase('install_prefix')+'/translations') |
# Important for now _() to be defined here |
48 |
# no need for LC_ALL on win2k and XP with this variant |
import __builtin__ |
49 |
lang = [locale.getdefaultlocale()[0]] |
__builtin__.__dict__['_'] = lambda string:string |
|
gettext.translation('gnue',GConfig.getInstalledBase('install_prefix')+'/translations',languages=lang).install() |
|
|
except: |
|
|
# sys.stderr.write('Unable to load locale information falling back to default English language translations.\n') |
|
|
import __builtin__ |
|
|
__builtin__.__dict__['_'] = lambda string:string |
|
50 |
|
|
51 |
|
|
52 |
import GDebug |
import GDebug |
222 |
if not p in sys.path: |
if not p in sys.path: |
223 |
sys.path.append(p) |
sys.path.append(p) |
224 |
|
|
225 |
|
try: |
226 |
|
# gettext.install('gnue',GConfig.getInstalledBase('install_prefix')+'/translations') |
227 |
|
# no need for LC_ALL on win2k and XP with this variant |
228 |
|
lang = [locale.getdefaultlocale()[0]] |
229 |
|
global catalog, textEncoding |
230 |
|
catalog = gettext.translation('gnue',GConfig.getInstalledBase('install_prefix')+'/translations',languages=lang) |
231 |
|
catalog.install(unicode=1) |
232 |
|
textEncoding = gConfig('textEncoding') |
233 |
|
if not catalog.charset(): |
234 |
|
raise InvalidFormatError, "Translation file is badly formatted for unicode operation" |
235 |
|
|
236 |
|
def translate(msg): |
237 |
|
global catalog |
238 |
|
return catalog.ugettext(msg).encode(textEncoding) |
239 |
|
|
240 |
|
import __builtin__ |
241 |
|
__builtin__.__dict__['_'] = translate |
242 |
|
except: |
243 |
|
sys.stderr.write('Unable to load locale information falling back to default English language translations.\n') |
244 |
|
import __builtin__ |
245 |
|
__builtin__.__dict__['_'] = lambda string:string |
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
# Get the connection definitions |
# Get the connection definitions |
251 |
if connections != None: |
if connections != None: |
252 |
GDebug.printMesg(1,"Reusing connections instance") |
GDebug.printMesg(1,"Reusing connections instance") |