Open piegamesde opened 2 years ago
Oops! In C, you'd just pass NULL
into setlocale
, but our safe bindings prohibit that. For now, you can call gettext_sys::setlocale(category, std::ptr::null)
, but we should really change the safe wrapper to allow this (or just write a separate getter).
So I tried out gettext_sys::setlocale
for quering it, not sure which category I need to use. It returns "C" for LcAll
and "German_germany.1252" for LcCType
and LcMessages
on a Windows machine set to German.
(On Linux I get correct looking values so maybe this is not a bindings issue)
LcMessages
is the right category for this, see https://www.gnu.org/software/libc/manual/html_node/Locale-Categories.html. The returned value is a locale, whose format is described in https://www.gnu.org/software/libc/manual/html_node/Locale-Names.html. You need to extract the part before the first _
to get the language.
I need to find out the current language, how can I do that? I see
setlocale
, but no getter