You are not logged in.

#1 2017-10-05 15:08:28

SimonT
Member
Registered: 2015-01-26
Posts: 18

[SOLVED] Cannot set LANG locale

I'm having some trouble with the locale of my system. I've got

en_US.UTF-8 UTF-8

uncommented in /etc/locale.gen. It also show's up in the list when I run

locale -a

. I don't have a ~/.config/locale.conf file and my /etc/locale.conf has a single line:

LANG=en_US.UTF-8

and I also have

LANG="en_US.UTF-8"

in /etc/environment. But yet, when I run

locale

I get this list:

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=sma_SE.US-ASCII
LC_CTYPE="sma_SE.US-ASCII"
LC_NUMERIC="sma_SE.US-ASCII"
LC_TIME="sma_SE.US-ASCII"
LC_COLLATE="sma_SE.US-ASCII"
LC_MONETARY="sma_SE.US-ASCII"
LC_MESSAGES="sma_SE.US-ASCII"
LC_PAPER="sma_SE.US-ASCII"
LC_NAME="sma_SE.US-ASCII"
LC_ADDRESS="sma_SE.US-ASCII"
LC_TELEPHONE="sma_SE.US-ASCII"
LC_MEASUREMENT="sma_SE.US-ASCII"
LC_IDENTIFICATION="sma_SE.US-ASCII"
LC_ALL=

I've set numeric, currency and time formats to Swedish in the KDE System Settings. But not LANG.

The actual problem I get from this are three, this far:

  1. Characters that are not ASCII shows as question marks in the terminal

  2. When I try to run the program Anki I get the error

    Exception: Anki requires a UTF-8 locale.
  3. When I try to run the program zim, I get the error

    locale.Error: unsupported locale setting

I've found some others with the same problem with Anki in various places on the internet but the solutions haven't worked for me. By entering

export LC_ALL="en_US.UTF-8"

as suggested in the top answer here I can run Anki and zim from that terminal but it only works temporarily. I can also use

export LANG="en_US.UTF-8"

and get the same result.

I guess my question boils down to: how do I change the LANG locale when it seems that the usual ways don't work?

Last edited by SimonT (2017-10-05 20:40:06)

Offline

#2 2017-10-05 15:30:48

Fixxer
Member
From: Poland
Registered: 2011-08-29
Posts: 232

Re: [SOLVED] Cannot set LANG locale

Did you run below command after changes in /etc/locale.gen?

locale-gen

Offline

#3 2017-10-05 15:31:20

SimonT
Member
Registered: 2015-01-26
Posts: 18

Re: [SOLVED] Cannot set LANG locale

Yes

Offline

#4 2017-10-05 15:59:40

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: [SOLVED] Cannot set LANG locale

"sma_SE.US-ASCII" is no valid locale

Check the locale in a linux console (ctrl+alt+f1) - if it's ok there, it's something your session does.
For plasma,

grep -r sma_SE ~/.config/plasma*

In doubt, grep your entire home directory ...

Online

#5 2017-10-05 16:40:15

SimonT
Member
Registered: 2015-01-26
Posts: 18

Re: [SOLVED] Cannot set LANG locale

I get a the right LANG if I press ctrl+alt+f2 and run the locale command.

I get two results when I search for sma_SE:

/home/<username>/.config/plasma-locale-settings.sh:export LANG=sma_SE.US-ASCII
/home/<username>/.config/plasma-localerc:LANG=sma_SE.US-ASCII

plasma-locale-settings.sh contains:

# Generated script, do not edit
# Exports language-format specific env vars from startkde.
# This script has been generated from kcmshell5 formats.
# It will automatically be overwritten from there.
export LANG=sma_SE.US-ASCII

I found I had the wrong kind of Swedish in the system settings. I changed it there and then the file showed sv_SE.UTF-8 as it should. I also went to the language settings in KDE and set it to American English. I had that before and it didn't change anything though.

plasma-localerc contains

[Formats]
LANG=sma_SE.US-ASCII

[Translations]
LANGUAGE=

I changed both of them to en_US.UTF-8. I don't know why it says [Formats] above LANG when what it does is to change the language, not the formats. Anyway, I logged out and logged back in and now it's working. Thanks Seth!

Offline

#6 2017-10-05 18:27:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Cannot set LANG locale

Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB