Skip to content

Commit 02474ba

Browse files
author
wonder
committedNov 13, 2008
Escape quotes in translations of strings passed into python code
(was a problem in french translation) git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9633 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a70da0e commit 02474ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/python/qgspythonutilsimpl.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@ void QgsPythonUtilsImpl::initPython( QgisInterface* interface )
8787
runString(
8888
"def qgis_except_hook_msg(type, value, tb, msg):\n"
8989
" lst = traceback.format_exception(type, value, tb)\n"
90-
" if msg == None: msg = '" + QObject::tr( "An error has occured while executing Python code:" ) + "'\n"
90+
" if msg == None: msg = '" + QObject::tr( "An error has occured while executing Python code:" ).replace("'", "\\'") + "'\n"
9191
" txt = '<font color=\"red\">'+msg+'</font><br><br>'\n"
9292
" for s in lst:\n"
9393
" txt += s\n"
94-
" txt += '<br>" + QObject::tr( "Python version:" ) + "<br>' + sys.version + '<br><br>'\n"
95-
" txt += '" + QObject::tr( "Python path:" ) + "' + str(sys.path)\n"
94+
" txt += '<br>" + QObject::tr( "Python version:" ).replace("'", "\\'") + "<br>' + sys.version + '<br><br>'\n"
95+
" txt += '" + QObject::tr( "Python path:" ).replace("'", "\\'") + "' + str(sys.path)\n"
9696
" txt = txt.replace('\\n', '<br>')\n"
9797
" txt = txt.replace(' ', '&nbsp; ')\n" // preserve whitespaces for nicer output
9898
" \n"
9999
" msg = QgsMessageOutput.createMessageOutput()\n"
100-
" msg.setTitle('" + QObject::tr( "Python error" ) + "')\n"
100+
" msg.setTitle('" + QObject::tr( "Python error" ).replace("'", "\\'") + "')\n"
101101
" msg.setMessage(txt, QgsMessageOutput.MessageHtml)\n"
102102
" msg.showMessage()\n" );
103103
runString(

0 commit comments

Comments
 (0)