You are not logged in.

#1 2012-03-08 06:04:09

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

en_XX: a custom locale that follows ISO and POSIX standards

I wasn't completely happy with all of the formats of any given locale, so I created my own. tongue

If follows ISO and POSIX standards where applicable. Check the project page for more information.

I've been using it for half a year on my main system without any issues.

Last edited by Xyne (2012-12-02 17:20:33)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#2 2012-12-02 17:41:06

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: en_XX: a custom locale that follows ISO and POSIX standards

*sweeps off some dust*
*coughs*

Just in case anyone is using this, I have changed the package name to "locale-en_xx". I just noticed today that it hadn't been uploaded to the AUR because of the upper-case letters in the old name. Oops. (There is now an AUR package for those that don't use my repo).

I have also made a slight modification to the '%c' format too. See the changelog on the project page or in the source archive for details.

If someone wants to contribute an updated version of the deb package, feel free.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2013-02-28 15:09:31

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: en_XX: a custom locale that follows ISO and POSIX standards

iso_8601.png

If anyone has an XKCD forum account, feel free to mention this locale here.

(not entirely) shameless self-bump (it's a good locale, damn it)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2013-02-28 18:29:49

Spyhawk
Member
Registered: 2006-07-07
Posts: 485

Re: en_XX: a custom locale that follows ISO and POSIX standards

It's indeed a good locale. Thanks!
I've been looking for something like this for *years*.

Offline

#5 2013-03-01 08:07:57

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: en_XX: a custom locale that follows ISO and POSIX standards

Spyhawk wrote:

It's indeed a good locale. Thanks!
I've been looking for something like this for *years*.

big_smile spread the word cool


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#6 2013-07-03 19:30:40

DerFlob
Member
From: Munich, Germany
Registered: 2011-09-18
Posts: 21

Re: en_XX: a custom locale that follows ISO and POSIX standards

I've lately been experimenting with a custom locale myself and had the same problems with urxvt you had in the past. I think I found the reason, why one has to set the LC_CTYPE to en_US.UTF-8.

Xlib uses LC_CTYPE as the current locale. See 13.1 here. It also keeps a file (/usr/share/X11/locale/locale.dir) with the locales it supports. It uses this file to determine which locale definitions in /usr/share/X11/locale to use. For most it is simply en_US.UTF-8.
I tried adding an entry for my locale, namely "en_US.UTF-8/XLC_LOCALE: en_FB.UTF-8", and everything works as expected, without any error...

So the reason, why it doesn't help, to copy en_US or what ever in your locale definition, is that Xlib doesn't actually care or look at the definitions you made, but only looks at the current value of LC_CTYPE and makes a lookup in its own database.

Edit: Fix locale entry see post below as well.

Last edited by DerFlob (2013-07-05 09:11:48)

Offline

#7 2013-07-03 21:32:15

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: en_XX: a custom locale that follows ISO and POSIX standards

Thanks for posting the explanation and solution. I have updated the en_XX README.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#8 2013-07-05 09:10:49

DerFlob
Member
From: Munich, Germany
Registered: 2011-09-18
Posts: 21

Re: en_XX: a custom locale that follows ISO and POSIX standards

I just realized, the entry you have to add should have read "en_US.UTF-8/XLC_LOCALE: en_XX.UTF-8". In addition to this entry you also need an entry, that doesn't have the colon i.e. "en_US.UTF-8/XLC_LOCALE en_XX.UTF-8".
I haven't used it so far, but for multi-key input sequences to work, you probably have to add entries to /usr/share/X11/locale/compose.dir as well. "en_US.UTF-8/Compose: en_XX.UTF-8", again once with, once without the colon.

Sorry about the previous incomplete post... I didn't realize at the time, the difference between the entries. I just thought they were exact duplicates ._.

Edit: typo

Last edited by DerFlob (2013-07-05 18:23:25)

Offline

#9 2013-07-05 16:47:39

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: en_XX: a custom locale that follows ISO and POSIX standards

I noticed that the file contained multiple entries with "/XLC_LOCALE" but I assumed they were unnecessary as I thought it worked for you. I'll update the README again. Thanks for taking the time to post a follow-up. Incidentally, there is a missing "-8" in the entry at the end of the first line.

It's nice to finally have the solution to this but in the end I think that setting LC_CTYPE to en_US.UTF-8 in /etc/locale.conf the better solution (few files, more "central").

Let me know if you find a way to get people to actually use your locale.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#10 2014-02-09 10:56:04

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: en_XX: a custom locale that follows ISO and POSIX standards

Thank you for this locale. Since I don't want to use it as my default locale but like it when I need to parse data in pipes, I have added an alias to /usr/share/locale/locale.alias:

CUTF            en_XX.UTF-8@POSIX

Now I can simply use this way:

LANG=CUTF date

I just wish that such a locale would be included in all major linux distributions by default. C/POSIX is just not enough anymore.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#11 2015-03-13 22:27:07

latgarf
Member
Registered: 2012-12-14
Posts: 32

Re: en_XX: a custom locale that follows ISO and POSIX standards

Great locale, thanks!

I notice, however, that immediately upon my very first installation of the locale-en_xx package, I get this:

$ man
man: can't set the locale; make sure $LC_* and $LANG are correct
What manual page do you want?
$

The output of the locale command is:

$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_XX.UTF-8@POSIX
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_XX.UTF-8@POSIX"
LC_TIME="en_XX.UTF-8@POSIX"
LC_COLLATE="en_XX.UTF-8@POSIX"
LC_MONETARY="en_XX.UTF-8@POSIX"
LC_MESSAGES="en_XX.UTF-8@POSIX"
LC_PAPER="en_XX.UTF-8@POSIX"
LC_NAME="en_XX.UTF-8@POSIX"
LC_ADDRESS="en_XX.UTF-8@POSIX"
LC_TELEPHONE="en_XX.UTF-8@POSIX"
LC_MEASUREMENT="en_XX.UTF-8@POSIX"
LC_IDENTIFICATION="en_XX.UTF-8@POSIX"
LC_ALL=
$

I have tried both the LC_CTYPE and Xlib approaches from the package homepage, but no success sad
Any ideas what's the problem and how to fix it?

Offline

#12 2015-03-14 00:28:30

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: en_XX: a custom locale that follows ISO and POSIX standards

Post the output of 'locale -a' and 'localectl'.

Offline

#13 2015-03-14 02:51:59

latgarf
Member
Registered: 2012-12-14
Posts: 32

Re: en_XX: a custom locale that follows ISO and POSIX standards

$ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
C
en_XX@POSIX
en_XX.utf8@POSIX
POSIX

$ localectl
   System Locale: LANG=en_XX.UTF-8@POSIX
                  LC_CTYPE=en_US.UTF-8
       VC Keymap: us
      X11 Layout: n/a

Offline

#14 2015-03-14 03:24:42

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: en_XX: a custom locale that follows ISO and POSIX standards

If you're going to use LC_*=bar, you have to make sure bar is available i.e. uncomment en_US.UTF-8 locale in /etc/locale.gen and regenerate the locales. Check the output of 'locale -a' to see if en_US.UTF-8 is now available.

Offline

#15 2015-03-14 03:57:13

latgarf
Member
Registered: 2012-12-14
Posts: 32

Re: en_XX: a custom locale that follows ISO and POSIX standards

That solved the problem. Thank you.

Offline

#16 2015-03-14 04:02:27

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: en_XX: a custom locale that follows ISO and POSIX standards

It's not mentioned in http://xyne.archlinux.ca/projects/locale-en_xx/ , not sure if it needs to be. If you thought that only 'en_XX.UTF-8@POSIX UTF-8' needs to be enabled in /etc/locale.gen then I guess explicitly saying you need 'en_US.UTF-8' wouldn't hurt.

Offline

#17 2015-03-14 21:25:10

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: en_XX: a custom locale that follows ISO and POSIX standards

I have updated the README. Thanks for the suggestion.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#18 2015-03-14 21:44:50

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: en_XX: a custom locale that follows ISO and POSIX standards

I use the alternative way with patches to locale.dir and compose.dir. I have also added an alias for LANG=CUTF, and everything is managed with the following script I run if necessary.

#!/usr/bin/bash

testwrite() {
    echo "Test '$2' in '$3'"
    if ! grep -a "$1" "$3" ; then
        echo Write
        echo "$2" >> "$3"
    fi
    echo
}

new_entry="CUTF    en_XX@POSIX"
test_pattern='^CUTF[[:space:]]'
target_file=/usr/share/locale/locale.alias
testwrite "$test_pattern" "$new_entry" "$target_file"
target_file=/usr/share/X11/locale/locale.alias
testwrite "$test_pattern" "$new_entry" "$target_file"

new_entry="CUTF:    en_XX@POSIX"
test_pattern='^CUTF:[[:space:]]'
target_file=/usr/share/X11/locale/locale.alias
testwrite "$test_pattern" "$new_entry" "$target_file"

test_pattern='^en_US\.UTF-8/XLC_LOCALE:[[:space:]]\+en_XX\.UTF-8'
new_entry='en_US.UTF-8/XLC_LOCALE: 		en_XX.UTF-8'
target_file='/usr/share/X11/locale/locale.dir'
testwrite "$test_pattern" "$new_entry" "$target_file"

test_pattern='^en_US\.UTF-8/XLC_LOCALE[[:space:]]\+en_XX\.UTF-8'
new_entry='en_US.UTF-8/XLC_LOCALE 		en_XX.UTF-8'
target_file='/usr/share/X11/locale/locale.dir'
testwrite "$test_pattern" "$new_entry" "$target_file"

test_pattern='^en_US\.UTF-8/Compose:[[:space:]]\+en_XX\.UTF-8'
new_entry='en_US.UTF-8/Compose: 		en_XX.UTF-8'
target_file='/usr/share/X11/locale/compose.dir'
testwrite "$test_pattern" "$new_entry" "$target_file"

test_pattern='^en_US\.UTF-8/Compose[[:space:]]\+en_XX\.UTF-8'
new_entry='en_US.UTF-8/Compose 		en_XX.UTF-8'
target_file='/usr/share/X11/locale/compose.dir'
testwrite "$test_pattern" "$new_entry" "$target_file"

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#19 2017-11-02 23:43:51

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: en_XX: a custom locale that follows ISO and POSIX standards

The latest upgrade fixes a longstanding error that led to "unrecognized locale" errors (due to a misunderstanding when I create the locale years ago).


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB