[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#578657: apt-cache policy should use TABs in format string to ease l10n



Hi Ralf Gesellensetter & Julian Andres Klode,

First of all i need to say: Nice find, i have looked at the output
many times now but never saw the obvious…

> On Wed, Apr 21, 2010 at 05:23:28PM +0200, RalfGesellensetter wrote:
>> .... suffering readability. Hence I suggest using TABs in the original format string,
>> as you cannot assume that same word lengths will be given for any locale.
>> The current state means discrimination of non-English languages ;)

TABs have a problem in cases like:
holly insane long Installed translation: 0.7.25.3
shortcandidate: 0.7.25.3
(how long is a tab? 4, 8 or 2¼ characters?)

Consequence: We can only use spaces for alignment.

2010/4/21 Julian Andres Klode <jak@debian.org>:
> We have users parsing the output of apt-cache policy, so changing the
> output format is not an option.
True, still the better users should switch their locale to C before parsing
as the string is under full control of the translator. Maybe Installed is
translated in more than one word (e.g. in cs, mr, ne, vi), maybe a locale
wants to include a space or not before the colon (at least mr and ne does)
and in the end it is not even clear if the string includes an ascii colon:
zh_TW and zh_CN use a different character which looks similar to a colon
and km and dz seems to use yet another char my used font doesn't
even have a symbol for (which is maybe needed if i compare this to
the quotation marks usage in different languages).

So handing it over to the translators would be an option, but i prefer to
let the application do the boring jobs - and alignment with spaces is
one of them… the attached patch tries to identify the length of the
(possible) multibyte character stream by converting it into wchar_t
without actually saving the result but start calculation with the count
of converted chars to wchar_ts. (mbstowcs)
I haven't test it by now, but at least it seems to works
in LANG=C & de_DE correctly.


Best regards / Mit freundlichen Grüßen,

David Kalnischkies

Attachment: apt-cache-align-versions.diff
Description: Binary data


Reply to: