1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
8 # WARNING: This program as such is intended to be used by professional
9 # programmers who take the whole responsability of assessing all potential
10 # consequences resulting from its eventual inadequacies and bugs
11 # End users who are looking for a ready-to-use solution with commercial
12 # garantees and support are strongly adviced to contract a Free Software
15 # This program is Free Software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License
17 # as published by the Free Software Foundation; either version 2
18 # of the License, or (at your option) any later version.
20 # This program is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 ##############################################################################
38 'af_ZA': 'Afrikaans_South Africa',
39 'sq_AL': 'Albanian_Albania',
40 'ar_SA': 'Arabic_Saudi Arabia',
41 'eu_ES': 'Basque_Spain',
42 'be_BY': 'Belarusian_Belarus',
43 'bs_BA': 'Serbian (Latin)',
44 'bg_BG': 'Bulgarian_Bulgaria',
45 'ca_ES': 'Catalan_Spain',
46 'hr_HR': 'Croatian_Croatia',
47 'zh_CN': 'Chinese_China',
48 'zh_TW': 'Chinese_Taiwan',
49 'cs_CZ': 'Czech_Czech Republic',
50 'da_DK': 'Danish_Denmark',
51 'nl_NL': 'Dutch_Netherlands',
52 'et_EE': 'Estonian_Estonia',
53 'fa_IR': 'Farsi_Iran',
54 'ph_PH': 'Filipino_Philippines',
55 'fi_FI': 'Finnish_Finland',
56 'fr_FR': 'French_France',
57 'fr_BE': 'French_France',
58 'fr_CH': 'French_France',
59 'fr_CA': 'French_France',
60 'ga': 'Scottish Gaelic',
61 'gl_ES': 'Galician_Spain',
62 'ka_GE': 'Georgian_Georgia',
63 'de_DE': 'German_Germany',
64 'el_GR': 'Greek_Greece',
65 'gu': 'Gujarati_India',
66 'he_IL': 'Hebrew_Israel',
68 'hu': 'Hungarian_Hungary',
69 'is_IS': 'Icelandic_Iceland',
70 'id_ID': 'Indonesian_indonesia',
71 'it_IT': 'Italian_Italy',
72 'ja_JP': 'Japanese_Japan',
75 'ko_KR': 'Korean_Korea',
77 'lt_LT': 'Lithuanian_Lithuania',
78 'lat': 'Latvian_Latvia',
79 'ml_IN': 'Malayalam_India',
80 'id_ID': 'Indonesian_indonesia',
82 'mn': 'Cyrillic_Mongolian',
83 'no_NO': 'Norwegian_Norway',
84 'nn_NO': 'Norwegian-Nynorsk_Norway',
85 'pl': 'Polish_Poland',
86 'pt_PT': 'Portuguese_Portugal',
87 'pt_BR': 'Portuguese_Brazil',
88 'ro_RO': 'Romanian_Romania',
89 'ru_RU': 'Russian_Russia',
91 'sr_CS': 'Serbian (Cyrillic)_Serbia and Montenegro',
92 'sk_SK': 'Slovak_Slovakia',
93 'sl_SI': 'Slovenian_Slovenia',
94 'es_ES': 'Spanish_Spain',
95 'sv_SE': 'Swedish_Sweden',
96 'ta_IN': 'English_Australia',
97 'th_TH': 'Thai_Thailand',
99 'tr_TR': 'Turkish_Turkey',
100 'uk_UA': 'Ukrainian_Ukraine',
101 'vi_VN': 'Vietnamese_Viet Nam',
104 def setlang(lang
=None):
106 DIR
= os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'share/locale')
107 if not os
.path
.isdir(DIR
):
108 DIR
= os
.path
.join(sys
.prefix
, 'share/locale')
109 if not os
.path
.isdir(DIR
):
110 gettext
.install(APP
, unicode=1)
114 lc
, encoding
= locale
.getdefaultlocale()
115 if encoding
== 'utf':
117 if encoding
== 'cp1252':
122 if os
.name
== 'nt' and lang
!= os
.environ
.get('LANG', ''):
123 os
.environ
['LANG'] = lang
124 if sys
.executable
== sys
.argv
[0]:
125 os
.execv(sys
.executable
, ['"'+sys
.executable
+'"'] + sys
.argv
[1:])
127 os
.execv(sys
.executable
, ['"'+sys
.executable
+'"'] + sys
.argv
)
128 os
.environ
['LANG'] = lang
131 locale
.setlocale(locale
.LC_ALL
, _LOCALE2WIN32
.get(lang
, lang
) + '.' + encoding
)
133 locale
.setlocale(locale
.LC_ALL
, lang
+'.'+encoding
)
136 lang
= gettext
.translation(APP
, DIR
, languages
=[lang
], fallback
=True)
137 lang
.install(unicode=1)
140 locale
.setlocale(locale
.LC_ALL
, '')
143 gettext
.bindtextdomain(APP
, DIR
)
144 gettext
.textdomain(APP
)
145 gettext
.install(APP
, unicode=1)
146 gtk
.glade
.bindtextdomain(APP
, DIR
)
148 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: