ArchWSL icon indicating copy to clipboard operation
ArchWSL copied to clipboard

How to change locale ?

Open STLGirlfriend opened this issue 7 years ago • 4 comments

I edited the file /etc/locale.gen and run locale-gen first .

Then I edited /etc/locale.conf but it did not work .

export LANG= worked but it can not be saved after closing the window .

So How should I do to change locale ?

STLGirlfriend avatar Feb 09 '19 05:02 STLGirlfriend

It seems WSL instances are started with $LANG env variable already set.

If you want to use locale from locale.conf file anyway, you need to remove [ -z "$LANG" ] condition in /etc/profile.d/locale.sh

i.e. replace line if [ -z "$LANG" ]; then with if true; then or just remove this line and matching fi

hdk5 avatar Feb 09 '19 07:02 hdk5

But why Ubuntu on WSL can use update–locale to change the locale? How does update-locale work?

And why the locale on WSL is different from that on Windows? For example, my Windows language is Chinese, but the locale on WSL is en_US.UTF-8 instead of zh_CN.UTF-8.

STLGirlfriend avatar Feb 15 '19 01:02 STLGirlfriend

The default locale using update-locale seems to be set with /etc/default/locale. Please try this: echo LANG=zn_CN.UTF-8 > /etc/default/locale

yuk7 avatar Feb 22 '19 12:02 yuk7

I've changed to set the default locale from locale.conf in a28e138 ...

yuk7 avatar Feb 24 '19 02:02 yuk7