Skip to content

Commit f70e7e3

Browse files
committed
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.
1 parent ae98c2d commit f70e7e3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ Fixed:
8585
be skipped. Fixed code so that the id used to set the sequence
8686
will be returned and not skipped. (Tom Ekberg diagnosed and
8787
supplied the fix. John Rouillard committed)
88+
- issue1895197 - translated help texts in admin.py not displayed
89+
correctly. (Initial patch tobias-herp, John Rouillard)
8890

8991
Features:
9092

roundup/admin.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#! /usr/bin/env python
2+
# -*- coding: utf-8 -*-
23
#
34
# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
45
# This module is free software, and you may redistribute it and/or modify
@@ -232,7 +233,17 @@ def help_commands(self):
232233
commands = ['']
233234
for command in self.commands.values():
234235
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+
236247
commands.sort()
237248
commands.append(_(
238249
"""Commands may be abbreviated as long as the abbreviation

0 commit comments

Comments
 (0)