appy.gen: every field can now define a dict of i18n mappings that will be used for translating their label and/or description and/or help message(s).

This commit is contained in:
Gaetan Delannay 2011-03-04 10:30:45 +01:00
parent fd9dd569db
commit 66a02c453e
4 changed files with 85 additions and 36 deletions

View file

@ -120,9 +120,9 @@
maxReached python:(multiplicity[1] != None) and (len(objs) >= multiplicity[1]);
showPlusIcon python:not appyType['isBack'] and appyType['add'] and not maxReached and member.has_permission(addPermission, folder) and canWrite;
atMostOneRef python: (multiplicity[1] == 1) and (len(objs)<=1);
label python: tool.translate(appyType['labelId']);
label python: contextObj.translate('label', field=appyType['name']);
addConfirmMsg python: tool.translate('%s_addConfirm' % appyType['labelId']);
description python: tool.translate(appyType['descrId']);
description python: contextObj.translate('descr', field=appyType['name']);
navBaseCall python: 'askRefField(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, contextObj.absolute_url(), fieldName, innerRef)">
<tal:comment replace="nothing">This macro displays the Reference widget on a "consult" page.

View file

@ -186,17 +186,17 @@
<tal:label metal:define-macro="label" condition="widget/hasLabel">
<label tal:attributes="for widget/name"
tal:condition="python: not ((widget['type'] == 'Action') or ((widget['type'] == 'Ref') and (widget['add'])))"
tal:content="structure python: contextObj.translate(widget['labelId'])"></label>
tal:content="structure python: contextObj.translate('label', field=widget['name'])"></label>
</tal:label>
<tal:comment replace="nothing">Displays a field description.</tal:comment>
<tal:description metal:define-macro="description" condition="widget/hasDescr">
<span class="discreet" tal:content="structure python: contextObj.translate(widget['descrId'])"></span>
<span class="discreet" tal:content="structure python: contextObj.translate('descr', field=widget['name'])"></span>
</tal:description>
<tal:comment replace="nothing">Displays a field help.</tal:comment>
<tal:help metal:define-macro="help">
<acronym tal:attributes="title python: contextObj.translate(widget['helpId'])">
<acronym tal:attributes="title python: contextObj.translate('help', field=widget['name'])">
<img tal:attributes="src string: $portal_url/skyn/help.png"/>
</acronym>
</tal:help>