New port numbers
[electrum-nvc.git] / lib / i18n.py
1 #!/usr/bin/env python
2 #
3 # Electrum - lightweight Bitcoin client
4 # Copyright (C) 2012 thomasv@gitorious
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 import gettext, os
20
21 if os.path.exists('./locale'):
22     LOCALE_DIR = './locale'
23 else:
24     LOCALE_DIR = '/usr/share/locale'
25
26 language = gettext.translation('electrum', LOCALE_DIR, fallback = True)
27
28 def _(x):
29     global language
30     dic = [('Bitcoin', 'Novacoin'), ('bitcoin', 'novacoin')]
31     for b, l in dic:
32         x = x.replace(l, b)
33     t = language.ugettext(x)
34     for b, l in dic:
35         t = t.replace(b, l)
36     return t
37
38 def set_language(x):
39     global language
40     if x: language = gettext.translation('electrum', LOCALE_DIR, fallback = True, languages=[x])
41     
42     
43 languages = {
44     '':_('Default'),
45     'pt_PT':_('Portuguese'),
46     'pt_BR':_('Brasilian'),
47     'cs_CZ':_('Czech'),
48     'de_DE':_('German'),
49     'eo_UY':_('Esperanto'),
50     'en_UK':_('English'),
51     'es_ES':_('Spanish'),
52     'fr_FR':_('French'),
53     'it_IT':_('Italian'),
54     'ja_JP':_('Japanese'),
55     'lv_LV':_('Latvian'),
56     'nl_NL':_('Dutch'),
57     'ru_RU':_('Russian'),
58     'sl_SI':_('Slovenian'),
59     'ta_IN':_('Tamil'),
60     'vi_VN':_('Vietnamese'),
61     'zh_CN':_('Chinese')
62     }