comparison jabberbot/i18n.py @ 2640:af857f8c2e44

Import BotConfig in i18n module (makes testing easier...)
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Mon, 06 Aug 2007 03:45:12 +0200
parents c27ee67397f0
children 6f06c7d051a4
comparison
equal deleted inserted replaced
2639:117e1bee2444 2640:af857f8c2e44
4 4
5 @copyright: 2007 by Karol Nowak <grywacz@gmail.com> 5 @copyright: 2007 by Karol Nowak <grywacz@gmail.com>
6 @license: GNU GPL, see COPYING for details. 6 @license: GNU GPL, see COPYING for details.
7 """ 7 """
8 import logging, xmlrpclib 8 import logging, xmlrpclib
9 from jabberbot.config import BotConfig
9 10
10 TRANSLATIONS = None 11 TRANSLATIONS = None
11 12
12 13
13 def get_text(original, lang="en"): 14 def get_text(original, lang="en"):
18 if original == u"": 19 if original == u"":
19 return u"" 20 return u""
20 21
21 global TRANSLATIONS 22 global TRANSLATIONS
22 if not TRANSLATIONS: 23 if not TRANSLATIONS:
23 init_i18n() 24 init_i18n(BotConfig)
24 25
25 try: 26 try:
26 return TRANSLATIONS[lang][original] 27 return TRANSLATIONS[lang][original]
27 except KeyError: 28 except KeyError:
28 return original 29 return original