1 |
|
# Orca |
2 |
|
# |
3 |
|
# Copyright 2004-2006 Sun Microsystems Inc. |
4 |
|
# |
5 |
|
# This library is free software; you can redistribute it and/or |
6 |
|
# modify it under the terms of the GNU Library General Public |
7 |
|
# License as published by the Free Software Foundation; either |
8 |
|
# version 2 of the License, or (at your option) any later version. |
9 |
|
# |
10 |
|
# This library is distributed in the hope that it will be useful, |
11 |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 |
|
# Library General Public License for more details. |
14 |
|
# |
15 |
|
# You should have received a copy of the GNU Library General Public |
16 |
|
# License along with this library; if not, write to the |
17 |
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 |
|
# Boston, MA 02111-1307, USA. |
19 |
|
|
20 |
|
"""Provides i18n support for orca using the gettext module. Tells |
21 |
|
gettext where to find localized strings and creates an alias, _, that |
22 |
|
maps to the gettext.gettext function. This function will accept a |
23 |
|
string and return a localized string for that string. |
24 |
1 |
""" |
25 |
|
|
26 |
1 |
import os # to get localdir path |
27 |
1 |
import gettext # to get gettext (i18n) support |
28 |
|
|
29 |
|
# Alias gettext.gettext to _ and gettext.ngettext to ngettext |
30 |
|
# |
31 |
1 |
_ = gettext.gettext |
32 |
1 |
ngettext = gettext.ngettext |
33 |
|
|
34 |
|
# Tell gettext where to find localized strings. |
35 |
|
# |
36 |
1 |
localedir = os.path.join ("/usr/local", "share", "locale") |
37 |
1 |
gettext.bindtextdomain ("orca", localedir) |
38 |
1 |
gettext.textdomain("orca") |
39 |
|
|
40 |
1 |
import debug |
41 |
|
|
42 |
1 |
try: |
43 |
1 |
import gtk.glade |
44 |
|
|
45 |
1 |
gtk.glade.bindtextdomain ("orca", localedir) |
46 |
1 |
gtk.glade.textdomain("orca") |
47 |
0 |
except: |
48 |
0 |
debug.printException(debug.LEVEL_FINEST) |