comparison roundup/admin.py @ 8296:4d3b371ed543

fix: issue1895197 - translated help texts in admin.py not displayed correctly. Adjust the technique used to remove the translated "Usage:" prefix from the printed line. Support Chinese (zh) as well. Add coding marker so I don't have to modify the tests to skip the ones that touch the dmin module.
author John Rouillard <rouilj@ieee.org>
date Mon, 20 Jan 2025 15:21:56 -0500
parents 1189c742e4b3
children e5d07fac0249
comparison
equal deleted inserted replaced
8295:bbc99def147a 8296:4d3b371ed543
1 #! /usr/bin/env python 1 #! /usr/bin/env python
2 # -*- coding: utf-8 -*-
2 # 3 #
3 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/) 4 # Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
4 # This module is free software, and you may redistribute it and/or modify 5 # This module is free software, and you may redistribute it and/or modify
5 # under the same terms as Python, so long as this copyright message and 6 # under the same terms as Python, so long as this copyright message and
6 # disclaimer are retained in their original form. 7 # disclaimer are retained in their original form.
230 """ 231 """
231 sys.stdout.write(_('Commands: ')) 232 sys.stdout.write(_('Commands: '))
232 commands = [''] 233 commands = ['']
233 for command in self.commands.values(): 234 for command in self.commands.values():
234 h = _(command.__doc__).split('\n')[0] 235 h = _(command.__doc__).split('\n')[0]
235 commands.append(' ' + h[7:]) 236 # ascii colon and space, U+003A ':' as ascii repr (for
237 # Chinese locales), 'fallback'
238 for seq in [': ', '\uff1a', 'fallback']:
239 if seq == 'fallback':
240 # command hasn't been printed yet so ...
241 commands.append(' ' + h.lstrip())
242 break
243 if seq in h:
244 commands.append(' ' + h.split(seq, 1)[1].lstrip())
245 break
246
236 commands.sort() 247 commands.sort()
237 commands.append(_( 248 commands.append(_(
238 """Commands may be abbreviated as long as the abbreviation 249 """Commands may be abbreviated as long as the abbreviation
239 matches only one command, e.g. l == li == lis == list.""")) 250 matches only one command, e.g. l == li == lis == list."""))
240 sys.stdout.write('\n'.join(commands) + '\n\n') 251 sys.stdout.write('\n'.join(commands) + '\n\n')

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