I use OS X Yosemite.
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=
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.
when I was using GTK
(here's a link to my previous quesiton on this).
People have been struggling with this problem in many languages (Python for example) and different OS (Ubuntu for example).
The point is I couldn't find any solution for C language and OS X.
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 whenLANG
andLC_ALL
are unset.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
).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.
Finally, you can simply try setting
LANG
to what you want to use. For example: