Minor optimization in translate function: Save redundant lookups

This commit is contained in:
Gerald Britton 2011-05-03 13:36:20 -04:00
parent 8643f4b317
commit 37a68a4b87

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):
"""