[QGIS Commit] r9633 - trunk/qgis/src/python

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Nov 13 06:19:01 EST 2008


Author: wonder
Date: 2008-11-13 06:19:01 -0500 (Thu, 13 Nov 2008)
New Revision: 9633

Modified:
   trunk/qgis/src/python/qgspythonutilsimpl.cpp
Log:
Escape quotes in translations of strings passed into python code
(was a problem in french translation)


Modified: trunk/qgis/src/python/qgspythonutilsimpl.cpp
===================================================================
--- trunk/qgis/src/python/qgspythonutilsimpl.cpp	2008-11-13 01:29:51 UTC (rev 9632)
+++ trunk/qgis/src/python/qgspythonutilsimpl.cpp	2008-11-13 11:19:01 UTC (rev 9633)
@@ -87,17 +87,17 @@
   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(



More information about the QGIS-commit mailing list