Right now Node.js (by omission) leaves it up to ICU to figure out the locale and configure itself accordingly.
That's problematic for a number of reasons, see e.g. #27856 (comment) - tl;dr environment variables affect the output of Date#toString(). Googling for variations of 'nodejs lc_all' suggests the issue pops up more often.
Since one of Node.js's goals is to provide a consistent experience across platforms and environments, I think it would be good to explicitly configure the locale at startup instead of leaving it to happenstance.
There are two ways to accomplish that and they're not mutually exclusive:
setenv("LC_ALL", "..."); setenv("LC_MESSAGES", "..."); // etc.
icu::Locale::setDefault(...)
I'm adding the semver-major label because there is some risk of breaking existing applications. (Libraries not so much since the average library already runs in a variety of environments.)
It would be good to have some discussion on the merits of both (and alternative?) approaches.
Right now Node.js (by omission) leaves it up to ICU to figure out the locale and configure itself accordingly.
That's problematic for a number of reasons, see e.g. #27856 (comment) - tl;dr environment variables affect the output of
Date#toString(). Googling for variations of 'nodejs lc_all' suggests the issue pops up more often.Since one of Node.js's goals is to provide a consistent experience across platforms and environments, I think it would be good to explicitly configure the locale at startup instead of leaving it to happenstance.
There are two ways to accomplish that and they're not mutually exclusive:
setenv("LC_ALL", "..."); setenv("LC_MESSAGES", "..."); // etc.icu::Locale::setDefault(...)I'm adding the semver-major label because there is some risk of breaking existing applications. (Libraries not so much since the average library already runs in a variety of environments.)
It would be good to have some discussion on the merits of both (and alternative?) approaches.