How to change locale ?
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 ?
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
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.
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
I've changed to set the default locale from locale.conf in a28e138 ...