Do lookup of QtCore.QCoreApplication.translate in function definition to save lookups at run time.

bzr-revno: 1514
This commit is contained in:
gerald.britton@gmail.com 2011-05-03 23:08:14 +01:00 committed by Jonathan Corwin
commit 643325ac73
1 changed files with 3 additions and 3 deletions

View File

@ -85,7 +85,8 @@ base_html_expands.append({u'desc': u'Underline', u'start tag': u'{u}',
u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True})
def translate(context, text, comment=None,
encoding=QtCore.QCoreApplication.CodecForTr, n=-1):
encoding=QtCore.QCoreApplication.CodecForTr, n=-1,
translate=QtCore.QCoreApplication.translate):
"""
A special shortcut method to wrap around the Qt4 translation functions.
This abstracts the translation procedure so that we can change it if at a
@ -102,8 +103,7 @@ def translate(context, text, comment=None,
An identifying string for when the same text is used in different roles
within the same context.
"""
return QtCore.QCoreApplication.translate(
context, text, comment, encoding, n)
return translate(context, text, comment, encoding, n)
def get_text_file_string(text_file):
"""