Closed amano-kenji closed 6 months ago
I don't know if there is something Janet should do here besides expose setlocale
- we don't do anything to set or unset locales from environment variables, so if your OS or libc is not doing it, then Janet isn't doing it either.
Add os/setlocale
as a very bare bones wrapper around setlocale. I spent some time trying to make thread local setlocale work, but each platform has it's own way of doing it and it was hard to make it consistent.
Example with os/strftime
:
(os/setlocale (os/getenv "LC_ALL" "C")) # call at script start
(print (os/strftime "%A %c" (os/time)))
Thread local?
%a
ofos/strftime
can change according to locale.Setting locale through environment variables like
LANG
andLC_ALL
doesn't work.Even though my system uses glibc,
os/strftime
doesn't respect environment variables.