locales:修改默认时间格式

locales:修改默认时间格式

我需要更改 Debian Wheezy 系统上的默认时间格式。我正在关注如何。

我修改了相应的行/usr/share/i18n/locales/en_US

d_t_fmt "<U0025><U0059><U002D><U0025><U0062><U002D><U0025><U0064><U0020><U0020><U0025><U0054>"
d_fmt   "<U0025><U0059><U002D><U0025><U0062><U002D><U0025><U0064>"
t_fmt   "<U0025><U0054>"

然后,我运行了命令 ro 编译语言环境localedef -f UTF-8 -i en_US en_US.UTF-8

我的语言环境/etc/default/locale设置为 en_US.UTF-8 :

LANG=en_US.UTF-8
LC_COLLATE=C
LC_TIME="en_US.UTF-8"

但我没有看到我的更改有任何效果(即使在重新启动后)。我是不是少了一步?

更新:当我在详细模式下运行命令时,出现很多错误:

localedef -v -c -f UTF-8 -i custom custom.UTF-8

custom:34: non-symbolic character value should not be used
en_GB:50: non-symbolic character value should not be used
i18n:1756: non-symbolic character value should not be used
en_GB:59: non-symbolic character value should not be used
custom:40: non-symbolic character value should not be used
iso14651_t1:3: non-symbolic character value should not be used
iso14651_t1_common:6323: LC_COLLATE: symbol `pure-ta-zh' not known
translit_neutral:10: non-symbolic character value should not be used
translit_neutral:17: non-symbolic character value should not be used
LC_NAME: field `name_gen' not defined
LC_IDENTIFICATION: no identification for category `LC_MEASUREMENT'
LC_CTYPE: table for class "upper": 10634005407197270931 bytes
LC_CTYPE: table for class "lower": 10634005407197270931 bytes
LC_CTYPE: table for class "alpha": 10634005407197270931 bytes
LC_CTYPE: table for class "digit": 10634005407197270931 bytes
LC_CTYPE: table for class "xdigit": 10634005407197270931 bytes
LC_CTYPE: table for class "space": 10634005407197270931 bytes
LC_CTYPE: table for class "print": 10634005407197270931 bytes
LC_CTYPE: table for class "graph": 10634005407197270931 bytes
LC_CTYPE: table for class "blank": 10634005407197270931 bytes
LC_CTYPE: table for class "cntrl": 10634005407197270931 bytes
LC_CTYPE: table for class "punct": 10634005407197270931 bytes
LC_CTYPE: table for class "alnum": 10634005407197270931 bytes
LC_CTYPE: table for class "combining": 10634005407197270931 bytes
LC_CTYPE: table for class "combining_level3": 10634005407197270931 bytes
LC_CTYPE: table for map "toupper": 10634005407197270931 bytes
LC_CTYPE: table for map "tolower": 10634005407197270931 bytes
LC_CTYPE: table for map "totitle": 10634005407197270931 bytes
LC_CTYPE: table for width: 0 bytes

答案1

显示什么locale?如果它显示“LC_ALL”设置为一个值,那么您可能需要unset它。

unset LC_ALL

然后尝试:

export LANG="en_US.UTF-8"
export LC_COLLATE="C"
export LC_TIME="en_US.UTF-8"

如果有效,请将这些导出添加到您的~/.bashrc文件中。 (也许unset LC_ALL还有之前的命令)

LC_ALL
    This variable determines the values for all locale categories. The value of the LC_ALL environment variable has precedence over any of the other environment variables starting with LC_ (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) and the LANG environment variable. 

http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html

相关内容