Hi Ludovic, Ludovic Courtès writes:
> But anyway, I think we should just set “LC_ALL=en_US.utf8” in the > .service file: that’s what we do on Guix System, and the choice of a > locale doesn’t matter since ‘guix substitute’ honors the client’s > locale. That's what I did to my guix-daemon.service and guix-publish.service files on a foreign distro after getting locale warnings. > Meiyo Peng <[email protected]> skribis: > >> Ludovic Courtès writes: > > [...] > >>> Thus, I think ‘glibc-utf8-locales’ should provide that locale. >> >> And the zh_CN.UTF-8, zh_TW.UTF-8 please. > > ‘glibc-utf8-locales’ has always been described as an *arbitrary* sample > of UTF-8 locales (info "(guix) Application Setup"). Initially its main > purpose was to use it in build processes, but we’ve come to more or less > recommend it for users, which is not great because we know it only works > for some users. I was surprised last week (maybe the week before that) when I found out that glibc-utf8-locales only provides locales for de_DE, el_GR, en_US, fr_FR, tr_TR. And in our manual, we tell people to install glibc-utf8-locales after installing Guix on a foreign distro in order to solve locale problems. The name "glibc-utf8-locales" indicates it provides ALL UTF-8 locales while in fact it does not. This caused me a trouble because I have to set the locale of Emacs to zh_CN.UTF-8 in order to enable the ibus input method in Emacs. (This is a known problem of Emacs. Locale has to be set to one of CJK locale in order to enable external input methods.) Since the zh_CN.UTF-8 locale is not in $GUIX_LOCPATH, ibus does not work in Emacs. I ended up installing the "glibc-locales" package and solved the problem. > I built a ‘glibc-utf8-locales’ package that provides all the supported > UTF-8 locales, and only UTF-8 locales: > > --8<---------------cut here---------------start------------->8--- > $ guix size > /gnu/store/rh7iq1kwma7ir96mvzvqcg1v50yi05yp-glibc-utf8-locales-2.28 > store item total self > /gnu/store/rh7iq1kwma7ir96mvzvqcg1v50yi05yp-glibc-utf8-locales-2.28 855.7 > 855.7 100.0% > total: 855.7 MiB > $ ls -1d > /gnu/store/rh7iq1kwma7ir96mvzvqcg1v50yi05yp-glibc-utf8-locales-2.28/lib/locale/2.28/*.utf8 > |wc -l > 312 > $ guix size glibc-locales > store item total self > /gnu/store/acl2wxzzkkcjv74rlqswdf9p8pwddlmk-glibc-locales-2.28 916.7 > 916.7 100.0% > total: 916.7 MiB > --8<---------------cut here---------------end--------------->8--- > > As you can see, it’s almost the same size as ‘glibc-locales’, so there’s > no point in having such a ‘glibc-utf8-locales’ package. > > In Guix System, the (gnu system locale) module generates just the needed > locales. I’m thinking we should do the same at the ‘guix package’ > level. For example, ‘guix package --install-locales’ would > automatically install whatever $LANG or $LC_* refers to. > > Thoughts? I think it would be better to simply tell people to install the "glibc-locales" package. There may be a case where different applications are set to different locales. For example, my system is set to the en_US.UTF-8 locale but my Emacs is set to the zh_CN.UTF-8 locale. So $LC_* only refers to en_US.UTF-8 if guix tries to detect the locale. If ‘guix package --install-locales’ only install what $LANG or $LC_* refers to, zh_CN.UTF-8 won't be installed for me. We are unable to detect what locales a user will need later. Installing a full package like "glibc-locales" or letting the user explicitly specify what locales they need can avoid a lot of special problems. -- Meiyo Peng https://www.pengmeiyu.com/
