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 @@
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -54,7 +54,7 @@
<item>
<key> <string>_body</string> </key>
<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
tab = []\n
\n
......
......@@ -269,7 +269,7 @@
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -293,7 +293,7 @@
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -267,18 +267,15 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -117,9 +117,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -152,7 +150,7 @@
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
......@@ -264,37 +262,15 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<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/>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -55,6 +55,7 @@
<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
# it return something like "3.0 % Polyamide, 5.0 % Elasthanne"\n
translateString = context.Base_translateString\n
\n
title_list = []\n
cell_list = []\n
......@@ -62,7 +63,7 @@ poly_list = context.ApparelFabric_asCellRange(matrixbox=1)[0]\n
for cat, title in poly_list:\n
cell = context.getCell(cat, base_id=\'composition\')\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
# sort by quantity\n
cell_list.sort(key=lambda x: x[\'quantity\'], reverse=True)\n
......@@ -109,11 +110,12 @@ return final_text\n
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>_getattr_</string>
<string>context</string>
<string>translateString</string>
<string>title_list</string>
<string>cell_list</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>poly_list</string>
<string>_getiter_</string>
<string>cat</string>
......
128
\ No newline at end of file
129
\ 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