Skip to content

Commit

Permalink
[processing] fix i18n support
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 9, 2014
1 parent bb72302 commit 7a389f6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions python/plugins/processing/core/Processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def addProvider(provider, updateList=False):
Processing.updateAlgsList()
except:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Could not load provider: %s\n%s')
Processing.tr('Could not load provider: %s\n%s')
% (provider.getDescription(), unicode(sys.exc_info()[1])))
Processing.removeProvider(provider)

Expand Down Expand Up @@ -284,7 +284,7 @@ def runAlgorithm(algOrName, onFinish, *args):
print 'Error: Wrong parameter value %s for parameter %s.' \
% (value, name)
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Error in %s. Wrong parameter value %s for parameter %s.') \
Processing.tr('Error in %s. Wrong parameter value %s for parameter %s.') \
% (alg.name, value, name))
return
# fill any missing parameters with default values if allowed
Expand All @@ -293,7 +293,7 @@ def runAlgorithm(algOrName, onFinish, *args):
if not param.setValue(None):
print ('Error: Missing parameter value for parameter %s.' % (param.name))
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Error in %s. Missing parameter value for parameter %s.') \
Processing.tr('Error in %s. Missing parameter value for parameter %s.') \
% (alg.name, param.name))
return
else:
Expand Down Expand Up @@ -348,8 +348,9 @@ def runAlgorithm(algOrName, onFinish, *args):
progress.close()
return alg

def tr(self, string, context=''):
@staticmethod
def tr(string, context=''):
if context == '':
context = 'Processing'
return QtCore.QCoreApplication.translate(context, string)
return QCoreApplication.translate(context, string)

0 comments on commit 7a389f6

Please sign in to comment.