comparison roundup/cgi/actions.py @ 6676:b336cc98d9d2

Mark strings for password reset and registration for translation Reported on: https://sourceforge.net/p/roundup/mailman/message/37652424/ by Thomas Arendsen Hein. Fixed in actions.py and roundup.pot and .po files updated.
author John Rouillard <rouilj@ieee.org>
date Thu, 12 May 2022 21:29:09 -0400
parents e70e2789bc2c
children 9ca5cbffa0c4
comparison
equal deleted inserted replaced
6675:7542269becfa 6676:b336cc98d9d2
967 else: 967 else:
968 address = uaddress 968 address = uaddress
969 969
970 # send the email 970 # send the email
971 tracker_name = self.db.config.TRACKER_NAME 971 tracker_name = self.db.config.TRACKER_NAME
972 subject = 'Password reset for %s' % tracker_name 972 subject = self._('Password reset for %s') % tracker_name
973 body = ''' 973 body = self._('''
974 The password has been reset for username "%(name)s". 974 The password has been reset for username "%(name)s".
975 975
976 Your password is now: %(password)s 976 Your password is now: %(password)s
977 ''' % {'name': name, 'password': newpw} 977 ''') % {'name': name, 'password': newpw}
978 if not self.client.standard_message([address], subject, body): 978 if not self.client.standard_message([address], subject, body):
979 return 979 return
980 980
981 self.client.add_ok_message( 981 self.client.add_ok_message(
982 self._('Password reset and email sent to %s') % address) 982 self._('Password reset and email sent to %s') % address)
1011 otks.set(otk, uid=uid, uaddress=address) 1011 otks.set(otk, uid=uid, uaddress=address)
1012 otks.commit() 1012 otks.commit()
1013 1013
1014 # send the email 1014 # send the email
1015 tracker_name = self.db.config.TRACKER_NAME 1015 tracker_name = self.db.config.TRACKER_NAME
1016 subject = 'Confirm reset of password for %s' % tracker_name 1016 subject = self._('Confirm reset of password for %s') % tracker_name
1017 body = ''' 1017 body = self._('''
1018 Someone, perhaps you, has requested that the password be changed for your 1018 Someone, perhaps you, has requested that the password be changed for your
1019 username, "%(name)s". If you wish to proceed with the change, please follow 1019 username, "%(name)s". If you wish to proceed with the change, please follow
1020 the link below: 1020 the link below:
1021 1021
1022 %(url)suser?@template=forgotten&@action=passrst&otk=%(otk)s 1022 %(url)suser?@template=forgotten&@action=passrst&otk=%(otk)s
1023 1023
1024 You should then receive another email with the new password. 1024 You should then receive another email with the new password.
1025 ''' % {'name': name, 'tracker': tracker_name, 'url': self.base, 'otk': otk} 1025 ''') % {'name': name, 'tracker': tracker_name, 'url': self.base, 'otk': otk}
1026 if not self.client.standard_message([address], subject, body): 1026 if not self.client.standard_message([address], subject, body):
1027 return 1027 return
1028 1028
1029 if 'username' in self.form: 1029 if 'username' in self.form:
1030 self.client.add_ok_message(self._('Email sent to primary notification address for %s.') % name) 1030 self.client.add_ok_message(self._('Email sent to primary notification address for %s.') % name)
1157 1157
1158 # send the email 1158 # send the email
1159 tracker_name = self.db.config.TRACKER_NAME 1159 tracker_name = self.db.config.TRACKER_NAME
1160 tracker_email = self.db.config.TRACKER_EMAIL 1160 tracker_email = self.db.config.TRACKER_EMAIL
1161 if self.db.config['EMAIL_REGISTRATION_CONFIRMATION']: 1161 if self.db.config['EMAIL_REGISTRATION_CONFIRMATION']:
1162 subject = 'Complete your registration to %s -- key %s' % ( 1162 subject = _('Complete your registration to %s -- key %s') % (
1163 tracker_name, otk) 1163 tracker_name, otk)
1164 body = """To complete your registration of the user "%(name)s" with 1164 body = _("""To complete your registration of the user "%(name)s" with
1165 %(tracker)s, please do one of the following: 1165 %(tracker)s, please do one of the following:
1166 1166
1167 - send a reply to %(tracker_email)s and maintain the subject line as is (the 1167 - send a reply to %(tracker_email)s and maintain the subject line as is (the
1168 reply's additional "Re:" is ok), 1168 reply's additional "Re:" is ok),
1169 1169
1170 - or visit the following URL: 1170 - or visit the following URL:
1171 1171
1172 %(url)s?@action=confrego&otk=%(otk)s 1172 %(url)s?@action=confrego&otk=%(otk)s
1173 1173
1174 """ % {'name': user_props['username'], 'tracker': tracker_name, 1174 """) % {'name': user_props['username'], 'tracker': tracker_name,
1175 'url': self.base, 'otk': otk, 'tracker_email': tracker_email} 1175 'url': self.base, 'otk': otk, 'tracker_email': tracker_email}
1176 else: 1176 else:
1177 subject = 'Complete your registration to %s' % (tracker_name) 1177 subject = _('Complete your registration to %s') % (tracker_name)
1178 body = """To complete your registration of the user "%(name)s" with 1178 body = _("""To complete your registration of the user "%(name)s" with
1179 %(tracker)s, please visit the following URL: 1179 %(tracker)s, please visit the following URL:
1180 1180
1181 %(url)s?@action=confrego&otk=%(otk)s 1181 %(url)s?@action=confrego&otk=%(otk)s
1182 1182
1183 """ % {'name': user_props['username'], 'tracker': tracker_name, 1183 """) % {'name': user_props['username'], 'tracker': tracker_name,
1184 'url': self.base, 'otk': otk} 1184 'url': self.base, 'otk': otk}
1185 if not self.client.standard_message([user_props['address']], subject, 1185 if not self.client.standard_message([user_props['address']], subject,
1186 body, 1186 body,
1187 (tracker_name, tracker_email)): 1187 (tracker_name, tracker_email)):
1188 return 1188 return

Roundup Issue Tracker: http://roundup-tracker.org/