From 30fa8f14957886e7f9ca949750d0e5e1cb2db98d Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 30 Nov 2001 00:06:29 +0000 Subject: [PATCH] Converted roundup/cgi_client.py to use _() Added the status file, I18N_PROGRESS.txt git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@434 57a73879-2fb5-44c3-a270-3262357dd7e2 --- I18N_PROGRESS.txt | 105 +++++++++++++++++++++++++++++++ roundup/cgi_client.py | 141 ++++++++++++++++++++++-------------------- 2 files changed, 179 insertions(+), 67 deletions(-) create mode 100644 I18N_PROGRESS.txt diff --git a/I18N_PROGRESS.txt b/I18N_PROGRESS.txt new file mode 100644 index 0000000..212f2b5 --- /dev/null +++ b/I18N_PROGRESS.txt @@ -0,0 +1,105 @@ +This list has been generated using the MANIFEST file. We should be able to +write a simple script to compare the two and make sure that all MANIFEST +files appear in here. + + +THESE FILES DO NOT USE _() +========================== +roundup-admin +roundup-mailgw +roundup-server +cgi-bin/roundup.cgi +roundup/__init__.py +roundup/cgitb.py +roundup/date.py +roundup/htmltemplate.py +roundup/hyperdb.py +roundup/i18n.py +roundup/init.py +roundup/install_util.py +roundup/instance.py +roundup/mailgw.py +roundup/password.py +roundup/roundupdb.py +roundup/templatebuilder.py +roundup/backends/__init__.py +roundup/backends/back_anydbm.py +roundup/backends/back_bsddb.py +roundup/backends/back_bsddb3.py +roundup/templates/__init__.py +roundup/templates/classic/__init__.py +roundup/templates/classic/dbinit.py +roundup/templates/classic/htmlbase.py +roundup/templates/classic/instance_config.py +roundup/templates/classic/interfaces.py +roundup/templates/classic/detectors/__init__.py +roundup/templates/classic/detectors/nosyreaction.py +roundup/templates/extended/__init__.py +roundup/templates/extended/dbinit.py +roundup/templates/extended/htmlbase.py +roundup/templates/extended/instance_config.py +roundup/templates/extended/interfaces.py +roundup/templates/extended/detectors/__init__.py +roundup/templates/extended/detectors/nosyreaction.py + + +THESE FILES DO USE _() +====================== +roundup/cgi_client.py + + +WE DON'T CARE ABOUT THESE FILES +=============================== +BUILD.txt +CHANGES.txt +INSTALL.txt +MIGRATION.txt +README.txt +setup.py +doc/implementation.txt +doc/index.html +doc/overview.html +doc/spec.html +doc/images/edit.png +doc/images/hyperdb.png +doc/images/logo-acl-medium.png +doc/images/logo-codesourcery-medium.png +doc/images/logo-software-carpentry-standard.png +doc/images/roundup-1.png +doc/images/roundup.png +roundup/templates/classic/html/file.index +roundup/templates/classic/html/file.newitem +roundup/templates/classic/html/issue.filter +roundup/templates/classic/html/issue.index +roundup/templates/classic/html/issue.item +roundup/templates/classic/html/msg.index +roundup/templates/classic/html/msg.item +roundup/templates/classic/html/style.css +roundup/templates/classic/html/user.index +roundup/templates/classic/html/user.item +roundup/templates/extended/html/file.index +roundup/templates/extended/html/file.newitem +roundup/templates/extended/html/issue.filter +roundup/templates/extended/html/issue.index +roundup/templates/extended/html/issue.item +roundup/templates/extended/html/msg.index +roundup/templates/extended/html/msg.item +roundup/templates/extended/html/style.css +roundup/templates/extended/html/support.filter +roundup/templates/extended/html/support.index +roundup/templates/extended/html/support.item +roundup/templates/extended/html/timelog.index +roundup/templates/extended/html/timelog.item +roundup/templates/extended/html/user.index +roundup/templates/extended/html/user.item +test/README.txt +test/__init__.py +test/test_dates.py +test/test_db.py +test/test_init.py +test/test_mailsplit.py +test/test_multipart.py +test/test_schema.py +test/test_templating.py +test/unittest.py + diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index 206c725..478cda0 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.69 2001-11-29 23:19:51 richard Exp $ +# $Id: cgi_client.py,v 1.70 2001-11-30 00:06:29 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -98,62 +98,60 @@ class Client: if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: - message = '
%s
'%message + message = _('
%(message)s
')%locals() else: message = '' style = open(os.path.join(self.TEMPLATES, 'style.css')).read() user_name = self.user or '' if self.user == 'admin': - admin_links = ' | Class List' \ - ' | User List' + admin_links = _(' | Class List' \ + ' | User List') else: admin_links = '' if self.user not in (None, 'anonymous'): userid = self.db.user.lookup(self.user) - user_info = ''' -My Issues | -My Details | Logout -'''%(userid, userid) + user_info = _(''' +My Issues | +My Details | Logout +''')%locals() else: user_info = _('Login') if self.user is not None: - add_links = ''' + add_links = _(''' | Add Issue, User -''' +''') else: add_links = '' - self.write(''' -%s - + self.write(_(''' +%(title)s + -%s +%(message)s - - + + - +%(add_links)s +%(admin_links)s +
%s%s
%(title)s%(user_name)s
All Issues | Unassigned Issues -%s -%s%s%(user_info)s
-'''%(title, style, message, title, user_name, add_links, admin_links, - user_info)) +''')%locals()) def pagefoot(self): if self.debug: - self.write('
') - self.write('
Path
') + self.write(_('
Path
')) self.write('
%s
'%(', '.join(map(repr, self.split_path)))) keys = self.form.keys() keys.sort() if keys: - self.write('
Form entries
') + self.write(_('
Form entries
')) for k in self.form.keys(): v = self.form.getvalue(k, "") if type(v) is type([]): @@ -162,13 +160,13 @@ class Client: self.write('
%s=%s
'%(k, cgi.escape(v))) keys = self.headers_sent.keys() keys.sort() - self.write('
Sent these HTTP headers
') + self.write(_('
Sent these HTTP headers
')) for k in keys: v = self.headers_sent[k] self.write('
%s=%s
'%(k, cgi.escape(v))) keys = self.env.keys() keys.sort() - self.write('
CGI environment
') + self.write(_('
CGI environment
')) for k in keys: v = self.env[k] self.write('
%s=%s
'%(k, cgi.escape(v))) @@ -337,9 +335,10 @@ class Client: cl.set(self.nodeid, **props) self._post_editnode(self.nodeid, changed) # and some nice feedback for the user - message = '%s edited ok'%', '.join(changed) + message = _('%(changes)s edited ok')%{'changes': + ', '.join(changed)} else: - message = 'nothing changed' + message = _('nothing changed') except: s = StringIO.StringIO() traceback.print_exc(None, s) @@ -396,7 +395,8 @@ class Client: user.set(self.nodeid, **props) self._post_editnode(self.nodeid, changed) # and some feedback for the user - message = '%s edited ok'%', '.join(changed) + message = _('%(changes)s edited ok')%{'changes': + ', '.join(changed)} except: s = StringIO.StringIO() traceback.print_exc(None, s) @@ -495,7 +495,8 @@ class Client: summary = note m = ['%s\n'%note] else: - summary = 'This %s has been edited through the web.\n'%cn + summary = _('This %(classname)s has been edited through' + ' the web.\n')%{'classname': cn} m = [summary] # figure the changes and add them to the message @@ -569,12 +570,13 @@ class Client: nid = self._createnode() self._post_editnode(nid) # and some nice feedback for the user - message = '%s created ok'%cn + message = _('%(classname)s created ok')%{'classname': cn} except: s = StringIO.StringIO() traceback.print_exc(None, s) message = '
%s
'%cgi.escape(s.getvalue()) - self.pagehead('New %s'%self.classname.capitalize(), message) + self.pagehead(_('New %(classname)s')%{'classname': + self.classname.capitalize()}, message) # call the template newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES, @@ -605,13 +607,14 @@ class Client: self._post_editnode(cl.create(content=file.file.read(), type=mime_type, name=file.filename)) # and some nice feedback for the user - message = '%s created ok'%cn + message = _('%(classname)s created ok')%{'classname': cn} except: s = StringIO.StringIO() traceback.print_exc(None, s) message = '
%s
'%cgi.escape(s.getvalue()) - self.pagehead('New %s'%self.classname.capitalize(), message) + self.pagehead(_('New %(classname)s')%{'classname': + self.classname.capitalize()}, message) newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES, self.classname) newitem.render(self.form) @@ -640,11 +643,11 @@ class Client: def login(self, message=None, newuser_form=None, action='index'): self.pagehead(_('Login to roundup'), message) - self.write(''' + self.write(_(''' - + @@ -652,7 +655,7 @@ class Client: -'''%action) +''')%locals()) if self.user is None and self.ANONYMOUS_REGISTER == 'deny': self.write('
Existing User Login
Login name:
Password:
') self.pagefoot() @@ -662,7 +665,7 @@ class Client: if newuser_form is not None: for key in newuser_form.keys(): values[key] = newuser_form[key].value - self.write(''' + self.write(_('''

New User Registration marked items are optional... @@ -685,12 +688,12 @@ class Client: -'''%values) +''')%values) self.pagefoot() def login_action(self, message=None): if not self.form.has_key('__login_name'): - return self.login(message='Username required') + return self.login(message=_('Username required')) self.user = self.form['__login_name'].value if self.form.has_key('__login_password'): password = self.form['__login_password'].value @@ -923,43 +926,43 @@ class ExtendedClient(Client): if port != '80': machine = machine + ':' + port base = urlparse.urlunparse(('http', machine, url, None, None, None)) if message is not None: - message = '

%s
'%message + message = _('
%(message)s
')%locals() else: message = '' style = open(os.path.join(self.TEMPLATES, 'style.css')).read() user_name = self.user or '' if self.user == 'admin': - admin_links = ' | Class List' \ - ' | User List' + admin_links = _(' | Class List' \ + ' | User List') else: admin_links = '' if self.user not in (None, 'anonymous'): userid = self.db.user.lookup(self.user) - user_info = ''' -My Issues | -My Support | -My Details | Logout -'''%(userid, userid, userid) + user_info = _(''' +My Issues | +My Support | +My Details | Logout +''')%locals() else: - user_info = 'Login' + user_info = _('Login') if self.user is not None: - add_links = ''' + add_links = _(''' | Add Issue, Support, User -''' +''') else: add_links = '' - self.write(''' -%s - + self.write(_(''' +%(title)s + -%s +%(message)s - - + + - +%(add_links)s +%(admin_links)s +
%s%s
%(title)s%(user_name)s
All Issues, @@ -967,12 +970,11 @@ class ExtendedClient(Client): | Unassigned Issues, Support -%s -%s%s%(user_info)s
-'''%(title, style, message, title, user_name, add_links, admin_links, - user_info)) +''')%locals()) def parsePropsFromForm(db, cl, form, nodeid=0): '''Pull properties for the given class out of the form. @@ -1006,8 +1008,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0): try: value = db.classes[link].lookup(value) except KeyError: - raise ValueError, 'property "%s": %s not a %s'%( - key, value, link) + raise ValueError, _('property "%(propname)s": ' + '%(value)s not a %(classname)s')%{'propname':key, + 'value': value, 'classname': link} elif isinstance(proptype, hyperdb.Multilink): value = form[key] if type(value) != type([]): @@ -1021,9 +1024,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0): try: entry = db.classes[link].lookup(entry) except KeyError: - raise ValueError, \ - 'property "%s": "%s" not an entry of %s'%(key, - entry, link.capitalize()) + raise ValueError, _('property "%(propname)s": ' + '"%(value)s" not an entry of %(classname)s')%{ + 'propname':key, 'value': entry, 'classname': link} l.append(entry) l.sort() value = l @@ -1046,6 +1049,10 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.69 2001/11/29 23:19:51 richard +# Removed the "This issue has been edited through the web" when a valid +# change note is supplied. +# # Revision 1.68 2001/11/29 04:57:23 richard # a little comment # -- 2.30.2