You are not logged in.
Pages: 1
The output of my echo $LANG in the terminal is zh_CN.UTF8, and the program interface of vim and nano normally displays Chinese (zh_CN.utf8), but neovim does not seem to comply with it,neovim is still in English,I can fix this by manually setting "lang", but is this a bug?
Last edited by Ypixcm (2024-07-24 06:12:47)
My new name: RethLibc
Offline
what do `locale` and `locale -a` give you?
Offline
Shouldnt it rather be "zh_CN.UTF-8", like it is set in https://wiki.archlinux.org/title/Instal … calization?
Last edited by gromit (2024-07-22 14:18:51)
Offline
Shouldnt it rather be "zh_CN.UTF-8", like it is set in https://wiki.archlinux.org/title/Instal … calization?
I'm sorry I misspelled it.It's “zh_CN.UTF-8”.
locale :
cm@thinkpad ~> locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=locale -a :
cm@thinkpad ~> locale -a
C
C.utf8
en_US.utf8
POSIX
zh_CN.utf8I found that when my /etc/locale.conf is 'LANG=en_US.UTF-8', neovim is always in English
(on the contrary, when /etc/locale.conf is 'LANG=zh_CN.UTF-8', neovim is in Chinese)
but I want to make a point that Chinese characters can't be shown in agetty
https://wiki.archlinux.org/title/Locali … ed_Chinese :
Warning: Globally setting Chinese locales in /etc/locale.conf will cause tty to display garbled texts due to the tty glyph limitation of Linux kernel. To properly display Chinese characters under tty, you need to set the tty glyph limitation in the Linux kernel.
We have a solution.:
https://wiki.archlinux.org/title/Locali … interfaces
With this method, my xfce,nano,vim.......'s will use Chinese,But neovim is the only thing that doesn't work.
cm@thinkpad ~> echo $LANG
zh_CN.UTF-8
cm@thinkpad ~> cat /etc/locale.conf
LANG=en_US.UTF-8Last edited by Ypixcm (2024-07-23 03:12:55)
My new name: RethLibc
Offline
I may have found the problem
cat .xprofile
export LANG=zh_CN.UTF-8
export LANGUAGE=zh_CN:en_USAfter I deleted "export LANGUAGE=zh_CN:en_US", Neovim would display the Chinese interface
https://wiki.archlinux.org/title/Locale … ck_locales :
Note: Many applications do not name or alias their English locale as en or en_US, but instead make it the default locale, which is C. If in LANGUAGE a non-English locale is placed after English, e.g. LANGUAGE=en_US:en:es_ES, then applications may choose the secondary locale despite English strings being available.[3] The solution is to always explicitly place the C locale after English. E.g. LANGUAGE=en_US:en:C:es_ES.
Last edited by Ypixcm (2024-07-23 12:43:47)
My new name: RethLibc
Offline
LANGUAGE defines a fallback cascade, it'll try zh_CN first and resort to en_US then
Why are you controlling the locale in .xprofile if you're mostly concerned about the console?
Edit: scratch that
stat /usr/share/locale/zh_CN.UTF-8/LC_MESSAGES/nvim.mo
# /w LANGUAGE=zh_CN:en_US exported:
strace -o /tmp/neovim.strace # quit neovim
cat /tmp/neovim.strace | curl -F 'file=@-' 0x0.stLast edited by seth (2024-07-23 15:24:07)
Offline
cm@thinkpad ~> stat /usr/share/locale/zh_CN.UTF-8/LC_MESSAGES/nvim.mo
文件:/usr/share/locale/zh_CN.UTF-8/LC_MESSAGES/nvim.mo
大小:175201 块:344 IO 块大小:4096 普通文件
设备:8,2 Inode: 1491639 硬链接:1
权限:(0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
访问时间:2024-07-23 18:28:56.223893427 +0800
修改时间:2024-06-21 10:08:37.000000000 +0800
变更时间:2024-07-22 17:44:18.267396141 +0800
创建时间:2024-07-22 17:44:18.266396081 +0800
cm@thinkpad ~> LANG=C
fish: Unsupported use of '='. In fish, please use 'set LANG C'.
cm@thinkpad ~ [123]> set LANG C
cm@thinkpad ~ [123]> stat /usr/share/locale/zh_CN.UTF-8/LC_MESSAGES/nvim.mo
File: /usr/share/locale/zh_CN.UTF-8/LC_MESSAGES/nvim.mo
Size: 175201 Blocks: 344 IO Block: 4096 regular file
Device: 8,2 Inode: 1491639 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2024-07-23 18:28:56.223893427 +0800
Modify: 2024-06-21 10:08:37.000000000 +0800
Change: 2024-07-22 17:44:18.267396141 +0800
Birth: 2024-07-22 17:44:18.266396081 +0800but ‘strace -o /tmp/neovim.strace ‘
cm@thinkpad ~> set LANG C
cm@thinkpad ~> strace -o /tmp/neovim.strace
strace: must have PROG [ARGS] or -p PID
Try 'strace -h' for more information.
cm@thinkpad ~ [1]> # open nvim
cm@thinkpad ~ [1]> strace -p 9568 -o /tmp/neovim.strace
strace: attach: ptrace(PTRACE_SEIZE, 9568): Operation not permitted
cm@thinkpad ~ [1]> strace -p 9570 -o /tmp/neovim.strace
strace: attach: ptrace(PTRACE_SEIZE, 9570): Operation not permitted
cm@thinkpad ~ [1]>
cm@thinkpad ~ [1]> su
Password:
[root@thinkpad cm]# p
bash: p: command not found
[root@thinkpad cm]# strace -p 9568 -o /tmp/neovim.strace
strace: Can't fopen '/tmp/neovim.strace': Permission denied
[root@thinkpad cm]# strace -o /tmp/neovim.strace
strace: must have PROG [ARGS] or -p PID
Try 'strace -h' for more information.
[root@thinkpad cm]# strace -p 9570 -o /tmp/neovim.strace
strace: Can't fopen '/tmp/neovim.strace': Permission denied
[root@thinkpad cm]# Sorry, I may have misunderstood you. ![]()
Last edited by Ypixcm (2024-07-24 02:53:13)
My new name: RethLibc
Offline
I found that neovim only had the zh_CN.UTF-8.po translation file, but no zh_CN.po
So I only need to change export LANGUAGE=zh_CN:en_US to:
“zh_CN.UTF-8.po” is wrong, it should not carry the encoding ‘UTF-8’.
https://github.com/neovim/neovim/blob/m … N.UTF-8.po
https://github.com/neovim/neovim/blob/m … W.UTF-8.po
Last edited by Ypixcm (2024-07-24 06:12:24)
My new name: RethLibc
Offline
strace -o /tmp/neovim.strace neovimDo NOT "set LANG C" for this, we want to know what happens when nevim fails to use chinese.
The LANGUAGE variable isn't supposed to use those variants, "zh_CN" should™ do.
I'm not sure this has actually fixed anything.
Offline
@seth thank you
I've figured out that it's actually a Neovim bug.
“zh_CN.UTF-8.po” is wrong, it should not carry the encoding ‘UTF-8’.
https://github.com/neovim/neovim/blob/m … N.UTF-8.po
https://github.com/neovim/neovim/blob/m … W.UTF-8.po
The right name:
zh_CN.op
zh_TW.op
My new name: RethLibc
Offline
Pages: 1