C.UTF-8和en_US.UTF-8语言环境有什么区别? [英] What is the difference between C.UTF-8 and en_US.UTF-8 locales?
问题描述
我正在将python应用程序从具有区域设置en_US.UTF-8的ubuntu服务器迁移到新的Debian服务器,该服务器默认已经设置了C.UTF-8。我试图了解是否会有影响,但无法在互联网上找到好的资源来了解两者之间的区别。
I'm migrating a python application from an ubuntu server with locale en_US.UTF-8 to a new debian server which comes with C.UTF-8 already set by default. I'm trying to understand if there would be any impact but couldn't find good resources on the internet to understand the difference between both.
推荐答案
通常 C
用于计算机, en_US
适用于说英语的美国用户(以及其他想要相同行为的人)。
In general C
is for computer, en_US
is for people in US who speak English (and other people who want the same behaviour).
计算机的 表示字符串有时会更加标准化(但仍使用英语),因此可以从其他程序读取程序的输出。使用 en_US
,可以改进字符串,可以改善字母顺序(也许是通过新的芝加哥风格规则等规则)。因此更加人性化,但可能不太稳定。注意:语言环境不仅用于字符串翻译,还用于排序规则(字母顺序,数字(例如千位分隔符),货币(我认为可以安全地预测$和2个十进制数字会保留),月份,星期几,等等。
The for computer means that the strings are sometime more standardized (but still in English), so an output of a program could be read from an other program. With en_US
, strings could be improved, alphabetic order could be improved (maybe by new rules of Chicago rules of style, etc.). So more user-friendly, but possibly less stable. Note: locales are not just for translation of strings, but also for collation (alphabetic order, numbers (e.g. thousand separator), currency (I think it is safe to predict that $ and 2 decimal digits will remain), months, day of weeks, etc.
在您的情况下,这只是两个语言环境的UTF-8版本。
In your case, it is just the UTF-8 version of both locales.
一般情况下没关系,我通常更喜欢en_US.UTF-8,但通常没关系,在您的情况下(服务器应用程序),它只应更改日志和错误消息(如果使用 locale.setlocale()
。您应在应用程序内部处理客户端语言环境。从其他程序读取的程序应在打开管道之前设置 C
,因此
In general it should not matter. I usually prefer en_US.UTF-8, but usually it doesn't matter, and in your case (server app), it should only change log and error messages (if you use locale.setlocale()
. You should handle client locales inside your app. Programs that read from other programs should set C
before opening the pipe, so it should not really matter.
如您所见,可能没关系。您也可以使用 POSIX
语言环境,也在Debian中定义。您可以使用 locale -a
获得已安装语言环境的列表。
As you see, probably it doesn't matter. You may also use POSIX
locale, also define in Debian. You get the list of installed locales with locale -a
.
注意: -优化将规定 C
/ CU TF-8
区域设置:不翻译文件( gettext
),并且使用简单的排序规则和数字格式规则,但这仅在服务器端可见
Note: Micro-optimization will prescribe C
/C.UTF-8
locale: no translation of files (gettext
), and simple rules on collation and number formatting, but this should visible only on server side.
这篇关于C.UTF-8和en_US.UTF-8语言环境有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!