|
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 | |
|---|
| 21 | APP='gajim' |
|---|
| 22 | DIR='../po' |
|---|
| 23 | |
|---|
| 24 | import locale |
|---|
| 25 | import gettext |
|---|
| 26 | |
|---|
| 27 | locale.setlocale(locale.LC_ALL, '') |
|---|
| 28 | _translation = None |
|---|
| 29 | |
|---|
| 30 | def init(): |
|---|
| 31 | global _translation |
|---|
| 32 | try: |
|---|
| 33 | _translation = gettext.translation(APP, DIR) |
|---|
| 34 | except IOError: |
|---|
| 35 | _translation = gettext.NullTranslations() |
|---|
| 36 | |
|---|
| 37 | def _(s): |
|---|
| 38 | if s == '': |
|---|
| 39 | return s |
|---|
| 40 | assert s |
|---|
| 41 | return _translation.gettext(s) |
|---|