[Erp5-report] r19408 - in /erp5/trunk/bt5/erp5_forge: SkinTemplateItem/portal_skins/erp5_gl...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 19 17:40:45 CET 2008


Author: yusei
Date: Tue Feb 19 17:40:45 2008
New Revision: 19408

URL: http://svn.erp5.org?rev=19408&view=rev
Log:
Improve po file output.

Modified:
    erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml
    erp5/trunk/bt5/erp5_forge/bt/revision

Modified: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml?rev=19408&r1=19407&r2=19408&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml (original)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml Tue Feb 19 17:40:45 2008
@@ -66,9 +66,18 @@
         <item>
             <key> <string>_body</string> </key>
             <value> <string>MESSAGE_TEMPLATE = \'\'\'\\\n
-msgid "%(english)s"\n
-msgstr "%(translation)s"\n
+msgid %(english)s\n
+msgstr %(translation)s\n
 \'\'\'\n
+\n
+def format(string):\n
+  line_list = string.split(\'\\n\')\n
+  length = len(line_list)\n
+  if length==1:\n
+    return \'"%s"\' % string\n
+  else:\n
+    return \'\\n\'.join([\'""\']+[format(i) for i in line_list])\n
+\n
 \n
 catalog = context.portal_catalog\n
 \n
@@ -97,16 +106,16 @@
     if not english_title:\n
       raise ValueError, \'Title of corresponding English term to "%s" is empty.\' % translated_title\n
     if translated_title!=english_title:\n
-      print MESSAGE_TEMPLATE % {\'english\':english_title,\n
-                                \'translation\':translated_title}\n
+      print MESSAGE_TEMPLATE % {\'english\':format(english_title),\n
+                                \'translation\':format(translated_title)}\n
 \n
   if translated_description:\n
     if not english_description:\n
       raise ValueError, \'Description of corresponding English term to "%s" is empty.\' % translated_description\n
 \n
     if translated_description!=english_description:\n
-      print MESSAGE_TEMPLATE % {\'english\':english_description,\n
-                                \'translation\':translated_description}\n
+      print MESSAGE_TEMPLATE % {\'english\':format(english_description),\n
+                                \'translation\':format(translated_description)}\n
 \n
 context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \'text/plain;charset=utf-8\')\n
 \n
@@ -159,6 +168,7 @@
                             <string>_print_</string>
                             <string>_print</string>
                             <string>MESSAGE_TEMPLATE</string>
+                            <string>format</string>
                             <string>_getattr_</string>
                             <string>context</string>
                             <string>catalog</string>

Modified: erp5/trunk/bt5/erp5_forge/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/bt/revision?rev=19408&r1=19407&r2=19408&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/bt/revision (original)
+++ erp5/trunk/bt5/erp5_forge/bt/revision Tue Feb 19 17:40:45 2008
@@ -1,1 +1,1 @@
-204
+205




More information about the Erp5-report mailing list