1
# Copyright (C) 2007 PreludeIDS Technologies. All Rights Reserved.
2
# Author: Yoann Vandoorselaere <yoann.v@prelude-ids.com>
4
# This file is part of the Prewikka program.
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2, or (at your option)
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; see the file COPYING. If not, write to
18
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20
import siteconfig, gettext, __builtin__
28
currentThread = lambda: "none"
31
_lock = threading.Lock()
32
currentThread = threading.currentThread
36
_localized_thread = { }
40
if _localized_thread.has_key(currentThread()):
41
return _localized_thread[currentThread()].gettext(s)
50
if not _all_locale.has_key(lang):
51
_all_locale[lang] = gettext.translation("prewikka", siteconfig.locale_dir, languages=[lang])
56
_localized_thread[currentThread()] = _all_locale[lang]
59
gettext.install("prewikka", siteconfig.locale_dir)
60
__builtin__._ = _safeGettext