[gen] Finalized pending i18n.

This commit is contained in:
Gaetan Delannay 2012-06-03 18:34:56 +02:00
parent 2710fb6c39
commit 8f57163c2a
20 changed files with 156 additions and 105 deletions

View file

@ -191,7 +191,7 @@ class NewScript:
def patchPlone3x(self):
'''Auto-proclaimed ugly code in z3c forces us to patch some files
in Products.CMFPlone because these guys make the assumption that
"plone.xxx" packages are within eggs when they've implemented their
"plone.*" packages are within eggs when they've implemented their
ZCML directives "includePlugins" and "includePluginsOverrides".
So in this method, I remove every call to those directives in
CMFPlone files. It does not seem to affect Plone behaviour. Indeed,

View file

@ -2728,7 +2728,7 @@ class Transition:
sendNotification(obj.appy(), self, transitionName, wf)
# Return a message to the user if needed
if not doSay or (transitionName == '_init_'): return
if not msg: msg = 'Changes saved.' # XXX Translate
if not msg: msg = obj.translate('object_saved')
obj.say(msg)
class Permission:

View file

@ -445,6 +445,8 @@ class ZopeGenerator(Generator):
msg('bad_select_value', '', msg.BAD_SELECT_VALUE),
msg('select_delesect', '', msg.SELECT_DESELECT),
msg('no_elem_selected', '', msg.NO_SELECTION),
msg('object_edit', '', msg.EDIT),
msg('object_delete', '', msg.DELETE),
msg('delete_confirm', '', msg.DELETE_CONFIRM),
msg('delete_done', '', msg.DELETE_DONE),
msg('goto_first', '', msg.GOTO_FIRST),
@ -466,6 +468,25 @@ class ZopeGenerator(Generator):
msg('front_page_text', '', msg.FRONT_PAGE_TEXT),
msg('captcha_text', '', msg.CAPTCHA_TEXT),
msg('bad_captcha', '', msg.BAD_CAPTCHA),
msg('app_login', '', msg.LOGIN),
msg('app_connect', '', msg.CONNECT),
msg('app_logout', '', msg.LOGOUT),
msg('app_password', '', msg.PASSWORD),
msg('app_home', '', msg.HOME),
msg('login_reserved', '', msg.LOGIN_RESERVED),
msg('login_in_use', '', msg.LOGIN_IN_USE),
msg('login_ko', '', msg.LOGIN_KO),
msg('login_ok', '', msg.LOGIN_OK),
msg('password_too_short', '', msg.PASSWORD_TOO_SHORT),
msg('passwords_mismatch', '', msg.PASSWORDS_MISMATCH),
msg('object_save', '', msg.SAVE),
msg('object_saved', '', msg.SAVED),
msg('validation_error', '', msg.ERROR),
msg('object_cancel', '', msg.CANCEL),
msg('object_canceled', '', msg.CANCELED),
msg('enable_cookies', '', msg.ENABLE_COOKIES),
msg('page_previous', '', msg.PAGE_PREVIOUS),
msg('page_next', '', msg.PAGE_NEXT),
]
# Create a label for every role added by this application
for role in self.getAllUsedRoles():

View file

@ -876,7 +876,7 @@ class ToolMixin(BaseMixin):
urlBack = rq['HTTP_REFERER']
if jsEnabled and not cookiesEnabled:
msg = 'You must enable cookies before you can log in.' # XXX transl.
msg = self.translate('enable_cookies')
return self.goto(urlBack, msg)
# Perform the Zope-level authentication
login = rq.get('__ac_name', '')
@ -884,11 +884,11 @@ class ToolMixin(BaseMixin):
user = self.acl_users.validate(rq)
if self.userIsAnon():
rq.RESPONSE.expireCookie('__ac', path='/')
msg = 'Login failed.' # XXX to translate
msg = self.translate('login_ko')
logMsg = 'Authentication failed (tried with login "%s").' % login
else:
msg = 'Welcome! You are now logged in.' # XXX to translate
logMsg = 'User "%s" has been logged in.' % login
msg = self.translate('login_ok')
logMsg = 'User "%s" logged in.' % login
self.log(logMsg)
return self.goto(self.getApp().absolute_url(), msg)

View file

@ -202,7 +202,7 @@ class BaseMixin:
fields in the database.'''
rq = self.REQUEST
tool = self.getTool()
errorMessage = 'Please correct the indicated errors.' # XXX Translate
errorMessage = self.translate('validation_error')
isNew = rq.get('is_new') == 'True'
# If this object is created from an initiator, get info about him.
initiator, initiatorPage, initiatorField = self.getInitiatorInfo()
@ -217,7 +217,7 @@ class BaseMixin:
urlBack = tool.getSiteUrl()
else:
urlBack = self.getUrl()
self.say('Changes canceled.') # XXX Translate
self.say(self.translate('object_canceled'))
return self.goto(urlBack)
# Object for storing validation errors
@ -253,12 +253,11 @@ class BaseMixin:
obj, msg = self.createOrUpdate(isNew, values, initiator, initiatorField)
# Redirect the user to the appropriate page
if not msg: msg = 'Changes saved.' # XXX Translate
if not msg: msg = self.translate('object_saved')
# If the object has already been deleted (ie, it is a kind of transient
# object like a one-shot form and has already been deleted in method
# onEdit), redirect to the main site page.
if not getattr(obj.getParentNode().aq_base, obj.id, None):
obj.unindex()
return self.goto(tool.getSiteUrl(), msg)
# If the user can't access the object anymore, redirect him to the
# main site page.

View file

@ -92,6 +92,8 @@ class PoMessage:
EMAIL_BODY = 'You can consult this element at ${objectUrl}.'
SELECT_DESELECT = '(Un)select all'
NO_SELECTION = 'You must select at least one element.'
EDIT = 'Edit'
DELETE = 'Delete'
DELETE_CONFIRM = 'Are you sure you want to delete this element?'
DELETE_DONE = 'The element has been deleted.'
GOTO_FIRST = 'Go to top'
@ -115,6 +117,25 @@ class PoMessage:
'field besides, but without the character at position ' \
'${number}.'
BAD_CAPTCHA = 'The code was not correct. Please try again.'
LOGIN = 'Login'
CONNECT = 'Log in'
PASSWORD = 'Password'
LOGOUT = 'Logout'
HOME = 'Home'
LOGIN_RESERVED = 'This login is reserved.'
LOGIN_IN_USE = 'This login is already in use.'
LOGIN_OK = 'Welcome! You are now logged in.'
LOGIN_KO = 'Login failed.'
PASSWORD_TOO_SHORT = 'Passwords must contain at least ${nb} characters.'
PASSWORDS_MISMATCH = 'Passwords do not match.'
SAVE = 'Save'
SAVED = 'Changes saved.'
ERROR = 'Please correct the indicated errors.'
CANCEL = 'Cancel'
CANCELED = 'Changes canceled.'
ENABLE_COOKIES = 'You must enable cookies before you can log in.'
PAGE_PREVIOUS = 'Previous page'
PAGE_NEXT = 'Next page'
def __init__(self, id, msg, default, fuzzy=False, comments=[],
niceDefault=False):

View file

@ -60,20 +60,20 @@
<input type="hidden" name="importPath" value=""/>
</form>
<h1 tal:content="python: tool.translate('import_title')"></h1><br/>
<h1 tal:content="python: _('import_title')"></h1><br/>
<table class="list" width="100%">
<tr>
<th tal:repeat="columnHeader python: importElems[0]">
<img tal:condition="python: repeat['columnHeader'].number() == 1"
tal:attributes="src string:$appUrl/ui/eye.png;
title python: tool.translate('import_show_hide')"
title python: _('import_show_hide')"
style="cursor:pointer" onClick="toggleViewableElements()" align="left" />
<span tal:replace="columnHeader"/>
</th>
<th tal:content="python: tool.translate('ref_actions')"></th>
<th tal:content="python: _('ref_actions')"></th>
<th width="20px"><img
tal:attributes="src string: $appUrl/ui/select_elems.png;
title python: tool.translate('select_delesect')"
title python: _('select_delesect')"
onClick="toggleCheckboxes()" style="cursor:pointer"/>
</tr>
<tal:row repeat="row python: importElems[1]">
@ -89,8 +89,8 @@
<td>
<input type="button" tal:condition="not: alreadyImported"
tal:attributes="onClick python: 'importSingleElement(\'%s\')' % row[0];
value python: tool.translate('query_import')"/>
<span tal:condition="alreadyImported" tal:replace="python: tool.translate('import_already')"/>
value python: _('query_import')"/>
<span tal:condition="alreadyImported" tal:replace="python: _('import_already')"/>
</td>
<td align="center">
<input type="checkbox" checked="checked" id="cbElem" name="cbElem"
@ -98,13 +98,13 @@
</td>
</tr>
</tal:row>
<tr tal:condition="python: not importElems[1] or allAreImported"><td colspan="15" tal:content="python: tool.translate('query_no_result')"></td></tr>
<tr tal:condition="python: not importElems[1] or allAreImported"><td colspan="15" tal:content="python: _('query_no_result')"></td></tr>
</table>
<tal:comment replace="nothing">Button for importing several elements at once.</tal:comment>
<p align="right"><br/>
<input type="button" onClick="importManyElements()"
tal:condition="python: importElems[1] and not allAreImported"
tal:attributes="value python:tool.translate('import_many')"/>
tal:attributes="value python: _('import_many')"/>
</p>
</metal:fill>
</html>

View file

@ -12,13 +12,13 @@
<tal:comment replace="nothing">Go to the first page</tal:comment>
<td tal:condition="python: (startNumber != 0) and (startNumber != batchSize)"><img style="cursor:pointer"
tal:attributes="src string: $appUrl/ui/arrowLeftDouble.png;
title python: tool.translate('goto_first');
title python: _('goto_first');
onClick python: navBaseCall.replace('**v**', '0'+sortAndFilter)"/></td>
<tal:comment replace="nothing">Go to the previous page</tal:comment>
<td tal:define="sNumber python: startNumber - batchSize"
tal:condition="python: startNumber != 0"><img style="cursor:pointer"
tal:attributes="src string: $appUrl/ui/arrowLeftSimple.png;
title python: tool.translate('goto_previous');
title python: _('goto_previous');
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
<tal:comment replace="nothing">Explain which elements are currently shown</tal:comment>
<td class="discreet">&nbsp;
@ -31,7 +31,7 @@
<td tal:define="sNumber python: startNumber + batchSize"
tal:condition="python: sNumber &lt; totalNumber"><img style="cursor:pointer"
tal:attributes="src string: $appUrl/ui/arrowRightSimple.png;
title python: tool.translate('goto_next');
title python: _('goto_next');
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
<tal:comment replace="nothing">Go to the last page</tal:comment>
<td tal:define="lastPageIsIncomplete python: totalNumber % batchSize;
@ -40,7 +40,7 @@
sNumber python: (nbOfCountedPages*batchSize)"
tal:condition="python: (startNumber != sNumber) and (startNumber != sNumber-batchSize)"><img style="cursor:pointer"
tal:attributes="src string: $appUrl/ui/arrowRightDouble.png;
title python: tool.translate('goto_last');
title python: _('goto_last');
onClick python: navBaseCall.replace('**v**', str(sNumber)+sortAndFilter)"/></td>
</tr>
</table>
@ -65,15 +65,15 @@
<tal:comment replace="nothing">Go to the source URL (search or referred object)</tal:comment>
<td tal:condition="sourceUrl"><a tal:attributes="href sourceUrl"><img
tal:attributes="src string: $appUrl/ui/gotoSource.png;
title python: backText + ' : ' + tool.translate('goto_source')"/></a></td>
title python: backText + ' : ' + _('goto_source')"/></a></td>
<tal:comment replace="nothing">Go to the first page</tal:comment>
<td tal:condition="firstUrl"><a tal:attributes="href firstUrl"><img
tal:attributes="src string: $appUrl/ui/arrowLeftDouble.png;
title python: tool.translate('goto_first')"/></a></td>
title python: _('goto_first')"/></a></td>
<tal:comment replace="nothing">Go to the previous page</tal:comment>
<td tal:condition="previousUrl"><a tal:attributes="href previousUrl"><img
tal:attributes="src string: $appUrl/ui/arrowLeftSimple.png;
title python: tool.translate('goto_previous')"/></a></td>
title python: _('goto_previous')"/></a></td>
<tal:comment replace="nothing">Explain which element is currently shown</tal:comment>
<td class="discreet">&nbsp;
<span tal:replace="python: currentNumber"/>&nbsp;<b>//</b>
@ -82,11 +82,11 @@
<tal:comment replace="nothing">Go to the next page</tal:comment>
<td tal:condition="python: nextUrl"><a tal:attributes="href nextUrl"><img
tal:attributes="src string: $appUrl/ui/arrowRightSimple.png;
title python: tool.translate('goto_next')"/></a></td>
title python: _('goto_next')"/></a></td>
<tal:comment replace="nothing">Go to the last page</tal:comment>
<td tal:condition="lastUrl"><a tal:attributes="href lastUrl"><img
tal:attributes="src string: $appUrl/ui/arrowRightDouble.png;
title python: tool.translate('goto_last')"/></a></td>
title python: _('goto_last')"/></a></td>
</tr>
</table>
</div>

View file

@ -64,7 +64,8 @@
totalNumber historyInfo/totalNumber;
ajaxHookId python:'appyHistory';
navBaseCall python: 'askObjectHistory(\'%s\',\'%s\',%d,**v**)' % (ajaxHookId, contextObj.absolute_url(),batchSize);
tool contextObj/getTool">
tool contextObj/getTool;
_ python: tool.translate">
<tal:comment replace="nothing">Table containing the history</tal:comment>
<tal:history condition="objs">
@ -82,9 +83,9 @@
state event/review_state|nothing;
isDataChange python: event['action'] == '_datachange_'"
tal:attributes="class python:test(odd, 'even', 'odd')" valign="top">
<td tal:condition="isDataChange" tal:content="python: tool.translate('data_change')"></td>
<td tal:condition="isDataChange" tal:content="python: _('data_change')"></td>
<td tal:condition="not: isDataChange"
tal:content="python: tool.translate(contextObj.getWorkflowLabel(event['action']))"/>
tal:content="python: _(contextObj.getWorkflowLabel(event['action']))"/>
<td tal:define="actorid python:event.get('actor');" tal:content="actorid"/>
<td tal:content="event/time"/>
<td tal:condition="not: isDataChange">
@ -97,12 +98,12 @@
Display the previous values of the fields whose value were modified in this change.</tal:comment>
<table class="appyChanges" width="100%">
<tr>
<th align="left" width="30%" tal:content="python: tool.translate('modified_field')"></th>
<th align="left" width="70%" tal:content="python: tool.translate('previous_value')"></th>
<th align="left" width="30%" tal:content="python: _('modified_field')"></th>
<th align="left" width="70%" tal:content="python: _('previous_value')"></th>
</tr>
<tr tal:repeat="change event/changes/items" valign="top">
<tal:change define="appyType python:contextObj.getAppyType(change[0], asDict=True);">
<td tal:content="structure python: tool.translate(appyType['labelId'])"></td>
<td tal:content="structure python: _(appyType['labelId'])"></td>
<td tal:define="appyValue python: contextObj.getFormattedFieldValue(change[0], change[1][0]);
severalValues python: (appyType['multiplicity'][1] &gt; 1) or (appyType['multiplicity'][1] == None)">
<span tal:condition="not: severalValues" tal:replace="appyValue"></span>
@ -261,29 +262,34 @@
<tal:previous condition="python: previousPage and pageInfo['showPrevious']">
<tal:button condition="isEdit">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonPrevious"
title="Previous" tal:attributes="src string:$appUrl/ui/previous.png"/>
tal:attributes="src string:$appUrl/ui/previous.png;
title python: _('page_previous')"/>
<input type="hidden" name="previousPage" tal:attributes="value previousPage"/>
</tal:button>
<tal:link condition="not: isEdit">
<a tal:attributes="href python: contextObj.getUrl(page=previousPage)">
<img tal:attributes="src string:$appUrl/ui/previous.png" title="Previous"/>
<img tal:attributes="src string:$appUrl/ui/previous.png;
title python: _('page_previous')"/>
</a>
</tal:link>
</tal:previous>
<tal:save condition="python: isEdit and pageInfo['showSave']">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonOk"
title="Save" tal:attributes="src string:$appUrl/ui/save.png"/>
tal:attributes="src string:$appUrl/ui/save.png;
title python: _('object_save')"/>
</tal:save>
<tal:cancel condition="python: isEdit and pageInfo['showCancel']">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonCancel"
title="Cancel" tal:attributes="src string:$appUrl/ui/cancel.png"/>
tal:attributes="src string:$appUrl/ui/cancel.png;
title python: _('object_cancel')"/>
</tal:cancel>
<tal:edit condition="python: not isEdit and pageInfo['showOnEdit']">
<img title="Edit" style="cursor:pointer"
<img style="cursor:pointer"
tal:attributes="onClick python: 'href: window.location=\'%s\'' % contextObj.getUrl(mode='edit', page=page);
title python: _('object_edit');
src string: $appUrl/ui/editBig.png"
tal:condition="contextObj/mayEdit"/>
</tal:edit>
@ -297,12 +303,14 @@
<tal:next condition="python: nextPage and pageInfo['showNext']">
<tal:button condition="isEdit">
<input type="image" class="imageInput" style="cursor:pointer" name="buttonNext"
title="Next" tal:attributes="src string:$appUrl/ui/next.png"/>
tal:attributes="src string:$appUrl/ui/next.png;
title python: _('page_next')"/>
<input type="hidden" name="nextPage" tal:attributes="value nextPage"/>
</tal:button>
<tal:link condition="not: isEdit">
<a tal:attributes="href python: contextObj.getUrl(page=nextPage)">
<img tal:attributes="src string:$appUrl/ui/next.png" title="Next"/>
<img tal:attributes="src string:$appUrl/ui/next.png;
title python: _('page_next')"/>
</a>
</tal:link>
</tal:next>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 400 B

View file

@ -1,37 +1,38 @@
<metal:queryResults define-macro="queryResult"
tal:define="className request/className;
refInfo tool/getRefInfo;
refObject python: refInfo[0];
refField python: refInfo[1];
refUrlPart python: refObject and ('&ref=%s:%s' % (refObject.UID(), refField)) or '';
startNumber request/startNumber|python:'0';
startNumber python: int(startNumber);
searchName request/search;
labelId python: searchName and ('%s_search_%s' % (className, searchName)) or '';
labelId python: (searchName == '_advanced') and 'search_results' or labelId;
searchLabel python: labelId and tool.translate(labelId) or '';
severalTypes python: className and (className.find(',') != -1);
sortKey request/sortKey| python:'';
sortOrder request/sortOrder| python:'asc';
filterKey request/filterKey| python:'';
filterValue request/filterValue | python:'';
queryResult python: tool.executeQuery(className, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
objs queryResult/objects;
totalNumber queryResult/totalNumber;
batchSize queryResult/batchSize;
ajaxHookId python:'queryResult';
navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), className, searchName);
newSearchUrl python: '%s/ui/search?className=%s%s' % (tool.absolute_url(), className, refUrlPart)">
tal:define="_ python: tool.translate;
className request/className;
refInfo tool/getRefInfo;
refObject python: refInfo[0];
refField python: refInfo[1];
refUrlPart python: refObject and ('&ref=%s:%s' % (refObject.UID(), refField)) or '';
startNumber request/startNumber|python:'0';
startNumber python: int(startNumber);
searchName request/search;
labelId python: searchName and ('%s_search_%s' % (className, searchName)) or '';
labelId python: (searchName == '_advanced') and 'search_results' or labelId;
searchLabel python: labelId and _(labelId) or '';
severalTypes python: className and (className.find(',') != -1);
sortKey request/sortKey| python:'';
sortOrder request/sortOrder| python:'asc';
filterKey request/filterKey| python:'';
filterValue request/filterValue | python:'';
queryResult python: tool.executeQuery(className, searchName, startNumber, remember=True, sortBy=sortKey, sortOrder=sortOrder, filterKey=filterKey, filterValue=filterValue, refObject=refObject, refField=refField);
objs queryResult/objects;
totalNumber queryResult/totalNumber;
batchSize queryResult/batchSize;
ajaxHookId python:'queryResult';
navBaseCall python: 'askQueryResult(\'%s\',\'%s\',\'%s\',\'%s\',**v**)' % (ajaxHookId, tool.absolute_url(), className, searchName);
newSearchUrl python: '%s/ui/search?className=%s%s' % (tool.absolute_url(), className, refUrlPart)">
<tal:result condition="objs">
<fieldset>
<legend>
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, tool.translate(tool.getAppName()), tool.translate('%s_plural' % className)))"/>
<span tal:replace="structure python: test(searchName, searchLabel, test(severalTypes, _(tool.getAppName()), _('%s_plural' % className)))"/>
(<span tal:replace="totalNumber"/>)
<tal:newSearch condition="python: searchName == '_advanced'">
&nbsp;&mdash;&nbsp;<i><a tal:attributes="href newSearchUrl"
tal:content="python: tool.translate('search_new')"></a></i>
tal:content="python: _('search_new')"></a></i>
</tal:newSearch>
</legend>
@ -49,7 +50,7 @@
<table width="100%">
<tr>
<tal:descr condition="searchName">
<td tal:define="descr python: tool.translate('%s_descr' % labelId)"
<td tal:define="descr python: _('%s_descr' % labelId)"
tal:condition="descr/strip">
<span class="discreet" tal:content="descr"></span><br/><br/>
</td>
@ -69,16 +70,16 @@
<tal:header repeat="widget widgets">
<th tal:define="sortable python: tool.isSortable(widget['name'], className, 'search');
filterable widget/filterable|nothing;">
<span tal:replace="structure python: tool.truncateText(tool.translate(widget['labelId']))"/>
<span tal:replace="structure python: tool.truncateText(_(widget['labelId']))"/>
<metal:icons use-macro="context/ui/navigate/macros/sortAndFilter"/>
</th>
</tal:header>
<tal:comment replace="nothing">Object type, shown if instances of several types are shown</tal:comment>
<th tal:condition="severalTypes">
<span tal:replace="python: tool.translate('root_type')"></span>
<span tal:replace="python: _('root_type')"></span>
</th>
<tal:comment replace="nothing">Actions</tal:comment>
<th tal:content="python: tool.translate('ref_actions')"></th>
<th tal:content="python: _('ref_actions')"></th>
</tr>
<tal:comment replace="nothing">Results</tal:comment>
@ -97,7 +98,7 @@
<tal:comment replace="nothing">Workflow state</tal:comment>
<td id="field_workflow_state"
tal:condition="python: widget['name'] == 'state'"
tal:content="python: tool.translate(obj.getWorkflowLabel())">
tal:content="python: _(obj.getWorkflowLabel())">
</td>
<tal:comment replace="nothing">Any other field</tal:comment>
@ -114,7 +115,7 @@
<tal:comment replace="nothing">Column "Object type", shown if instances of several types are shown</tal:comment>
<td tal:condition="severalTypes" id="field_root_type"
tal:content="python: tool.translate(obj.portal_type)"></td>
tal:content="python: _(obj.portal_type)"></td>
<tal:comment replace="nothing">Column "Actions"</tal:comment>
<td align="right">
@ -125,13 +126,14 @@
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (className, searchName, repeat['obj'].number()+startNumber, totalNumber);"
tal:attributes="href python: obj.getUrl(mode='edit', page=obj.getDefaultEditPage(), nav=navInfo)"
tal:condition="obj/mayEdit">
<img title="Edit" tal:attributes="src string: $appUrl/ui/edit.gif"/>
<img tal:attributes="src string: $appUrl/ui/edit.gif;
title python: _('object_edit')"/>
</a></td>
<tal:comment replace="nothing">Delete the element</tal:comment>
<td>
<img tal:condition="obj/mayDelete"
title="Delete" style="cursor:pointer"
<img tal:condition="obj/mayDelete" style="cursor:pointer"
tal:attributes="src string: $appUrl/ui/delete.png;
title python: _('object_delete');
onClick python:'onDeleteObject(\'%s\')' % obj.UID()"/>
</td>
</tr>
@ -147,10 +149,10 @@
</tal:result>
<tal:noResult condition="not: objs">
<span tal:replace="python: tool.translate('query_no_result')"/>
<span tal:replace="python: _('query_no_result')"/>
<tal:newSearch condition="python: searchName == '_advanced'">
<br/><i class="discreet"><a tal:attributes="href newSearchUrl"
tal:content="python: tool.translate('search_new')"></a></i>
tal:content="python: _('search_new')"></a></i>
</tal:newSearch>
</tal:noResult>

View file

@ -14,8 +14,8 @@
tal:attributes="src string:$appUrl/ui/$jsFile"></script>
<tal:comment replace="nothing">Search title</tal:comment>
<h1><span tal:replace="python: tool.translate('%s_plural' % className)"/> —
<span tal:replace="python: tool.translate('search_title')"/></h1><br/>
<h1><span tal:replace="python: _('%s_plural' % className)"/> —
<span tal:replace="python: _('search_title')"/></h1><br/>
<tal:comment replace="nothing">Form for searching objects of request/className.</tal:comment>
<form name="search" tal:attributes="action python: tool.absolute_url()+'/do'" method="post">
@ -40,7 +40,7 @@
<tal:comment replace="nothing">Submit button</tal:comment>
<p align="right"><br/>
<input type="submit" tal:attributes="value python:tool.translate('search_button')"/>
<input type="submit" tal:attributes="value python: _('search_button')"/>
</p>
</form>
</metal:fill>

View file

@ -80,7 +80,7 @@
<input type="hidden" name="actionType"/>
<input type="hidden" name="action"/>
<div id="commentArea" align="left"><br/>
<span tal:content="python: tool.translate('workflow_comment')" class="discreet"></span>
<span tal:content="python: _('workflow_comment')" class="discreet"></span>
<textarea name="comment" cols="30" rows="3"></textarea>
<br/>
</div>
@ -112,12 +112,12 @@
<input type="hidden" name="login_name" id="login_name" value=""/>
<input type="hidden" name="pwd_empty" id="pwd_empty" value="0"/>
<span>Login</span>&nbsp;
<span tal:replace="python: _('app_login')"/>&nbsp;
<input type="text" size="25" name="__ac_name" id="__ac_name" value=""/>&nbsp;
<span>Password</span>&nbsp;
<span tal:replace="python: _('app_password')"/>&nbsp;
<input type="password" size="25" name="__ac_password" id="__ac_password"/>
<input type="submit" name="submit" onclick="setLoginVars()"
tal:define="label python: _('Login');" tal:attributes="value label; alt label;"/>
tal:define="label python: _('app_connect')" tal:attributes="value label; alt label;"/>
</form>
</td></tr>
</table>
@ -126,7 +126,7 @@
<tr>
<td>
<!-- Go home -->
<a tal:attributes="href appUrl; title python: _('home')">
<a tal:attributes="href appUrl; title python: _('app_home')">
<img tal:attributes="src string: $appUrl/ui/home.gif"/>
</a>
<!-- Config -->
@ -135,9 +135,11 @@
title python: _('%sTool' % appName)">
<img tal:attributes="src string:$appUrl/ui/appyConfig.gif"/>
</a>
<tal:comment replace="nothing">Additional icons can be added here by redefining icons.pt</tal:comment>
<metal:call use-macro="app/ui/icons/macros/icons"/>
<!-- Logout -->
<a tal:attributes="href python: tool.absolute_url() + '/performLogout';
title python: _('logout')">
title python: _('app_logout')">
<img tal:attributes="src string: $appUrl/ui/logout.gif"/>
</a>
</td>

View file

@ -78,7 +78,7 @@
<tal:comment replace="nothing">Search macro for an Date.</tal:comment>
<metal:search define-macro="search"
tal:define="years python:range(widget['startYear'], widget['endYear']+1)">
<label tal:content="python: tool.translate(widget['labelId'])"></label>
<label tal:content="python: _(widget['labelId'])"></label>
<table>
<tal:comment replace="nothing">From</tal:comment>
<tr tal:define="fromName python: '%s_from' % name;
@ -87,7 +87,7 @@
yearFromName python: '%s*date' % widgetName">
<td width="10px">&nbsp;</td>
<td>
<label tal:content="python: tool.translate('search_from')"></label>
<label tal:content="python: _('search_from')"></label>
</td>
<td>
@ -119,7 +119,7 @@
yearToName python: '%s_to_year' % name">
<td></td>
<td>
<label tal:content="python: tool.translate('search_to')"></label>&nbsp;&nbsp;&nbsp;&nbsp;
<label tal:content="python: _('search_to')"></label>&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<td height="20px;">
<select tal:attributes="id dayToName; name dayToName">

View file

@ -20,13 +20,13 @@
<tal:comment replace="nothing">Search macro for an Float.</tal:comment>
<metal:search define-macro="search"
tal:define="maxChars python: test(widget['maxChars'], widget['maxChars'], '')">
<label tal:content="python: tool.translate(widget['labelId'])"></label><br>&nbsp;&nbsp;
<label tal:content="python: _(widget['labelId'])"></label><br>&nbsp;&nbsp;
<tal:from define="fromName python: '%s*float' % widgetName">
<label tal:attributes="for fromName" tal:content="python: tool.translate('search_from')"></label>
<label tal:attributes="for fromName" tal:content="python: _('search_from')"></label>
<input type="text" tal:attributes="name fromName; maxlength maxChars" size="4"/>
</tal:from>
<tal:to define="toName python: '%s_to' % name">
<label tal:attributes="for toName" tal:content="python: tool.translate('search_to')"></label>
<label tal:attributes="for toName" tal:content="python: _('search_to')"></label>
<input type="text" tal:attributes="name toName; maxlength maxChars" size="4"/>
</tal:to><br/>
</metal:search>

View file

@ -20,13 +20,13 @@
<tal:comment replace="nothing">Search macro for an Integer.</tal:comment>
<metal:search define-macro="search"
tal:define="maxChars python: test(widget['maxChars'], widget['maxChars'], '')">
<label tal:content="python: tool.translate(widget['labelId'])"></label><br>&nbsp;&nbsp;
<label tal:content="python: _(widget['labelId'])"></label><br>&nbsp;&nbsp;
<tal:from define="fromName python: '%s*int' % widgetName">
<label tal:attributes="for fromName" tal:content="python: tool.translate('search_from')"></label>
<label tal:attributes="for fromName" tal:content="python: _('search_from')"></label>
<input type="text" tal:attributes="name fromName; maxlength maxChars" size="4"/>
</tal:from>
<tal:to define="toName python: '%s_to' % name">
<label tal:attributes="for toName" tal:content="python: tool.translate('search_to')"></label>
<label tal:attributes="for toName" tal:content="python: _('search_to')"></label>
<input type="text" tal:attributes="name toName; maxlength maxChars" size="4"/>
</tal:to><br/>
</metal:search>

View file

@ -5,7 +5,7 @@
chekboxId python: '%s_%s' % (contextObj.UID(), name)">
<input type="checkbox" tal:attributes="name doLabel; id chekboxId"/>
<label tal:attributes="for chekboxId" class="discreet"
tal:content="python: tool.translate(doLabel)"></label>
tal:content="python: _(doLabel)"></label>
</tal:askAction>
<img tal:repeat="podFormat python: tool.getPodInfo(contextObj, name)[1]"
tal:attributes="src string: $appUrl/ui/${podFormat}.png;

View file

@ -117,7 +117,7 @@
<td tal:attributes="style python:'background-image: url(%s/ui/tabBg.png)' % appUrl;
id tabId">
<a style="cursor:pointer"
tal:content="python: tool.translate('%s_col%d' % (widget['labelId'], repeat['widgetRow'].number()))"
tal:content="python: _('%s_col%d' % (widget['labelId'], repeat['widgetRow'].number()))"
tal:attributes="onClick python: 'showTab(\'%s_%d_%d\')' % (widget['name'], repeat['widgetRow'].number(), len(widget['widgets']))"></a>
</td>
<td><img tal:attributes="src string: $appUrl/ui/tabRight.png;

View file

@ -83,7 +83,7 @@
<tal:comment replace="nothing">Search macro for a String.</tal:comment>
<metal:search define-macro="search">
<label tal:attributes="for widgetName" tal:content="python: tool.translate(widget['labelId'])"></label><br>&nbsp;&nbsp;
<label tal:attributes="for widgetName" tal:content="python: _(widget['labelId'])"></label><br>&nbsp;&nbsp;
<tal:comment replace="nothing">Show a simple search field for most String fields.</tal:comment>
<tal:simpleSearch condition="not: widget/isSelect">
<input type="text" tal:define="maxChars python: test(widget['maxChars'], widget['maxChars'], '')"
@ -100,9 +100,9 @@
andName python: '%s_and' % operName;"
condition="python: widget['multiplicity'][1]!=1">
<input type="radio" tal:attributes="name operName; id orName" checked="checked" value="or"/>
<label tal:attributes="for orName" tal:content="python: tool.translate('search_or')"></label>
<label tal:attributes="for orName" tal:content="python: _('search_or')"></label>
<input type="radio" tal:attributes="name operName; id andName" value="and"/>
<label tal:attributes="for andName" tal:content="python: tool.translate('search_and')"></label><br/>
<label tal:attributes="for andName" tal:content="python: _('search_and')"></label><br/>
</tal:operator>
<tal:comment replace="nothing">The list of values</tal:comment>
<select tal:attributes="name widgetName; size widget/height" multiple="multiple">

View file

@ -28,19 +28,18 @@ class UserWrapper(AbstractWrapper):
def validateLogin(self, login):
'''Is this p_login valid?'''
# The login can't be the id of the whole site or "admin"
if login == 'admin':
return 'This username is reserved.' # XXX Translate
if login == 'admin': return self.translate('login_reserved')
# Check that no user or group already uses this login.
if self.count('User', noSecurity=True, login=login) or \
self.count('Group', noSecurity=True, login=login):
return 'This login is already in use.' # XXX Translate
self.translate('login_in_use')
return True
def validatePassword(self, password):
'''Is this p_password valid?'''
# Password must be at least 5 chars length
if len(password) < 5:
return 'Passwords must contain at least 5 letters.' # XXX Translate
return self.translate('password_too_short', mapping={'nb':5})
return True
def showPassword(self):
@ -84,8 +83,7 @@ class UserWrapper(AbstractWrapper):
page = self.request.get('page', 'main')
if page == 'main':
if hasattr(new, 'password1') and (new.password1 != new.password2):
# XXX Translate
msg = 'Passwords do not match.'
msg = self.translate('passwords_mismatch')
errors.password1 = msg
errors.password2 = msg
return self._callCustom('validate', new, errors)