[Zope3-checkins] CVS: Zope3/src/zope/app/browser/applicationcontrol - runtimeinfo.pt:1.3 runtimeinfo.py:1.3 server-control.pt:1.3 servercontrol.py:1.3

Godefroid Chapelle gotcha@swing.be
Tue, 8 Apr 2003 16:35:56 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/applicationcontrol
In directory cvs.zope.org:/tmp/cvs-serv4411

Modified Files:
	runtimeinfo.pt runtimeinfo.py server-control.pt 
	servercontrol.py 
Log Message:
- i18n

- small refactoring in case no adapter is found for IRuntimeInfo plus test



=== Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.pt 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.pt:1.2	Wed Dec 25 09:12:27 2002
+++ Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.pt	Tue Apr  8 16:35:25 2003
@@ -1,25 +1,25 @@
-<html metal:use-macro="views/standard_macros/page">
+<html metal:use-macro="views/standard_macros/page" i18n:domain="zope">
 <head>
-<title>Zope Runtime Information</title>
+<title i18n:translate="">Zope Runtime Information</title>
 </head>
 <body>
 <div metal:fill-slot="body">
 
 <ul tal:define="runtime_info view/runtimeInfo">
-   <li>Zope version: <span tal:replace="runtime_info/ZopeVersion" />
-   <li>Python version: <span tal:replace="runtime_info/PythonVersion" />
-   <li>System platform: <span tal:replace="runtime_info/SystemPlatform" />
-   <li>Command line: <span tal:replace="runtime_info/CommandLine" />
-   <li>Process id: <span tal:replace="runtime_info/ProcessId" />
-   <li>Uptime: <span tal:replace="runtime_info/Uptime" />
-   <li>Python path:</li>
+   <li><span i18n:translate="">Zope version: </span><span tal:replace="runtime_info/ZopeVersion" /></li>
+   <li><span i18n:translate="">Python version: </span><span tal:replace="runtime_info/PythonVersion" /></li>
+   <li><span i18n:translate="">System platform: </span><span tal:replace="runtime_info/SystemPlatform" /></li>
+   <li><span i18n:translate="">Command line: </span><span tal:replace="runtime_info/CommandLine" /></li>
+   <li><span i18n:translate="">Process id: </span><span tal:replace="runtime_info/ProcessId" /></li>
+   <li><span i18n:translate="">Uptime: </span><span tal:replace="runtime_info/Uptime" /></li>
+   <li><span i18n:translate="">Python path: </span></li>
       <ul>
         <li tal:repeat="path runtime_info/PythonPath" tal:content="path">path</li>
       </ul>
    <!-- # XXX UI folks: following line want's special attention. The hardcoding should
           be removed someday. -->
    <li tal:condition="runtime_info/Hint | nothing" style="color:red;"
-       tal:content="runtime_info/Hint" />
+       tal:content="runtime_info/Hint" i18n:translate="" />
 </ul>
 
 </div>


=== Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.py:1.2	Wed Dec 25 09:12:27 2002
+++ Zope3/src/zope/app/browser/applicationcontrol/runtimeinfo.py	Tue Apr  8 16:35:25 2003
@@ -30,6 +30,29 @@
 
         try:
             runtime_info = getAdapter(self.context, IRuntimeInfo)
+            formatted['ZopeVersion'] = runtime_info.getZopeVersion()
+            formatted['PythonVersion'] = runtime_info.getPythonVersion()
+            formatted['PythonPath'] = runtime_info.getPythonPath()
+            formatted['SystemPlatform'] = " ".join(runtime_info.getSystemPlatform())
+            formatted['CommandLine'] = " ".join(runtime_info.getCommandLine())
+            formatted['ProcessId'] = runtime_info.getProcessId()
+
+            # make a unix "uptime" uptime format
+            uptime = runtime_info.getUptime()
+            days = int(uptime / (60*60*24))
+            uptime = uptime - days * (60*60*24)
+
+            hours = int(uptime / (60*60))
+            uptime = uptime - hours * (60*60)
+
+            minutes = int(uptime / 60)
+            uptime = uptime - minutes * 60
+
+            seconds = uptime
+            # XXX Uptime still to be localized
+            formatted['Uptime'] = "%s%02d:%02d:%02d" % (
+                ((days or "") and "%d days, " % days), hours, minutes, seconds)
+
         except ComponentLookupError:
             # XXX We avoid having errors in the ApplicationController,
             # because all those things need to stay accessible.
@@ -40,29 +63,9 @@
             formatted['SystemPlatform'] = "N/A"
             formatted['CommandLine'] = "N/A"
             formatted['ProcessId'] = "N/A"
+            formatted['Uptime'] = "N/A"
             formatted['Hint'] = "Could not retrieve runtime information."
 
-        formatted['ZopeVersion'] = runtime_info.getZopeVersion()
-        formatted['PythonVersion'] = runtime_info.getPythonVersion()
-        formatted['PythonPath'] = runtime_info.getPythonPath()
-        formatted['SystemPlatform'] = " ".join(runtime_info.getSystemPlatform())
-        formatted['CommandLine'] = " ".join(runtime_info.getCommandLine())
-        formatted['ProcessId'] = runtime_info.getProcessId()
-
-        # make a unix "uptime" uptime format
-        uptime = runtime_info.getUptime()
-        days = int(uptime / (60*60*24))
-        uptime = uptime - days * (60*60*24)
-
-        hours = int(uptime / (60*60))
-        uptime = uptime - hours * (60*60)
-
-        minutes = int(uptime / 60)
-        uptime = uptime - minutes * 60
-
-        seconds = uptime
-        formatted['Uptime'] = "%s%02d:%02d:%02d" % (
-            ((days or "") and "%d days, " % days), hours, minutes, seconds)
 
         return formatted
 


=== Zope3/src/zope/app/browser/applicationcontrol/server-control.pt 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/applicationcontrol/server-control.pt:1.2	Wed Dec 25 09:12:27 2002
+++ Zope3/src/zope/app/browser/applicationcontrol/server-control.pt	Tue Apr  8 16:35:25 2003
@@ -1,13 +1,13 @@
-<html metal:use-macro="views/standard_macros/page">
+<html metal:use-macro="views/standard_macros/page" i18n:domain="zope">
 <head>
-<title>Zope Stub Server Controller</title>
+<title i18n:translate="">Zope Stub Server Controller</title>
 </head>
 <body>
 <div metal:fill-slot="body">
 
  <form name="servercontrol" action="ServerControl.html" method="post">
-  <input type="submit" name="restart" value="Restart server" /> <br />
-  <input type="submit" name="shutdown" value="Shutdown server" /> <br />
+  <input type="submit" name="restart" value="Restart server" i18n:attributes="value" /> <br />
+  <input type="submit" name="shutdown" value="Shutdown server" i18n:attributes="value" /> <br />
  </form>
  
 </div>


=== Zope3/src/zope/app/browser/applicationcontrol/servercontrol.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/browser/applicationcontrol/servercontrol.py:1.2	Wed Dec 25 09:12:27 2002
+++ Zope3/src/zope/app/browser/applicationcontrol/servercontrol.py	Tue Apr  8 16:35:25 2003
@@ -20,7 +20,9 @@
 from zope.app.interfaces.applicationcontrol.servercontrol \
      import IServerControl
 from zope.component import getUtility
+from zope.i18n.messageid import MessageIDFactory
 
+_ = MessageIDFactory("zope")
 
 class ServerControlView(BrowserView):
 
@@ -35,9 +37,9 @@
         """Do the shutdown/restart!"""
         if 'restart' in self.request:
             return (self.serverControl().restart()
-                    or "You restarted the server.")
+                    or _(u"You restarted the server."))
         elif 'shutdown' in self.request:
             return (self.serverControl().shutdown()
-                    or "You shut down the server.")
+                    or _("You shut down the server."))
 
     index = ViewPageTemplateFile('server-control.pt')