It seems like setlocale()
in C (at least on Linux) only works if the locale you’re trying to set it to is one of those listed in the output of locale -a
. Is this really true?
The reason I ask to confirm is that it seems like a potentially unpleasant restriction.
locale -a
. Yet in Java, by contrast, the list of available locales does not seem constrained by what’s installed in the OS (many languages’ and countries’ locales are available).This is because locale -a
merely lists the locales installed on the system. On Debian/Ubuntu based systems for example it looks for them under /usr/lib/locale
. If a locale does not exist on the system, then you won't be able to use it, neither via setlocale()
nor via any other means.