From f8e4fa9d38de090d10669c6834d08c3aa18fd492 Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Tue, 19 Feb 2008 16:40:45 +0000 Subject: [PATCH] Improve po file output. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19408 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../GlossaryModule_getPOFile.xml | 22 ++++++++++++++----- bt5/erp5_forge/bt/revision | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml index 545bd4870f..551f8f71fa 100644 --- a/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml +++ b/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_glossary/GlossaryModule_getPOFile.xml @@ -66,10 +66,19 @@ <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 for i in catalog(portal_type=\'Glossary Term\',\n @@ -97,16 +106,16 @@ for i in catalog(portal_type=\'Glossary Term\',\n 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 @@ return printed\n <string>_print_</string> <string>_print</string> <string>MESSAGE_TEMPLATE</string> + <string>format</string> <string>_getattr_</string> <string>context</string> <string>catalog</string> diff --git a/bt5/erp5_forge/bt/revision b/bt5/erp5_forge/bt/revision index cbd6012bc6..e0d1ea1e9a 100644 --- a/bt5/erp5_forge/bt/revision +++ b/bt5/erp5_forge/bt/revision @@ -1 +1 @@ -204 \ No newline at end of file +205 \ No newline at end of file -- 2.30.9