Mailinglist Archive: yast-devel (71 mails)

< Previous Next >
Re: [yast-devel] Table sorting and locales in YaST UI
On Thu May 3 2012 16:08:56 Ladislav Slezak wrote:
Hi all,

I found out that sorting a table in Yast does not work the same way in
all UIs.

The Qt UI respects the current locale, while ncurses and Gtk
always use standard C (ASCII) sorting. That makes a trouble when sorting
texts with accents.

E.g. ["Z", "Ž", "á", "Á", "A", "a"] is in Qt sorted as users would
expect ["a", "A", "á", "Á", "Z", "Ž"] (unless the locale is C/POSIX), while
the others always display ["A", "Z", "a", "Á", "á", "Ž"], which is IMHO a
bug.


The problem is additionally complicated by the locale setting, i.e. it
depends on invocation, ssh or su/kdesu keeps the current locale, but "su
-" or logging in a text console sets POSIX locale (which results in C
sorting).


On the other hand locale sorting does not work correctly with numbers,
in the repository module I pad priority number with spaces so in C sorting
values " 90" and "100" are sorted correctly. However, this does not work
when locale sorting is active, the values are in order like this: " 99", "
90", "105", "100", which looks strange. So C sorting would be good here.


So how to solve all these problems?

- I think table sorting should respect the current locale
(so there is a bug in Gtk/ncurses)
I agree.


- The numeric sorting problem can be solved by padding numbers with zeroes
instead of spaces e.g. "090" instead of " 90" - it does not look nice but
I haven't found any better solution. Any idea? (I tried some tricks with
UTF-8 non-breakable space but that didn't help.)
I'd propose _NOT_ to add zeros to the ycp code, because it makes the table
unreadable. It's an UI issue that needs to be fixed in the UI.

I just fixed the numeric sorting in yast2-qt (version 2.22.6). Columns that
contain digits only are sorted in numeric order now.

Cheers,
Thomas


--
Thomas Goettlicher
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer,
HRB 16746 (AG Nürnberg)
Maxfeldstraße 5
90409 Nürnberg
Germany
< Previous Next >
Follow Ups
References