You are not logged in.
Hello everyone.
I have a newly installed Archlinux KDE with `zh_CN.UTF-8` as default because I am Chinese, but I want my bash exports English for convenience. So I added
export LANG=en_US.UTF-8in my `.bashrc`. But after I source it, the shell still outputs Chinese. On the other hand, although I uncommented both en_US and zh_CN in `/etc/locale.gen`, it uses English by default, I manually changed it to zh_CN on KDE systemsettings.
[firestar@ArchLinux ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
[firestar@ArchLinux ~]$ cat /etc/locale.conf
LANG=en_US.UTF-8
[firestar@ArchLinux ~]$ cat ~/.config/plasma-localerc
[Formats]
LANG=zh_CN.UTF-8
[Translations]
LANGUAGE=zh_CN:en_USPS: I first know that this forum does not support markdown syntax
Last edited by Firestar (2022-08-23 06:43:33)
Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.
Offline
... after I source it, the shell still outputs Chinese
The bash shell itself still will, yes. But do utilities started from that shell session use English? In order to change the language for the shell itself, you need to export the LANG setting in the environment in which the bash shell is launched. Or, ash a test, does the following do what you want:
export LANG=en_US.UTF-8
exec bash"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
No, it still export Chinese. Like this:
[firestar@ArchLinux ~]$ export LANG=en_US.UTF-8
[firestar@ArchLinux ~]$ exec bash
[firestar@ArchLinux ~]$ sudo pacman -Syyu
:: 正在同步软件包数据库...
core 158.2 KiB 2.01 MiB/s 00:00 [####################################] 100%
extra 1765.8 KiB 6.56 MiB/s 00:00 [####################################] 100%
community 6.8 MiB 5.59 MiB/s 00:01 [####################################] 100%
:: 正在进行全面系统更新...
今日无事可做Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.
Offline
Did you generate the English locales?
$ grep ^en_US.UTF-8 /etc/locale.gen
# locale-genLast edited by schard (2022-08-22 17:02:55)
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
although I uncommented both en_US and zh_CN in `/etc/locale.gen`
[firestar@ArchLinux ~]$ grep ^en_US.UTF-8 /etc/locale.gen
en_US.UTF-8 UTF-8
[firestar@ArchLinux ~]$ sudo locale-gen
Generating locales...
en_US.UTF-8... done
zh_CN.UTF-8... done
Generation complete.Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.
Offline
What happens on
LANG=C bashor
LANG=en_US.UTF-8 bashLast edited by schard (2022-08-22 17:35:39)
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
LANGUAGE= LANG=en_US.UTF-8 bashIf that doesn't work
bash -ixc echo > /tmp/bash.dbg 2>&1and post that file.
Online
`LANG=` doesn't work but `LANGUAGE=` can
[firestar@ArchLinux ~]$ LANG=en_US.UTF-8 bash
[firestar@ArchLinux ~]$ sudo pacman -Syyu
:: 正在同步软件包数据库...
core 158.2 KiB 2.45 MiB/s 00:00 [####################################] 100%
extra 1765.8 KiB 6.23 MiB/s 00:00 [####################################] 100%
community 6.8 MiB 5.44 MiB/s 00:01 [####################################] 100%
:: 正在进行全面系统更新...
今日无事可做
[firestar@ArchLinux ~]$ LANGUAGE= LANG=en_US.UTF-8 bash
[firestar@ArchLinux ~]$ sudo pacman -Syyu
:: Synchronizing package databases...
core 158.2 KiB 2.31 MiB/s 00:00 [####################################] 100%
extra 1765.8 KiB 14.0 MiB/s 00:00 [####################################] 100%
community 6.8 MiB 6.86 MiB/s 00:01 [####################################] 100%
:: Starting full system upgrade...
there is nothing to do
[firestar@ArchLinux ~]$ bash -ixc echo > /tmp/bash.dbg 2>&1
[firestar@ArchLinux ~]$ cat /tmp/bash.dbg
+ [[ himxBHc != *i* ]]
+ [[ -n :0 ]]
+ shopt -s checkwinsize
+ PS1='[\u@\h \W]\$ '
+ case ${TERM} in
+ PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
+ '[' -r /usr/share/bash-completion/bash_completion ']'
+ export LANG=en_US.UTF-8
+ LANG=en_US.UTF-8
+ echoSo I changed `LANG=` to `LANGUAGE=` in my `.bashrc` and it works!
Last edited by Firestar (2022-08-23 01:38:22)
Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.
Offline
You don't need to keep doing
pacman -SyyuYou almost always just need
pacman -SyuThis will update pacman's information if it is out of date, but it won't download it unnecessarily. This should almost always do everything you need.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
LANGUAGE=zh_CN:en_US
https://wiki.archlinux.org/title/Locale … ck_locales
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Do you btw. use grub and have issues w/ the zh_CN locale on grub-mkconfig?
https://bbs.archlinux.org/viewtopic.php?id=279042 seems to indicate a bug in one of the localization files, but I'm pretty sure that the OP there doesn't speak english - at all.
Online
I used other distros before and they supports `LANG`, so I was curious to find that archlinux does not.
I have reported in https://bbs.archlinux.org/viewtopic.php?id=279042: **It is strange that although locale-gen can generate other locales than English, the locale.conf can only use English.**
PS: Isn't there a button or something to let others know that the problem is solved and which post is the solution? That's bad. I recommend Arch Linux Forum have a better functionality as Manjaro Forum (**build by discourse: https://github.com/discourse/discourse **) or Stackoverflow which supports markdown, translations, tags and many other things.
Last edited by Firestar (2022-08-23 07:14:58)
Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.
Offline
LANG is perfectly supported, but LANUGAGE is as well and does something different - this has nothing to do with the distribution.
The LANGUAGE variable was simply "in the way".
Online