summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-01-09 04:20:15 +0900
committerkali <kali@leap.se>2013-01-09 04:20:15 +0900
commit93d5a8cd1ec55c725d5931d86989ea11ac2db844 (patch)
tree892e0e3b22c932de8fdf84efd1ce6fce822476cf /src/leap
parentdc1466ea1384ea6263f3711b10f38365e0d727bc (diff)
fix provider label translation
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/gui/firstrun/providerinfo.py6
-rw-r--r--src/leap/util/translations.py16
2 files changed, 13 insertions, 9 deletions
diff --git a/src/leap/gui/firstrun/providerinfo.py b/src/leap/gui/firstrun/providerinfo.py
index 248267ff..357378df 100644
--- a/src/leap/gui/firstrun/providerinfo.py
+++ b/src/leap/gui/firstrun/providerinfo.py
@@ -6,6 +6,7 @@ import logging
from PyQt4 import QtGui
from leap.gui.constants import APP_LOGO
+from leap.util.translations import translate
logger = logging.getLogger(__name__)
@@ -81,7 +82,10 @@ class ProviderInfoPage(QtGui.QWizardPage):
"<b>%s</b> https://%s" % (display_name, domain_name))
desc = pconfig.get('description')
- description_text = desc[lang] if desc else ''
+
+ #description_text = desc[lang] if desc else ''
+ description_text = translate(desc) if desc else ''
+
self.description.setText(
"<i>%s</i>" % description_text)
diff --git a/src/leap/util/translations.py b/src/leap/util/translations.py
index 14b8c020..80daa10d 100644
--- a/src/leap/util/translations.py
+++ b/src/leap/util/translations.py
@@ -17,7 +17,7 @@ I guess we could generate the xml for ourselves as a last recourse.
# XXX BIG NOTE:
# RESIST the temptation to get the translate function
# more compact, or have the Context argument passed as a variable
-# It HAS to be explicit due to how the pylupdate parser
+# Its name HAS to be explicit due to how the pylupdate parser
# works.
@@ -29,18 +29,19 @@ def translate(*args, **kwargs):
our magic function.
translate(Context, text, comment)
"""
- #print 'translating...'
+ if len(args) == 1:
+ obj = args[0]
+ if isinstance(obj, LEAPTranslatable) and hasattr(obj, 'tr'):
+ return obj.tr()
+
klsname = None
try:
# get class value from instance
# using live object inspection
prev_frame = inspect.stack()[1][0]
- self = inspect.getargvalues(prev_frame).locals.get('self')
+ locals_ = inspect.getargvalues(prev_frame).locals
+ self = locals_.get('self')
if self:
- # XXX will this work with QObject wrapper??
- if isinstance(LEAPTranslatable, self) and hasattr(self, 'tr'):
- print "we got a self in base class"
- return self.tr(*args)
# Trying to get the class name
# but this is useless, the parser
@@ -49,7 +50,6 @@ def translate(*args, **kwargs):
#print 'KLSNAME -- ', klsname
except:
logger.error('error getting stack frame')
- #print 'error getting stack frame'
if klsname:
nargs = (klsname,) + args