[Pkg-sugar-commit] [sugar-toolkit] 03/12: Do not break if the string contains no conversion specifier #10372
Jonas Smedegaard
dr at jones.dk
Thu Apr 16 18:50:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.84.13-1
in repository sugar-toolkit.
commit 2bb16e651e80d6caa0bbcf90608b1cd53e5809f1
Author: Simon Schampijer <simon at schampijer.de>
Date: Wed Oct 6 09:16:47 2010 +0200
Do not break if the string contains no conversion specifier #10372
Upstream ticket SL #2354
---
src/sugar/util.py | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/sugar/util.py b/src/sugar/util.py
index e027734..9f96553 100644
--- a/src/sugar/util.py
+++ b/src/sugar/util.py
@@ -245,10 +245,17 @@ def timestamp_to_elapsed_string(timestamp, max_levels=2):
if key in _i18n_timestamps_cache:
time_period += _i18n_timestamps_cache[key]
else:
- translation = gettext.dngettext('sugar-toolkit',
- name_singular,
- name_plural,
- elapsed_units) % elapsed_units
+ tmp = gettext.dngettext('sugar-toolkit',
+ name_singular,
+ name_plural,
+ elapsed_units)
+ # FIXME: This is a hack so we don't crash when a translation
+ # doesn't contain the expected number of placeholders (#2354)
+ try:
+ translation = tmp % elapsed_units
+ except TypeError:
+ translation = tmp
+
_i18n_timestamps_cache[key] = translation
time_period += translation
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-toolkit.git
More information about the pkg-sugar-commit
mailing list