From 8f57163c2a21e9ce5719ee5419cbefab220c8432 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Sun, 3 Jun 2012 18:34:56 +0200 Subject: [PATCH] [gen] Finalized pending i18n. --- bin/new.py | 2 +- gen/__init__.py | 2 +- gen/generator.py | 21 ++++++++++ gen/mixins/ToolMixin.py | 8 ++-- gen/mixins/__init__.py | 7 ++-- gen/po.py | 21 ++++++++++ gen/ui/import.pt | 16 ++++---- gen/ui/navigate.pt | 18 ++++----- gen/ui/page.pt | 34 ++++++++++------- gen/ui/pdf.png | Bin 228 -> 400 bytes gen/ui/result.pt | 74 ++++++++++++++++++------------------ gen/ui/search.pt | 6 +-- gen/ui/template.pt | 14 ++++--- gen/ui/widgets/date.pt | 6 +-- gen/ui/widgets/float.pt | 6 +-- gen/ui/widgets/integer.pt | 6 +-- gen/ui/widgets/pod.pt | 2 +- gen/ui/widgets/show.pt | 2 +- gen/ui/widgets/string.pt | 6 +-- gen/wrappers/UserWrapper.py | 10 ++--- 20 files changed, 156 insertions(+), 105 deletions(-) diff --git a/bin/new.py b/bin/new.py index 6453d7b..be03279 100644 --- a/bin/new.py +++ b/bin/new.py @@ -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, diff --git a/gen/__init__.py b/gen/__init__.py index 1f5a05a..71d9ca9 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -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: diff --git a/gen/generator.py b/gen/generator.py index 8a92fc4..f93ac6b 100644 --- a/gen/generator.py +++ b/gen/generator.py @@ -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(): diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index 7f3cee6..5526439 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -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) diff --git a/gen/mixins/__init__.py b/gen/mixins/__init__.py index a271685..e20ccd5 100644 --- a/gen/mixins/__init__.py +++ b/gen/mixins/__init__.py @@ -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. diff --git a/gen/po.py b/gen/po.py index b003c99..b7906da 100644 --- a/gen/po.py +++ b/gen/po.py @@ -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): diff --git a/gen/ui/import.pt b/gen/ui/import.pt index 6f34d2c..911eeda 100644 --- a/gen/ui/import.pt +++ b/gen/ui/import.pt @@ -60,20 +60,20 @@ -


+


- + @@ -89,8 +89,8 @@ - +
- + value python: _('query_import')"/> +
Button for importing several elements at once.


+ tal:attributes="value python: _('import_many')"/>

diff --git a/gen/ui/navigate.pt b/gen/ui/navigate.pt index 762482a..14e2c29 100644 --- a/gen/ui/navigate.pt +++ b/gen/ui/navigate.pt @@ -12,13 +12,13 @@ Go to the first page Go to the previous page Explain which elements are currently shown   @@ -31,7 +31,7 @@ Go to the last page @@ -65,15 +65,15 @@ Go to the source URL (search or referred object) + title python: backText + ' : ' + _('goto_source')"/> Go to the first page + title python: _('goto_first')"/> Go to the previous page + title python: _('goto_previous')"/> Explain which element is currently shown    // @@ -82,11 +82,11 @@ Go to the next page + title python: _('goto_next')"/> Go to the last page + title python: _('goto_last')"/> diff --git a/gen/ui/page.pt b/gen/ui/page.pt index c8d6aef..84ef7e9 100644 --- a/gen/ui/page.pt +++ b/gen/ui/page.pt @@ -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"> Table containing the history @@ -82,9 +83,9 @@ state event/review_state|nothing; isDataChange python: event['action'] == '_datachange_'" tal:attributes="class python:test(odd, 'even', 'odd')" valign="top"> - + + tal:content="python: _(contextObj.getWorkflowLabel(event['action']))"/> @@ -97,12 +98,12 @@ Display the previous values of the fields whose value were modified in this change. - - + + - + diff --git a/gen/ui/widgets/date.pt b/gen/ui/widgets/date.pt index 9380ac3..9e96131 100644 --- a/gen/ui/widgets/date.pt +++ b/gen/ui/widgets/date.pt @@ -78,7 +78,7 @@ Search macro for an Date. - +
@@ -261,29 +262,34 @@ + tal:attributes="src string:$appUrl/ui/previous.png; + title python: _('page_previous')"/> - + + tal:attributes="src string:$appUrl/ui/save.png; + title python: _('object_save')"/> + tal:attributes="src string:$appUrl/ui/cancel.png; + title python: _('object_cancel')"/> - @@ -297,12 +303,14 @@ + tal:attributes="src string:$appUrl/ui/next.png; + title python: _('page_next')"/> - + diff --git a/gen/ui/pdf.png b/gen/ui/pdf.png index c0e4b0ed13abd1021d521368947b66baba0d7923..304265c4495402c4fc306ae7a5779ab1f9ddb4c2 100644 GIT binary patch delta 355 zcmaFDIDxsoGr-TCmrII^fq{Y7)59eQNDF{42Q!e=(B%&XQjEnx?oJHr&dIz4aw-CR zLR`NGY5xEJ|2q(U2cqxqf$07BXYaq?d-nbs5Z!x!4uqbayY{SS?YZyOQQxbR-xn7@ zD=vPYo&7!A>w9+4`{d;B$xh#mqpY4qMSTx4d=?b+-AnVCm)CbM#b-`V&#bK88wxzr z)O@eW@Jvzho}}bG28L@43~!uL!Y7(p)Zbxa=F}H4KJ{A_=%f};7sn8Z%dO{b3pFW- zv?hkJmE1`!yEI4hF6;aMZMwWGch}|JkT+;H^jYTP#c-x8X`ZXyX3-NYbJmvroXT_j zTIKt>Gn^ymzLwtoefb%7 delta 181 zcmbQh{Djf0Gr-TCmrII^fq{Y7)59eQNJ{{*2op1qe05t?07!8L_=LDJFf`l+vKbhb zUgbGFag#;abxsjhO#;@AP#>VER zu$9T9(zLNs&?mvGDU)$RQfg~P0tYWckkT4O9R;lx!6U-05@HN$l8Q1bA{35 + 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:content="python: _('search_new')"> @@ -49,7 +50,7 @@ - @@ -69,16 +70,16 @@ Object type, shown if instances of several types are shownActions - + Results @@ -97,7 +98,7 @@ Workflow stateAny other field @@ -114,7 +115,7 @@ Column "Object type", shown if instances of several types are shown + tal:content="python: _(obj.portal_type)">Column "Actions"Delete the element @@ -147,10 +149,10 @@ - +
+ tal:content="python: _('search_new')">
diff --git a/gen/ui/search.pt b/gen/ui/search.pt index b73d101..00704d9 100644 --- a/gen/ui/search.pt +++ b/gen/ui/search.pt @@ -14,8 +14,8 @@ tal:attributes="src string:$appUrl/ui/$jsFile">Search title -

— -


+

— +


Form for searching objects of request/className. @@ -40,7 +40,7 @@ Submit button


- +

diff --git a/gen/ui/template.pt b/gen/ui/template.pt index 0b9f73f..6eee4e0 100644 --- a/gen/ui/template.pt +++ b/gen/ui/template.pt @@ -80,7 +80,7 @@

- +
@@ -112,12 +112,12 @@ - Login  +     - Password  +   + tal:define="label python: _('app_connect')" tal:attributes="value label; alt label;"/>


- + - +
+ tal:content="python: _(obj.getWorkflowLabel())"> @@ -125,13 +126,14 @@ - + -
@@ -126,7 +126,7 @@
- + @@ -135,9 +135,11 @@ title python: _('%sTool' % appName)"> + Additional icons can be added here by redefining icons.pt + + title python: _('app_logout')">
From
  - + @@ -119,7 +119,7 @@ yearToName python: '%s_to_year' % name"> -      +      - +
diff --git a/gen/ui/widgets/integer.pt b/gen/ui/widgets/integer.pt index fa67209..9ff09c8 100644 --- a/gen/ui/widgets/integer.pt +++ b/gen/ui/widgets/integer.pt @@ -20,13 +20,13 @@ Search macro for an Integer. -
   +
   - + - +
diff --git a/gen/ui/widgets/pod.pt b/gen/ui/widgets/pod.pt index ad281b1..6c11829 100644 --- a/gen/ui/widgets/pod.pt +++ b/gen/ui/widgets/pod.pt @@ -5,7 +5,7 @@ chekboxId python: '%s_%s' % (contextObj.UID(), name)"> + tal:content="python: _(doLabel)">
Search macro for a String. -
   +
   Show a simple search field for most String fields. - + -
+
The list of values