From 8b08a4dea6e786425e563bd15ef7d13d588e7ff2 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Fri, 4 Dec 2009 16:03:08 -0800 Subject: [PATCH] qtutils: Do not re-translate strings This avoids calling QApplication.translate() on a string that has already been translated. Closes #34 Signed-off-by: David Aguilar --- cola/app.py | 2 +- cola/qtutils.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cola/app.py b/cola/app.py index 7ab0c3e9..c4658f60 100644 --- a/cola/app.py +++ b/cola/app.py @@ -52,7 +52,7 @@ class ColaApplication(object): """Supports @@noun/@@verb and context-less translation """ # We set the context to '' to properly handle .qm files - trtxt = unicode(self._translate_base('', str(txt))) + trtxt = unicode(self._translate_base('', txt)) if trtxt[-6:-4] == '@@': # handle @@verb / @@noun trtxt = trtxt[:-6] return trtxt diff --git a/cola/qtutils.py b/cola/qtutils.py index d4bb3879..56076495 100644 --- a/cola/qtutils.py +++ b/cola/qtutils.py @@ -204,6 +204,9 @@ def set_items(widget, items): def tr(txt): """Translate a string into a local language.""" + if type(txt) is QtCore.QString: + # This has already been translated; leave as-is + return unicode(txt) return unicode(QtGui.QApplication.instance().translate('', txt)) def icon_file(filename, staged=False, untracked=False): -- 2.11.4.GIT