annotate jabberbot/i18n.py @ 2415:1007128cb089

Whitespace/pep8 fixes.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Tue, 17 Jul 2007 03:37:02 +0200
parents 61380308535d
children f456dc2048d1
rev   line source
2413
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
2 """
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
3 MoinMoin - jabber bot i18n routines
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
4
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
5 @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
7 """
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
8
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
9 translations = None
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
10
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
11 def getText(original, lang="en"):
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
12 global translations
2415
1007128cb089 Whitespace/pep8 fixes.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2413
diff changeset
13
2413
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
14 if not translations:
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
15 init_i18n()
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
16
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
17 try:
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
18 return translations[lang][original]
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
19 except KeyError:
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
20 return original
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
21
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
22 def init_i18n():
61380308535d Added a dummy _ function so that string for translations can be gathered.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents:
diff changeset
23 global translations
2415
1007128cb089 Whitespace/pep8 fixes.
Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
parents: 2413
diff changeset
24 translations = {'en': {}}