[Zope3-checkins] CVS: Zope3/src/zope/app/browser/services/utility -
__init__.py:1.8 configure.zcml:1.14 configureutility.pt:1.5
utilities.pt:1.14
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Aug 7 14:42:15 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/browser/services/utility
In directory cvs.zope.org:/tmp/cvs-serv26029/services/utility
Modified Files:
__init__.py configure.zcml configureutility.pt utilities.pt
Log Message:
Internationalized the rest of zope/app/browser.
I also took the chance to clean up some old code and remove a lot of cruft.
(This is the reason I decided to do it instead of letting a less
experienced developer do it.)
I now consider I18n of the Zope core done. What does this mean to you?
1. All code you check into the CVS must be internationalized. That means:
(a) Python and PT code must be properly tagged.
(b) zope.pot must be updated. This can be done with::
[zope/app/translation_files]$ python extract.py
Note: You do not need to merge the new POT file with the catalogs.
2. Any code snippet that has no I18n is considered a bug! Therefore, please
take care and do the I18n and make code so when you see missing spots.
Finally I would like to mention that some forms might experience some
hickups, as I changed and moved around a lot of templates and was not able
to verify them all by hand. Please let me know, if something that used to
work is not working anymore.
=== Zope3/src/zope/app/browser/services/utility/__init__.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/browser/services/utility/__init__.py:1.7 Wed Jul 2 13:52:41 2003
+++ Zope3/src/zope/app/browser/services/utility/__init__.py Thu Aug 7 13:41:39 2003
@@ -15,7 +15,6 @@
$Id$
"""
-
from zope.app.browser.component.interfacewidget import InterfaceWidget
from zope.app.browser.services.registration import AddComponentRegistration
from zope.app.form.widget import CustomWidget
@@ -26,7 +25,6 @@
from zope.app import zapi
from zope.interface import providedBy
from zope.proxy import removeAllProxies
-from zope.publisher.browser import BrowserView
class UtilityInterfaceWidget(InterfaceWidget):
@@ -55,11 +53,10 @@
This is a view on a local utility, configured by an <addform>
directive.
"""
-
interface_widget = CustomWidget(UtilityInterfaceWidget)
-class Utilities(BrowserView):
+class Utilities:
# self.context is the local utility service
@@ -74,7 +71,7 @@
doDelete = self.request.get("Delete")
if not selected:
if doActivate or doDeactivate or doDelete:
- return "Please select at least one checkbox"
+ return _("Please select at least one checkbox")
return None
folder = zapi.getParent(self.context)
todo = []
@@ -100,9 +97,11 @@
obj.status = ActiveStatus
done.append(obj.usageSummary())
if done:
- return "Activated: " + ", ".join(done)
+ s = _("Activated: ${activated_utilities}")
+ s.mapping = {'activated_utilities': ", ".join(done)}
+ return s
else:
- return "All of the checked utilities were already active"
+ return _("All of the checked utilities were already active")
def _deactivate(self, todo):
done = []
@@ -113,9 +112,11 @@
obj.status = RegisteredStatus
done.append(obj.usageSummary())
if done:
- return "Deactivated: " + ", ".join(done)
+ s = _("Deactivated: ${deactivated_utilities}")
+ s.mapping = {'deactivated_utilities': ", ".join(done)}
+ return s
else:
- return "None of the checked utilities were active"
+ return _("None of the checked utilities were active")
def _delete(self, todo):
errors = []
@@ -127,9 +128,10 @@
errors.append(obj.usageSummary())
continue
if errors:
- return ("Can't delete active utilit%s: %s; "
- "use the Deactivate button to deactivate" %
- (len(errors) != 1 and "ies" or "y", ", ".join(errors)))
+ s = _("Can't delete active utility/utilites: ${utility_names}; "
+ "use the Deactivate button to deactivate")
+ s.mapping = {'utility_names': ", ".join(errors)}
+ return s
# 1) Delete the registrations
services = {}
@@ -160,7 +162,9 @@
container = zapi.getAdapter(parent, IZopeContainer)
del container[name]
- return "Deleted: %s" % ", ".join(done)
+ s = _("Deleted: ${utility_names}")
+ s.mapping = {'utility_names': ", ".join(todo)}
+ return s
def getConfigs(self):
L = []
@@ -185,7 +189,7 @@
return [d for ifname, name, d in L]
-class ConfigureUtility(BrowserView):
+class ConfigureUtility:
def update(self):
folder = zapi.getParent(self.context)
iface = folder.resolve(self.request['interface'])
=== Zope3/src/zope/app/browser/services/utility/configure.zcml 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/services/utility/configure.zcml:1.13 Sun Aug 3 13:49:46 2003
+++ Zope3/src/zope/app/browser/services/utility/configure.zcml Thu Aug 7 13:41:39 2003
@@ -1,7 +1,4 @@
-<configure
- xmlns='http://namespaces.zope.org/browser'
- i18n_domain='zope'
- >
+<configure xmlns="http://namespaces.zope.org/browser">
<!-- Browser directives for the utility service -->
@@ -12,8 +9,7 @@
for="zope.app.interfaces.container.IAdding"
menu="add_service" title="Utility Service"
action="zope.app.services.UtilityService"
- permission="zope.ManageServices"
- />
+ permission="zope.ManageServices" />
<!-- ZMI tab named "Utilites" for the utility service -->
<page
@@ -22,8 +18,7 @@
name="utilities.html"
template="utilities.pt"
class=".Utilities"
- permission="zope.ManageServices"
- />
+ permission="zope.ManageServices" />
<!-- Browser directives for individual utility objects -->
@@ -42,8 +37,7 @@
name="configureutility.html"
template="configureutility.pt"
class=".ConfigureUtility"
- permission="zope.ManageServices"
- />
+ permission="zope.ManageServices" />
<!-- When creating a new utility object, you are taken to this
form to configure it. The form lets you choose a name,
@@ -59,8 +53,7 @@
content_factory="zope.app.services.utility.UtilityRegistration"
arguments="name interface componentPath"
set_after_add="status"
- fields="name interface componentPath permission status"
- />
+ fields="name interface componentPath permission status" />
<!-- When editing the registration of an existing utility object,
you are taken to this form. It is similar to the above add
@@ -72,7 +65,6 @@
name="index.html"
schema="zope.app.interfaces.services.utility.IUtilityRegistration"
permission="zope.ManageServices"
- fields="name interface componentPath permission status"
- />
+ fields="name interface componentPath permission status" />
</configure>
=== Zope3/src/zope/app/browser/services/utility/configureutility.pt 1.4 => 1.5 ===
--- Zope3/src/zope/app/browser/services/utility/configureutility.pt:1.4 Wed Jun 25 18:14:27 2003
+++ Zope3/src/zope/app/browser/services/utility/configureutility.pt Thu Aug 7 13:41:39 2003
@@ -1,44 +1,35 @@
<html metal:use-macro="context/@@standard_macros/page">
<body>
+<div metal:fill-slot="body">
-<div metal:fill-slot="body"
- i18n:domain="zope"
- >
-
-<h2 i18n:translate="" tal:condition="request/name">
- Utility registrations for interface
- <span tal:replace="request/interface" i18n:name="interface"/>
- with name
- <span tal:replace="request/name" i18n:name="utility_name" />
-</h2>
-<h2 i18n:translate="" tal:condition="not:request/name">
- Utility registrations for interface
- <span tal:replace="request/interface" i18n:name="interface"/>
-</h2>
-
-<form method="post"
- action="."
- tal:attributes="action request/URL"
- tal:define="form view/update"
- >
- <input type="hidden"
- name="interface"
- tal:attributes="value request/interface"
- />
- <input type="hidden"
- name="name"
- tal:attributes="value request/name"
- />
-
- <div tal:replace="structure form" />
-
- <input type="submit"
- name="submit_update"
- value="Update"
- i18n:attributes="value form_update"
- />
+ <h2 i18n:translate="" tal:condition="request/name">
+ Utility registrations for interface
+ <span tal:replace="request/interface" i18n:name="interface"/>
+ with name
+ <span tal:replace="request/name" i18n:name="utility_name" />
+ </h2>
-</form>
+ <h2 i18n:translate="" tal:condition="not:request/name">
+ Utility registrations for interface
+ <span tal:replace="request/interface" i18n:name="interface"/>
+ </h2>
+
+ <form action="." method="post"
+ tal:attributes="action request/URL"
+ tal:define="form view/update">
+
+ <input type="hidden" name="interface"
+ tal:attributes="value request/interface" />
+
+ <input type="hidden" name="name"
+ tal:attributes="value request/name" />
+
+ <div tal:replace="structure form" />
+
+ <input type="submit" name="submit_update" value="Update"
+ i18n:attributes="value update-button" />
+
+ </form>
</div>
</body>
=== Zope3/src/zope/app/browser/services/utility/utilities.pt 1.13 => 1.14 ===
--- Zope3/src/zope/app/browser/services/utility/utilities.pt:1.13 Wed Jul 2 13:55:03 2003
+++ Zope3/src/zope/app/browser/services/utility/utilities.pt Thu Aug 7 13:41:39 2003
@@ -1,57 +1,62 @@
<html metal:use-macro="context/@@standard_macros/page">
-
+<body>
<div metal:fill-slot="body"
- i18n:domain="zope"
- tal:define="message view/update; configs view/getConfigs"
- >
-
-<h2 i18n:translate="">Utilities registered in this utility service:</h2>
-
- <div class="message" tal:condition="message">
- <span tal:replace="message">view/update message here</span>
- <br /><br /><i><a href="">(click to clear message)</a></i>
- </div>
-
-<p tal:condition="not:configs">None</p>
-
-<form method="POST" action="utilities.html" tal:condition="configs">
-
- <table>
- <tr tal:repeat="config configs">
- <td><input type="checkbox" name="selected:list"
- tal:attributes=
- "value string:${config/name}:${config/interface}" />
- </td>
- <td>
- <a href="."
- tal:condition="config/url"
- tal:attributes=
- "href string:${config/url}/@@SelectedManagementView.html"
- tal:content="config/summary" />
- <span tal:condition="not:config/url"
- tal:replace="config/summary" />
- </td>
- <td>
- (<a href="."
- tal:attributes="href config/configurl"
- i18n:translate=""
- >change registration</a>)
- </td>
- </tr>
- </table>
-
- <input type="submit" name="Activate" value="Activate" />
- <input type="submit" name="Deactivate" value="Deactivate" />
-
- <input type="submit" name="Delete" value="Delete" />
-
- <input type="submit" name="Refresh" value="Refresh" />
+ tal:define="message view/update; configs view/getConfigs">
-</form>
+ <h2 i18n:translate="">Utilities registered in this utility service:</h2>
-<p><a href="../AddUtility">Add a utility to this utility
-service</a></p>
+ <div class="message" tal:condition="message">
+ <span tal:replace="message">view/update message here</span>
+ <br /><br />
+ <i><a href="" i18n:translate="">(click to clear message)</a></i>
+ </div>
+
+ <p tal:condition="not:configs">None</p>
+
+ <form method="POST" action="utilities.html" tal:condition="configs">
+
+ <table>
+ <tr tal:repeat="config configs">
+ <td><input type="checkbox" name="selected:list"
+ tal:attributes=
+ "value string:${config/name}:${config/interface}" />
+ </td>
+ <td>
+ <a href="."
+ tal:condition="config/url"
+ tal:attributes=
+ "href string:${config/url}/@@SelectedManagementView.html"
+ tal:content="config/summary" />
+ <span tal:condition="not:config/url"
+ tal:replace="config/summary" />
+ </td>
+ <td>
+ (<a href="."
+ tal:attributes="href config/configurl"
+ i18n:translate=""
+ >change registration</a>)
+ </td>
+ </tr>
+ </table>
+
+ <input type="submit" name="Activate" value="Activate"
+ i18n:attributes="value activate-button"/>
+ <input type="submit" name="Deactivate" value="Deactivate"
+ i18n:attributes="value deactivate-button"/>
+
+ <input type="submit" name="Delete" value="Delete"
+ i18n:attributes="value delete-button"/>
+
+ <input type="submit" name="Refresh" value="Refresh"
+ i18n:attributes="value refresh-button"/>
+
+ </form>
+
+ <p>
+ <a href="../AddUtility" i18n:translate="">
+ Add a utility to this utility service</a>
+ </p>
</div>
-
+</body>
</html>
More information about the Zope3-Checkins
mailing list