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 #from tools import call_log
39 #locale.setlocale = call_log(locale.setlocale)
40 #locale.getdefaultlocale = call_log(locale.getdefaultlocale)
43 'af_ZA': 'Afrikaans_South Africa',
44 'sq_AL': 'Albanian_Albania',
45 'ar_SA': 'Arabic_Saudi Arabia',
46 'eu_ES': 'Basque_Spain',
47 'be_BY': 'Belarusian_Belarus',
48 'bs_BA': 'Serbian (Latin)',
49 'bg_BG': 'Bulgarian_Bulgaria',
50 'ca_ES': 'Catalan_Spain',
51 'hr_HR': 'Croatian_Croatia',
52 'zh_CN': 'Chinese_China',
53 'zh_TW': 'Chinese_Taiwan',
54 'cs_CZ': 'Czech_Czech Republic',
55 'da_DK': 'Danish_Denmark',
56 'nl_NL': 'Dutch_Netherlands',
57 'et_EE': 'Estonian_Estonia',
58 'fa_IR': 'Farsi_Iran',
59 'ph_PH': 'Filipino_Philippines',
60 'fi_FI': 'Finnish_Finland',
61 'fr_FR': 'French_France',
62 'fr_BE': 'French_France',
63 'fr_CH': 'French_France',
64 'fr_CA': 'French_France',
65 'ga': 'Scottish Gaelic',
66 'gl_ES': 'Galician_Spain',
67 'ka_GE': 'Georgian_Georgia',
68 'de_DE': 'German_Germany',
69 'el_GR': 'Greek_Greece',
70 'gu': 'Gujarati_India',
71 'he_IL': 'Hebrew_Israel',
73 'hu': 'Hungarian_Hungary',
74 'is_IS': 'Icelandic_Iceland',
75 'id_ID': 'Indonesian_indonesia',
76 'it_IT': 'Italian_Italy',
77 'ja_JP': 'Japanese_Japan',
80 'ko_KR': 'Korean_Korea',
82 'lt_LT': 'Lithuanian_Lithuania',
83 'lat': 'Latvian_Latvia',
84 'ml_IN': 'Malayalam_India',
85 'id_ID': 'Indonesian_indonesia',
87 'mn': 'Cyrillic_Mongolian',
88 'no_NO': 'Norwegian_Norway',
89 'nn_NO': 'Norwegian-Nynorsk_Norway',
90 'pl': 'Polish_Poland',
91 'pt_PT': 'Portuguese_Portugal',
92 'pt_BR': 'Portuguese_Brazil',
93 'ro_RO': 'Romanian_Romania',
94 'ru_RU': 'Russian_Russia',
96 'sr_CS': 'Serbian (Cyrillic)_Serbia and Montenegro',
97 'sk_SK': 'Slovak_Slovakia',
98 'sl_SI': 'Slovenian_Slovenia',
99 'es_ES': 'Spanish_Spain',
100 'sv_SE': 'Swedish_Sweden',
101 'ta_IN': 'English_Australia',
102 'th_TH': 'Thai_Thailand',
104 'tr_TR': 'Turkish_Turkey',
105 'uk_UA': 'Ukrainian_Ukraine',
106 'vi_VN': 'Vietnamese_Viet Nam',
109 def setlang(lang
=None):
111 DIR
= os
.path
.join(os
.getcwd(), os
.path
.dirname(sys
.argv
[0]), 'share/locale')
112 if not os
.path
.isdir(DIR
):
113 DIR
= os
.path
.join(sys
.prefix
, 'share/locale')
114 if not os
.path
.isdir(DIR
):
115 gettext
.install(APP
, unicode=1)
118 lc
, encoding
= locale
.getdefaultlocale()
119 if encoding
== 'utf':
121 if encoding
== 'cp1252':
128 lang2
= _LOCALE2WIN32
.get(lang
, lang
)
129 os
.environ
['LANG'] = lang
130 elif os
.name
== 'mac':
133 lang_enc
= lang2
+ '.' + encoding
135 locale
.setlocale(locale
.LC_ALL
, lang_enc
)
137 logging
.getLogger('translate').warning(
138 _('Unable to set locale %s') % lang_enc
)
140 lang
= gettext
.translation(APP
, DIR
, languages
=[lang
], fallback
=True)
141 lang
.install(unicode=1)
145 os
.environ
['LANG'] = ''
146 locale
.setlocale(locale
.LC_ALL
, '')
148 logging
.getLogger('translate').warning('Unable to set locale !')
149 gettext
.bindtextdomain(APP
, DIR
)
150 gettext
.textdomain(APP
)
151 gettext
.install(APP
, unicode=1)
152 gtk
.glade
.bindtextdomain(APP
, DIR
)
154 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: