You are not logged in.

#1 2025-08-19 16:53:41

xuangeyouneihan
Member
From: China
Registered: 2021-05-25
Posts: 6

How can I change the locale of the official WSL distribution?

I have uncommented "zh_CN.UTF-8" in /etc/locale.gen, re-generated the locale using locale-gen, and changed $LANG into zh_CN.UTF-8 in /etc/locale.conf. But when I restart WSL, the language has turned back to en_US.UTF-8. Running "unset LANG" and "source /etc/profile.d/locale.sh" cannot preserve the locale either. What should I do? Thanks!

Offline

#2 2025-08-19 18:15:18

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,889

Re: How can I change the locale of the official WSL distribution?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Online

#3 2025-08-19 18:35:17

xuangeyouneihan
Member
From: China
Registered: 2021-05-25
Posts: 6

Re: How can I change the locale of the official WSL distribution?

It seems not to be related to my issue

Last edited by xuangeyouneihan (2025-08-20 05:59:36)

Offline

#4 2025-08-19 19:50:48

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,889

Re: How can I change the locale of the official WSL distribution?

The only info about support for the wsl images is in thread on arch-dev-public ML .

It mentions bugs can be submitted at https://gitlab.archlinux.org/archlinux/ … l/-/issues and some devs are willing to help with such bugs.
There is an indicated the community should get involved but it's unclear what community the thread refers to.

The thread also mentions that supporting WSL requires having access to a windows system configured to run WSL..
A large part of forum users doesn't have such access.

Moderators haven't decided yet whether we will try to support WSL on the forum, but IF we do we need detailed info about your setup.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Online

#5 2025-08-20 05:41:09

xuangeyouneihan
Member
From: China
Registered: 2021-05-25
Posts: 6

Re: How can I change the locale of the official WSL distribution?

wsl --install archlinux
---
pacman-key --init
pacman-key --populate
pacman -Sy vim
---
Then I just did the steps I mentioned in the first post, and encountered the problem

Last edited by xuangeyouneihan (2025-08-20 05:42:19)

Offline

#6 2025-08-20 15:20:24

mhegreberg
Member
Registered: 2025-06-16
Posts: 4

Re: How can I change the locale of the official WSL distribution?

What language is the windows environment from which you're using WSL?

WSL attempts to set your LANG to the same as windows, so that could be overriding whatever you're using.

to override this, there are two simple options:
1. run `ln -sf /etc/locale.conf /etc/default/locale`. this will ovverride the locale that WSL tries to set on top of the distro, to the one you've set.
2. set your LANG in your .bashrc/.zshrc

otherwise WSL will try to make WSL match Windows.

Edit: I added this to the wiki:
https://wiki.archlinux.org/title/Instal … ust_locale

Last edited by mhegreberg (2025-08-20 15:51:58)


I maintain the Archlinux WSL image, as well as a few AUR packages. Find me on IRC as m_a_r_k

Offline

#7 2025-08-20 16:23:19

xuangeyouneihan
Member
From: China
Registered: 2021-05-25
Posts: 6

Re: How can I change the locale of the official WSL distribution?

Both my language of the Windows environment and the language I try to set for WSL are simplified Chinese. I'm not convenient to access the computer right now, but I'll give the methods you mentioned a try when I'm free. Thank you!

Last edited by xuangeyouneihan (2025-08-20 16:29:44)

Offline

#8 2025-08-23 06:58:40

xuangeyouneihan
Member
From: China
Registered: 2021-05-25
Posts: 6

Re: How can I change the locale of the official WSL distribution?

mhegreberg wrote:

What language is the windows environment from which you're using WSL?

WSL attempts to set your LANG to the same as windows, so that could be overriding whatever you're using.

to override this, there are two simple options:
1. run `ln -sf /etc/locale.conf /etc/default/locale`. this will ovverride the locale that WSL tries to set on top of the distro, to the one you've set.
2. set your LANG in your .bashrc/.zshrc

otherwise WSL will try to make WSL match Windows.

Edit: I added this to the wiki:
https://wiki.archlinux.org/title/Instal … ust_locale

Well, this method works, but somehow /etc/default/locale does not exist initially. Is this a problem of WSL rather than this WSL distribution?

Last edited by xuangeyouneihan (2025-08-23 06:59:19)

Offline

#9 2025-08-23 10:11:21

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,889

Re: How can I change the locale of the official WSL distribution?

Archlinux uses /etc/locale.conf (default for systemd ) for systemwide locale settings,not /etc/default/locale .

https://github.com/Microsoft/WSL/issues/13207 indicates /etc/default/locale is/was used on debian to manage systemwide locale settings .
This makes it a WSL problem.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Online

#10 2025-08-23 10:28:23

xuangeyouneihan
Member
From: China
Registered: 2021-05-25
Posts: 6

Re: How can I change the locale of the official WSL distribution?

OK, thanks a lot! What a stupid design!

Last edited by xuangeyouneihan (2025-08-24 02:09:27)

Offline

Board footer

Powered by FluxBB