在OS X Yosemite上运行`locale -a`时,LANG和LC_ALL为空是否不好? [英] Is it bad that LANG and LC_ALL are empty when running `locale -a` on OS X Yosemite?

查看:128
本文介绍了在OS X Yosemite上运行`locale -a`时,LANG和LC_ALL为空是否不好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OS X Yosemite.

I use OS X Yosemite.

当我运行locale时,我得到了:

When I run locale I get this:

locale 
LANG= 
LC_COLLATE="C" 
LC_CTYPE="UTF-8" 
LC_MESSAGES="C" 
LC_MONETARY="C" 
LC_NUMERIC="C" 
LC_TIME="C" 
LC_ALL=

问题

LANGLC_ALL空度是不好/正常/喜欢吗?

Question

Is the emptiness of LANG and LC_ALL bad/normal/prefered?

通常,我不太在乎,但是我有个警告

Normally, I wouldn't care that much about it, but I've got a warning

(process:16182): Gtk-WARNING **: Locale not supported by C library.
        Using the fallback 'C' locale.

当我使用GTK时(人们一直在用多种语言解决此问题( Ubuntu ).

People have been struggling with this problem in many languages (Python for example) and different OS (Ubuntu for example).

重点是我找不到针对C语言和OS X的任何解决方案.

推荐答案

我猜GTK警告是因为GTK实际上正在尝试使用系统偏好设置中的Mac语言和语言环境设置来创建语言环境标识符字符串, setlocale()字符串,并被告知C库不支持该语言环境.结果,它默认为"C"语言环境.如果它没有试图找到更好的语言环境,则没有理由警告它正在使用"C"语言环境,因为这是在未设置LANGLC_ALL时所期望的.

I would guess that the GTK warning is because GTK is actually trying to use the Mac language and locale settings from System Preferences to make a locale identifier string, using that string with setlocale(), and being told that the C library doesn't support that locale. As a result, it's defaulting to the "C" locale. If it weren't trying to find a better locale, there would be little reason to warn that it's using the "C" locale because that's what would be expected when LANG and LC_ALL are unset.

OS X在高级框架(Cocoa等)中支持许多语言和语言环境,但在C库级别上并非所有语言和语言环境都受支持.系统偏好设置中的语言和语言环境设置是什么?您希望您的语言和语言环境使用什么语言环境标识符?看看是否在locale -a的输出中(或者类似地,在/usr/share/locale中是否有目录).

OS X has support for many languages and locales in the high-level frameworks (Cocoa, etc.), but not all of those are also supported at the level of the C library. What are the language and locale settings in System Preferences? What locale identifier would you expect for your language and locale? See if that's in the output from locale -a (or, similarly, if there's a directory for it in /usr/share/locale).

要检查的另一件事是终端的首选项.在设置"窗格的高级"选项卡下,是否设置了在启动时设置区域设置环境变量"?如果没有,那么默认情况下不会设置这些环境变量,这可能会解释您所看到的内容.如果启用了该设置,但您仍未获得这些环境变量,则表明Terminal无法找到与您的系统设置匹配的合适的C库语言环境.

Another thing to check is Terminal's preferences. On the Settings pane, under the Advanced tab, is "Set locale environment variables on startup" set? If not, then those environment variables won't be set by default, which might explain what you're seeing. If the setting is enabled but you're still not getting those environment variables, that suggests that Terminal was not able to find a suitable C-library locale that matches your system settings.

最后,您可以简单地尝试将LANG设置为要使用的内容.例如:

Finally, you can simply try setting LANG to what you want to use. For example:

export LANG=pl_PL.UTF-8

这篇关于在OS X Yosemite上运行`locale -a`时,LANG和LC_ALL为空是否不好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆