On Friday, 15 January 2021 03:53:54 CET David Wright wrote: > On Thu 14 Jan 2021 at 19:06:34 (+0000), Rasmus MK wrote: > > I'm looking for help in understanding how locales work and how to > > configure my system running Debian Testing. > > > > During the Debian installation (graphical) I configured my locale to be > > "en_SE.UTF-8". > > Recently a python script crashed with the error message "unsupported > > locale > > setting" after trying to set LC_ALL to an empty string and I cannot get it > > to work with the en_SE.UTF-8 locale. > > > > I use KDE. If I look in Settings -> Regional Settings -> Format it says > > en_SE.UTF-8 (no adjustments). > > > > The output of `locale` is: > > > > locale: Cannot set LC_CTYPE to default locale: No such file or directory > > locale: Cannot set LC_MESSAGES to default locale: No such file or > > directory > > locale: Cannot set LC_ALL to default locale: No such file or directory > > LANG=en_SE.UTF-8 > > LANGUAGE= > > LC_CTYPE="en_SE.UTF-8" > > LC_NUMERIC="en_SE.UTF-8" > > LC_TIME="en_SE.UTF-8" > > LC_COLLATE="en_SE.UTF-8" > > LC_MONETARY="en_SE.UTF-8" > > LC_MESSAGES="en_SE.UTF-8" > > LC_PAPER="en_SE.UTF-8" > > LC_NAME="en_SE.UTF-8" > > LC_ADDRESS="en_SE.UTF-8" > > LC_TELEPHONE="en_SE.UTF-8" > > LC_MEASUREMENT="en_SE.UTF-8" > > LC_IDENTIFICATION="en_SE.UTF-8" > > LC_ALL= > > Those error messages probably indicate that you (accidentally or > otherwise) unset all the locales. It looks as if you might have done > this by selecting a locale that's unavailable on your system. (I don't > know which configuration method you're using.)
The selection of the non-existent en_SE.UTF-8 locale was made during the installation process. > > I want to have the exact locale settings of en_SE.UTF-8. If possible I > > would also prefer to avoid being dependant on my desktop environment to > > configure this (i.e. use localectl or similar). Obviously I also want the > > Python script to work. > > Has anybody written that locale? You could write your own, as there's > any number of examples in the directories above, and much of the task > is just adding copy this and copy that. You would put your own file > into /usr/local/share/i18n/locales/xx_XX.UTF-8 and its name into the > file /usr/local/share/i18n/SUPPORTED. Then dpkg-reconfigure locales > would offer it amongst the alternatives. (NB Be aware that locales are > not added to the system cumulatively: you have to specify all you want > each time you configure them.) I will absolutely create it myself! Thanks for the advice. > How much changes for you when you run your software using these > two locales? Which one suits your software the best? You might find > that you don't have to set them all to the same value, eg LC_CTYPE > for changing letter case, and LC_MESSAGES for error messages etc. Although I think I will go for creating en_SE.UTF-8, this response clears out some questions. I think I can how I should deal with locales now.