diff options
author | kali <kali@leap.se> | 2013-01-09 04:20:15 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2013-01-09 04:20:15 +0900 |
commit | 93d5a8cd1ec55c725d5931d86989ea11ac2db844 (patch) | |
tree | 892e0e3b22c932de8fdf84efd1ce6fce822476cf /src/leap/util | |
parent | dc1466ea1384ea6263f3711b10f38365e0d727bc (diff) |
fix provider label translation
Diffstat (limited to 'src/leap/util')
-rw-r--r-- | src/leap/util/translations.py | 16 |
1 files changed, 8 insertions, 8 deletions
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 |