Skip to content

Commit 2b5654f

Browse files
author
Alexander Smishlajev
committed
translate web ui messages in _EditAction, PassResetAction
1 parent 8abcf2f commit 2b5654f

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

roundup/cgi/actions.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: actions.py,v 1.31 2004-06-06 12:40:30 a1s Exp $
1+
#$Id: actions.py,v 1.32 2004-07-03 17:17:47 a1s Exp $
22

33
import re, cgi, StringIO, urllib, Cookie, time, random
44

@@ -409,9 +409,12 @@ def _editnodes(self, all_props, all_links, newids=None):
409409
# and some nice feedback for the user
410410
if props:
411411
info = ', '.join(props.keys())
412-
m.append('%s %s %s edited ok'%(cn, nodeid, info))
412+
m.append(
413+
self._('%(class)s %(id)s %(properties)s edited ok')
414+
% {'class':cn, 'id':nodeid, 'properties':info})
413415
else:
414-
m.append('%s %s - nothing changed'%(cn, nodeid))
416+
m.append(self._('%(class)s %(id)s - nothing changed')
417+
% {'class':cn, 'id':nodeid})
415418
else:
416419
assert props
417420

@@ -422,7 +425,8 @@ def _editnodes(self, all_props, all_links, newids=None):
422425
nodeid = newid
423426

424427
# and some nice feedback for the user
425-
m.append('%s %s created'%(cn, newid))
428+
m.append(self._('%(class)s %(id)s created')
429+
% {'class':cn, 'id':newid})
426430

427431
# fill in new ids in links
428432
if links.has_key(needed):
@@ -452,7 +456,9 @@ def _changenode(self, cn, nodeid, props):
452456
"""Change the node based on the contents of the form."""
453457
# check for permission
454458
if not self.editItemPermission(props):
455-
raise Unauthorised, 'You do not have permission to edit %s'%cn
459+
raise Unauthorised, self._(
460+
'You do not have permission to edit %(class)s'
461+
) % {'class': cn}
456462

457463
# make the changes
458464
cl = self.db.classes[cn]
@@ -462,7 +468,9 @@ def _createnode(self, cn, props):
462468
"""Create a node based on the contents of the form."""
463469
# check for permission
464470
if not self.newItemPermission(props):
465-
raise Unauthorised, 'You do not have permission to create %s'%cn
471+
raise Unauthorised, self._(
472+
'You do not have permission to create %(class)s'
473+
) % {'class': cn}
466474

467475
# create the node and return its id
468476
cl = self.db.classes[cn]
@@ -578,9 +586,10 @@ def handle(self):
578586
otk = self.form['otk'].value
579587
uid = otks.get(otk, 'uid')
580588
if uid is None:
581-
self.client.error_message.append("""Invalid One Time Key!
582-
(a Mozilla bug may cause this message to show up erroneously,
583-
please check your email)""")
589+
self.client.error_message.append(
590+
self._("Invalid One Time Key!\n"
591+
"(a Mozilla bug may cause this message "
592+
"to show up erroneously, please check your email)"))
584593
return
585594

586595
# re-open the database as "admin"
@@ -620,7 +629,7 @@ def handle(self):
620629
return
621630

622631
self.client.ok_message.append(
623-
'Password reset and email sent to %s'%address)
632+
self._('Password reset and email sent to %s') % address)
624633
return
625634

626635
# no OTK, so now figure the user
@@ -629,19 +638,20 @@ def handle(self):
629638
try:
630639
uid = self.db.user.lookup(name)
631640
except KeyError:
632-
self.client.error_message.append('Unknown username')
641+
self.client.error_message.append(self._('Unknown username'))
633642
return
634643
address = self.db.user.get(uid, 'address')
635644
elif self.form.has_key('address'):
636645
address = self.form['address'].value
637646
uid = uidFromAddress(self.db, ('', address), create=0)
638647
if not uid:
639-
self.client.error_message.append('Unknown email address')
648+
self.client.error_message.append(
649+
self._('Unknown email address'))
640650
return
641651
name = self.db.user.get(uid, 'username')
642652
else:
643-
self.client.error_message.append('You need to specify a username '
644-
'or address')
653+
self.client.error_message.append(
654+
self._('You need to specify a username or address'))
645655
return
646656

647657
# generate the one-time-key and store the props for later
@@ -666,7 +676,7 @@ def handle(self):
666676
if not self.client.standard_message([address], subject, body):
667677
return
668678

669-
self.client.ok_message.append('Email sent to %s'%address)
679+
self.client.ok_message.append(self._('Email sent to %s') % address)
670680

671681
class ConfRegoAction(Action):
672682
def handle(self):

0 commit comments

Comments
 (0)