ports/www/trac/files/patch-trac_util_translation.py
John Marino 521017b944 www/trac: Backport fix for upstream issue #11345
PR:		187133
Submitted by:	lorne (cons.org.nz)
2014-09-16 22:08:36 +00:00

32 lines
1.3 KiB
Python

Backported from fixes contained in http://trac.edgewall.org/ticket/11345
--- trac/util/translation.py.orig
+++ trac/util/translation.py
@@ -150,6 +150,6 @@
t = self._null_translations
else:
- t.add(Translations.load(locale_dir, locale or 'en_US',
- 'tracini'))
+ self._add(t, Translations.load(locale_dir, locale or 'en_US',
+ 'tracini'))
if env_path:
with self._plugin_domains_lock:
@@ -157,5 +157,6 @@
domains = domains.items()
for domain, dirname in domains:
- t.add(Translations.load(dirname, locale, domain))
+ self._add(t, Translations.load(dirname, locale,
+ domain))
self._current.translations = t
self._activate_failed = False
@@ -184,4 +185,10 @@
return self._current.translations is not None \
or self._activate_failed
+
+ # Internal methods
+
+ def _add(self, t, translations):
+ if isinstance(translations, Translations):
+ t.add(translations)
# Delegated methods