Commit e741a110 authored by Fabien Morin's avatar Fabien Morin

change some tales expression to be more dynamic and by able to translate.

Translate composition title

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30291 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5596aec6
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value> <value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>if matrixbox == 1:\n <value> <string>if matrixbox == 1:\n
line = [(\'composition/\'+x.getId(),x.getTitleOrId())for x in context.getCompositionValueList()]\n line = [(\'composition/\'+x.getId(),x.getTranslatedTitle() or x.getTitleOrId())for x in context.getCompositionValueList()]\n
column = []\n column = []\n
tab = []\n tab = []\n
\n \n
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')].getCategoryChildCompactLogicalPathItemList(display_none_category=1,local_sort_id="compact_title",checked_permission=\'View\')</string> </value> <value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\', filter_node=1)</string> </value> <value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -267,18 +267,15 @@ ...@@ -267,18 +267,15 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="TALESMethod" module="Products.Formulator.TALESField"/>
<string>Products.Formulator.TALESField</string> <tuple/>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>here/portal_categories/visual_pattern/getCategoryChildLogicalPathItemList</string> </value> <value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildCompactLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -117,9 +117,7 @@ ...@@ -117,9 +117,7 @@
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -152,7 +150,7 @@ ...@@ -152,7 +150,7 @@
<item> <item>
<key> <string>items</string> </key> <key> <string>items</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -264,37 +262,15 @@ ...@@ -264,37 +262,15 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="TALESMethod" module="Products.Formulator.TALESField"/>
<string>Products.Formulator.TALESField</string> <tuple/>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/getCompositionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>here/portal_categories/composition/getCategoryChildLogicalPathItemList</string> </value> <value> <string>python: getattr(here.portal_categories[field.getId().replace(\'my_\', \'\', 1).replace(\'_list\', \'\')], preferences.getPreference(\'preferred_category_child_item_list_method_id\', \'getCategoryChildLogicalPathItemList\'))(local_sort_id=(\'int_index\', \'translated_title\'), checked_permission=\'View\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># this script is used to display a small text in the main form corresponding to the composition\n <value> <string># this script is used to display a small text in the main form corresponding to the composition\n
# it return something like "3.0 % Polyamide, 5.0 % Elasthanne"\n # it return something like "3.0 % Polyamide, 5.0 % Elasthanne"\n
translateString = context.Base_translateString\n
\n \n
title_list = []\n title_list = []\n
cell_list = []\n cell_list = []\n
...@@ -62,7 +63,7 @@ poly_list = context.ApparelFabric_asCellRange(matrixbox=1)[0]\n ...@@ -62,7 +63,7 @@ poly_list = context.ApparelFabric_asCellRange(matrixbox=1)[0]\n
for cat, title in poly_list:\n for cat, title in poly_list:\n
cell = context.getCell(cat, base_id=\'composition\')\n cell = context.getCell(cat, base_id=\'composition\')\n
if cell is not None:\n if cell is not None:\n
cell_list.append({\'quantity\':cell.getQuantity(), \'title\':title})\n cell_list.append({\'quantity\':cell.getQuantity(), \'title\':translateString(catalog=\'content\', msg=title)})\n
\n \n
# sort by quantity\n # sort by quantity\n
cell_list.sort(key=lambda x: x[\'quantity\'], reverse=True)\n cell_list.sort(key=lambda x: x[\'quantity\'], reverse=True)\n
...@@ -109,11 +110,12 @@ return final_text\n ...@@ -109,11 +110,12 @@ return final_text\n
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>_getattr_</string>
<string>context</string>
<string>translateString</string>
<string>title_list</string> <string>title_list</string>
<string>cell_list</string> <string>cell_list</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>poly_list</string> <string>poly_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>cat</string> <string>cat</string>
......
128 129
\ No newline at end of file \ No newline at end of file
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