Roundup Tracker - Issues

Issue 1895197

classification
translated help texts in admin.py not displayed correctly
Type: Severity: normal
Components: Command-line interface Versions:
process
Status: fixed fixed
:
: richard : richard, rouilj, tobias-herp
Priority: normal : patch

Created on 2008-02-17 01:09 by tobias-herp, last changed 2025-01-20 20:22 by rouilj.

Files
File name Uploaded Description Edit Remove
admin.py.patch tobias-herp, 2008-02-17 01:09 patch to admin.py
Messages
msg2526 Author: [hidden] (tobias-herp) Date: 2008-02-17 01:09
The descriptions of the functions of admin.py are not displayed correctly if the translation of "Usage:" doesn't match it's length (e.g. "Verwendung:" in the german translation). The patch makes help_commands() method not rely on the length anymore but splits the docstring at the 1st ': '.
msg2527 Author: [hidden] (tobias-herp) Date: 2008-02-17 13:44
Looked through the existing .po files.

german: Verwendung (patch corrects the erroneous display of "ung:")
french: Usage (like english; patch doesn't change anything visibly)
spanish: Uso, with additional spaces (patch wouldn't really hurt but increase indention of first line)
hungarian: Használat (patch corrects erroneous output)
italian: docstrings not translated
lithuanian: Naudojimas (patch corrects erroneous output)
russian: something as long as "Usage:" which can't be displayed correctly on my system ;-)
chinese simplified: something 3 unicode-characters long, no ':' (afaics)
chinese traditional: looks to me like chinese simplified

My patch would work for all languages (spanish could be enhanced by lstrip-ping blanks) *but* the two chinese versions. A universal approach could be to add a translation for "Usage: " and use its length.
msg8315 Author: [hidden] (rouilj) Date: 2025-01-20 20:22
Hi Tobias:

Thanks for noting this, it is finally fixed.

I reworked the patch a little bit. The reason Chinese didn't work is that
there is no colon space in the string. Instead

   https://www.compart.com/en/unicode/U+003A

is used.

So the result looks like:

        commands = ['']
        for command in self.commands.values():
            h = _(command.__doc__).split('\n')[0]
            # ascii colon and space, U+003A as ascii repr (for
            # Chinese variants), 'fallback'
            for seq in [': ', '\uff1a', 'fallback']:
                if seq == 'fallback':
                    # command hasn't been printed yet so ...
                    commands.append(' ' + h.lstrip())
                    break
                if seq in h:
                    commands.append(' ' + h.split(seq, 1)[1].lstrip())
                    break

I also added a code marker to the file to indicate it's utf-8 so I can embed
the actual character in a comment. This way I don't have to change the test
suite to stop testing the admin module under python2.

It doesn't fix the Chinese listing under python2, but python2 is not supported
anymore so I am ok with that.

changeset:   8296:4d3b371ed543
History
Date User Action Args
2025-01-20 20:22:48rouiljsetstatus: open -> fixed
resolution: fixed
messages: + msg8315
nosy: + rouilj
2016-06-26 19:52:43rouiljsetkeywords: + patch
2008-02-17 01:09:52tobias-herpcreate