Commit 6c15d9e1 authored by Jérome Perrin's avatar Jérome Perrin

ods_style: simplify translations and unicode usage

Page templates have a builtin translation system (with i18n:) and an
"unicode conflict resolver", so it was not necessary to explicitly
convert to unicode on python2 and this simplifies the transition to
python3
parent 542977cf
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
table:style-name='report-column-title' table:style-name='report-column-title'
table:number-columns-spanned='1' table:number-columns-spanned='1'
office:value-type='string'> office:value-type='string'>
<text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value('title')).encode('utf-8')"> <text:p tal:content="python: field.get_value('title')" i18n:translate="">
</text:p> </text:p>
</table:table-cell> </table:table-cell>
</table:table-row> </table:table-row>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
table:style-name='report-column-title' table:style-name='report-column-title'
table:number-columns-spanned='1' table:number-columns-spanned='1'
office:value-type='string'> office:value-type='string'>
<text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value('title')).encode('utf-8')"> <text:p tal:content="python: field.get_value('title')" i18n:translate="">
</text:p> </text:p>
</table:table-cell> </table:table-cell>
</tal:block> </tal:block>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<tal:block metal:use-macro="here/style_macros/macros/style_macro"/> <tal:block metal:use-macro="here/style_macros/macros/style_macro"/>
<office:body> <office:body>
<office:spreadsheet> <office:spreadsheet>
<table:table table:style-name='ta1' table:print='false' tal:attributes="table:name python: unicode(here.getTitle(), 'utf-8')" i18n:attributes="table:name"> <table:table table:style-name='ta1' table:print='false' tal:attributes="table:name here/getTitle" i18n:attributes="table:name">
<!-- at least one table-column element is required for ODF to validate --> <!-- at least one table-column element is required for ODF to validate -->
<table:table-column <table:table-column
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<table:table-row table:style-name='ro2'> <table:table-row table:style-name='ro2'>
<table:table-cell table:style-name='report-column-title' <table:table-cell table:style-name='report-column-title'
office:value-type='string'> office:value-type='string'>
<text:p tal:content="python:here.Localizer.erp5_ui.gettext(field.get_value ('title')).encode('utf-8')"> <text:p tal:content="python: field.get_value('title')" i18n:translate="">
</text:p> </text:p>
</table:table-cell> </table:table-cell>
<tal:block tal:define="display python: field.get_value('image_display') " <tal:block tal:define="display python: field.get_value('image_display') "
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<tal:block tal:condition="python: is_report_tree_mode"> <tal:block tal:condition="python: is_report_tree_mode">
<table:table-cell table:style-name='report-column-title' table:number-columns-spanned='1' office:value-type='string' > <table:table-cell table:style-name='report-column-title' table:number-columns-spanned='1' office:value-type='string' >
<tal:block tal:condition="listboxline/getSectionName"> <tal:block tal:condition="listboxline/getSectionName">
<text:p tal:content="python: here.Localizer.erp5_ui.gettext(listboxline.getSectionName()).encode('utf-8')"/> <text:p tal:content="listboxline/getSectionName" i18n:translate=""/>
</tal:block> </tal:block>
</table:table-cell> </table:table-cell>
</tal:block> </tal:block>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</tal:block> </tal:block>
<tal:block tal:define="portal_object here/getPortalObject"> <tal:block tal:define="portal_object here/getPortalObject">
<tal:block tal:condition="not: sheet_per_report_section"> <tal:block tal:condition="not: sheet_per_report_section">
<table:table tal:attributes="table:name python:unicode(form.getProperty('title'), 'utf8')" i18n:attributes="table:name"> <table:table tal:attributes="table:name python: form.getProperty('title')" i18n:attributes="table:name">
<!-- at least one table-column element is required for ODF to validate --> <!-- at least one table-column element is required for ODF to validate -->
<table:table-column <table:table-column
table:style-name='co2' table:style-name='co2'
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
office:value-type='string' office:value-type='string'
table:number-columns-spanned='5' table:number-columns-spanned='5'
table:number-rows-spanned='1'> table:number-rows-spanned='1'>
<text:p i18n:translate="" tal:content="python: unicode(form.getProperty('title'), 'utf8')" ></text:p> <text:p i18n:translate="" tal:content="python: form.getProperty('title')" ></text:p>
</table:table-cell> </table:table-cell>
</table:table-row> </table:table-row>
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<tal:block tal:condition="rendered_report_item_list"> <tal:block tal:condition="rendered_report_item_list">
<tal:block tal:repeat="report_item report_item_list"> <tal:block tal:repeat="report_item report_item_list">
<!-- FIXME: in deferred mode + sheet_per_report_section we do not have title --> <!-- FIXME: in deferred mode + sheet_per_report_section we do not have title -->
<table:table tal:attributes="table:name python: unicode('Sheet%s' % repeat['report_item'].index, 'utf-8')"> <table:table tal:attributes="table:name python:'Sheet%s' % repeat['report_item'].index">
<table:table-column table:style-name="co4" table:default-cell-style-name="text"/> <table:table-column table:style-name="co4" table:default-cell-style-name="text"/>
<tal:block tal:replace="structure report_item"/> <tal:block tal:replace="structure report_item"/>
</table:table> </table:table>
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
<tal:block tal:condition="not: rendered_report_item_list"> <tal:block tal:condition="not: rendered_report_item_list">
<tal:block tal:repeat="report_item python: report_item_list"> <tal:block tal:repeat="report_item python: report_item_list">
<tal:block tal:condition="python: report_item.getFormId()"> <tal:block tal:condition="python: report_item.getFormId()">
<table:table tal:attributes="table:name python: unicode(report_item.getTitle() or 'Sheet%s' % repeat['report_item'].index, 'utf-8')"> <table:table tal:attributes="table:name python: report_item.getTitle() or 'Sheet%s' % repeat['report_item'].index">
<table:table-column table:style-name="co4" table:default-cell-style-name="text"/> <table:table-column table:style-name="co4" table:default-cell-style-name="text"/>
<tal:block metal:use-macro="here/report_view/macros/make_report_item_table"/> <tal:block metal:use-macro="here/report_view/macros/make_report_item_table"/>
</table:table> </table:table>
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<!-- include the report header as last page --> <!-- include the report header as last page -->
<table:table tal:condition="python: [field for field in form.get_fields() <table:table tal:condition="python: [field for field in form.get_fields()
if field.getRecursiveTemplateField().meta_type != 'ReportBox']" if field.getRecursiveTemplateField().meta_type != 'ReportBox']"
tal:attributes="table:name python:unicode(form.getProperty('title'), 'utf8')" i18n:attributes="table:name"> tal:attributes="table:name python:form.getProperty('title')" i18n:attributes="table:name">
<table:table-column <table:table-column
table:style-name='co2' table:style-name='co2'
table:number-columns-repeated='100' table:number-columns-repeated='100'
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
office:value-type='string' office:value-type='string'
table:number-columns-spanned='5' table:number-columns-spanned='5'
table:number-rows-spanned='1'> table:number-rows-spanned='1'>
<text:p i18n:translate="" tal:content="python: unicode(form.getProperty('title'), 'utf8')" ></text:p> <text:p i18n:translate="" tal:content="python:form.getProperty('title')" ></text:p>
</table:table-cell> </table:table-cell>
</table:table-row> </table:table-row>
<!-- fields from the report form itself --> <!-- fields from the report form itself -->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment