From 4114ef699d4f9fa009d5ee77eb56e9ae26ccbc3e Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 11 Aug 2008 20:14:37 +0530 Subject: [PATCH] Fix gettext invocation, and set text domain (fixes #7800) --- src/sugar/util.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sugar/util.py b/src/sugar/util.py index 2706b5d6..67653d91 100644 --- a/src/sugar/util.py +++ b/src/sugar/util.py @@ -22,7 +22,9 @@ import random import binascii import gettext -_ = gettext.gettext +_ = lambda msg: gettext.dgettext('sugar-toolkit', msg) +_ngettext = lambda msg1, msg2, n: gettext.dngettext('sugar-toolkit', msg1, msg2, n) + def printable_hash(in_hash): """Convert binary hash data into printable characters.""" @@ -228,8 +230,8 @@ def timestamp_to_elapsed_string(timestamp, max_levels=2): if levels > 0: time_period += COMMA - time_period += gettext.ngettext(name_singular, name_plural, - elapsed_units) % elapsed_units + time_period += _ngettext(name_singular, name_plural, + elapsed_units) % elapsed_units elapsed_seconds -= elapsed_units * factor