Skip to content

Commit

Permalink
Escape quotes in translations of strings passed into python code
Browse files Browse the repository at this point in the history
(was a problem in french translation)


git-svn-id: http://svn.osgeo.org/qgis/trunk@9633 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Nov 13, 2008
1 parent 72f2007 commit bf87209
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/python/qgspythonutilsimpl.cpp
Expand Up @@ -87,17 +87,17 @@ void QgsPythonUtilsImpl::initPython( QgisInterface* interface )
runString(
"def qgis_except_hook_msg(type, value, tb, msg):\n"
" lst = traceback.format_exception(type, value, tb)\n"
" if msg == None: msg = '" + QObject::tr( "An error has occured while executing Python code:" ) + "'\n"
" if msg == None: msg = '" + QObject::tr( "An error has occured while executing Python code:" ).replace("'", "\\'") + "'\n"
" txt = '<font color=\"red\">'+msg+'</font><br><br>'\n"
" for s in lst:\n"
" txt += s\n"
" txt += '<br>" + QObject::tr( "Python version:" ) + "<br>' + sys.version + '<br><br>'\n"
" txt += '" + QObject::tr( "Python path:" ) + "' + str(sys.path)\n"
" txt += '<br>" + QObject::tr( "Python version:" ).replace("'", "\\'") + "<br>' + sys.version + '<br><br>'\n"
" txt += '" + QObject::tr( "Python path:" ).replace("'", "\\'") + "' + str(sys.path)\n"
" txt = txt.replace('\\n', '<br>')\n"
" txt = txt.replace(' ', '&nbsp; ')\n" // preserve whitespaces for nicer output
" \n"
" msg = QgsMessageOutput.createMessageOutput()\n"
" msg.setTitle('" + QObject::tr( "Python error" ) + "')\n"
" msg.setTitle('" + QObject::tr( "Python error" ).replace("'", "\\'") + "')\n"
" msg.setMessage(txt, QgsMessageOutput.MessageHtml)\n"
" msg.showMessage()\n" );
runString(
Expand Down

0 comments on commit bf87209

Please sign in to comment.