[gDesklets] gettext
- From: Jonathan MERCIER <bioinfornatics gmail com>
- To: gdesklets-list gnome org
- Subject: [gDesklets] gettext
- Date: Wed, 11 Mar 2009 12:00:13 +0100
hi!
i wantcreate a control for gettext someone can helpme please:
from libdesklets.controls import Control
from IGettext import IGettext
import gettext
class Gettext(Control, IGettext):
def __init__(self):
self.local_path = os.path.realpath(os.path.dirname(sys.argv[0]))
langs = []
lc, encoding = locale.getdefaultlocale()
if (lc):
langs = [lc]
language = os.environ.get('LANGUAGE', None)
if (language):
langs += language.split(":")
langs += ["en_US", "fr_FR"]
gettext.bindtextdomain(APP_NAME, self.local_path)
gettext.textdomain(APP_NAME)
self.lang = gettext.translation(APP_NAME, self.local_path,
languages=langs, fallback = True)
self.__tr = self.lang.gettext
Control.__init__(self)
tr = property(__get_tr, __set_tr, doc = "Traduct the text to
local language.\nuse, tr(\"text to translate\")")
def get_class(): return Gettext
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]