[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3687: Tweak the po2ts and ts2po output to be more kosher with msgm (in vidalia/trunk/src/tools: po2ts ts2po)



Author: edmanm
Date: 2009-04-10 20:56:44 -0400 (Fri, 10 Apr 2009)
New Revision: 3687

Modified:
   vidalia/trunk/src/tools/po2ts/po2ts.cpp
   vidalia/trunk/src/tools/ts2po/ts2po.cpp
Log:

Tweak the po2ts and ts2po output to be more kosher with msgmerge's handling
of newlines and long string splitting.


Modified: vidalia/trunk/src/tools/po2ts/po2ts.cpp
===================================================================
--- vidalia/trunk/src/tools/po2ts/po2ts.cpp	2009-04-11 00:34:46 UTC (rev 3686)
+++ vidalia/trunk/src/tools/po2ts/po2ts.cpp	2009-04-11 00:56:44 UTC (rev 3687)
@@ -112,7 +112,7 @@
 {
   QString out = msg.trimmed(); 
   
-  out.replace("\"\n\"", "\n");
+  out.replace("\"\n\"", "");
   if (out.startsWith("\""))
     out = out.remove(0, 1);
   if (out.endsWith("\""))

Modified: vidalia/trunk/src/tools/ts2po/ts2po.cpp
===================================================================
--- vidalia/trunk/src/tools/ts2po/ts2po.cpp	2009-04-11 00:34:46 UTC (rev 3686)
+++ vidalia/trunk/src/tools/ts2po/ts2po.cpp	2009-04-11 00:56:44 UTC (rev 3687)
@@ -104,17 +104,17 @@
                               "(line %1)").arg(msg.lineNumber());
       return -1;
     }
-    msgid = source.text();
+    msgid = source.text().trimmed();
     msgid.replace("\r", "");
     msgid.replace("\"", "\\\"");
-    msgid.replace("\n", "\"\n\"");
+    msgid.replace("\n", "\\n\"\n\"");
 
     /* Extract the <translation> tags */
     translation = msg.firstChildElement(TS_ELEMENT_TRANSLATION);
-    msgstr = translation.text();
+    msgstr = translation.text().trimmed();
     msgstr.replace("\r", "");
     msgstr.replace("\"", "\\\"");
-    msgstr.replace("\n", "\"\n\"");
+    msgstr.replace("\n", "\\n\"\n\"");
   
     /* Try to extract the <location> tags (optional) */
     location = msg.firstChildElement(TS_ELEMENT_LOCATION);