root/branches/gajim_0.8/scripts/i18n.py

Revision 2444, 1.0 kB (checked in by dkirov, 3 years ago)

gettext support in gajim-remote needs i18n in
its path

Line 
1##      common/i18n.py
2##
3## Gajim Team:
4##  - Yann Le Boulanger <asterix@lagaule.org>
5##  - Vincent Hanquez <tab@snarc.org>
6##  - Nikos Kouremenos <kourem@gmail.com>
7##  - Dimitur Kirov <dkirov@gmail.com>
8##
9##      Copyright (C) 2003-2005 Gajim Team
10##
11## This program is free software; you can redistribute it and/or modify
12## it under the terms of the GNU General Public License as published
13## by the Free Software Foundation; version 2 only.
14##
15## This program is distributed in the hope that it will be useful,
16## but WITHOUT ANY WARRANTY; without even the implied warranty of
17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18## GNU General Public License for more details.
19##
20
21APP='gajim'
22DIR='../po'
23
24import locale
25import gettext
26
27locale.setlocale(locale.LC_ALL, '')
28_translation = None
29
30def init():
31        global _translation
32        try:
33                _translation = gettext.translation(APP, DIR)
34        except IOError:
35                _translation = gettext.NullTranslations()
36
37def _(s):
38        if s == '':
39                return s
40        assert s
41        return _translation.gettext(s)
Note: See TracBrowser for help on using the browser.