ls options

You have a problem with Salix? Post here and we'll do what we can to help.
mobius
Posts: 47
Joined: 12. Nov 2016, 23:11
Location: Canada

Re: ls options

Post by mobius »

Thanks. For now, I had:

Code: Select all

export LANG=en_XC.utf8
export LC_COLLATE=en_XC.utf8
in ~/.profile, which of course affected my account only (the second one was necessary, as with only the first one, LC_COLLATE was being overridden by /etc/profile.d/lang.sh).

If I put it in /etc/profile.d/lang.sh, that will take effect system-wide, correct? Once I am satisfied with the locale, I may put it there. I'm always on the fence about whether to make changes take effect system-wide, or one user only, because whenever I need to sudo, I no longer have the same aliases, colours, locale, etc. :)

In the en_CA.utf8 locale that comes with the system, the collate section looks like this:

Code: Select all

LC_COLLATE

% Copy the template from ISO/IEC 14651
copy "iso14651_t1"

reorder-after <RES-1>
<CAP>

%reorder-end

END LC_COLLATE
which is nice and simple (but, "iso14651_t1" includes "iso14651_t1_common", which is more than 85,000 lines). So I'd like to learn about the rules of the LC_COLLATE section, as maybe there would be a simple way, as above, to include and then reorder?
Real men don't systemd.

Friends don't let friends systemd.
User avatar
gapan
Salix Wizard
Posts: 6241
Joined: 6. Jun 2009, 17:40

Re: ls options

Post by gapan »

Yes, editing lang.sh will apply the changes systemwide.

I'm afraid I'm not familiar with locale details and collate options to be of use.
Image
Image
mobius
Posts: 47
Joined: 12. Nov 2016, 23:11
Location: Canada

[SOLVED] Re: ls options

Post by mobius »

Solved, thanks to a post on StackExchange:
https://unix.stackexchange.com/question ... 006#361006

This post suggests modifying /usr/share/i18n/locales/iso14651_t1_common (that system-wide 85,000+ line file I mentioned earlier) to change the line which defines period/dot ('.') from:

Code: Select all

<U002E> IGNORE;IGNORE;IGNORE;<U002E> # 47 .
to:

Code: Select all

<U002E> <RES-1>;IGNORE;IGNORE;<U002E> # 47 .
in order to have the dot sort before upper- and lower-case letters.

Rather than modify that file, since I already had a custom locale file based on en_CA.utf8 (which I used to modify date formats, etc.) which contained this LC_COLLATE section:

Code: Select all

LC_COLLATE

% Copy the template from ISO/IEC 14651
copy "iso14651_t1"

reorder-after <RES-1>
<CAP>

%reorder-end

END LC_COLLATE
which places upper-case letters before lower-case letters, I simply added a line to place the period/dot before the upper-case-letters:

Code: Select all

LC_COLLATE

% Copy the template from ISO/IEC 14651
copy "iso14651_t1"

reorder-after <RES-1>
<U002E>
<CAP>

%reorder-end

END LC_COLLATE
resulting in the sort order I described in my previous post! This approach could probably be modified to create other sort orders as well. While it is still a brute-force approach, it doesn't involve changing any system-wide files, and only necessitates the creation of one custom locale file.
Real men don't systemd.

Friends don't let friends systemd.
Post Reply