root/branches/gajim_0.2-1/common/i18n.py

Revision 140, 0.9 kB (checked in by asterix, 5 years ago)

i18n support for internationalisation

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