Skip to content

Node respects LANG env var, but not LC_TIME, LC_NUMERIC, LC_MONETARY, ... #23301

Description

@felixfbecker
  • Version: v10.10.0
  • Platform: Darwin Felix-MBP 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64

I live in non-English country, but have my OS language set to English. This is helpful for many reasons, for example error messages are easier to google, instructions are easier to follow and labels are usually shorter.
Despite a different language, I still otherwise have configured to use a non-English locale (e.g. use 24h time).

In Node, if compiled with full ICU or with NODE_ICU_DATA set, new Date().toLocaleString() returns 12h time format.
If I set the LANG env var to de-DE, I get 24h time. But that implies that the language should be German, which it should not, the language should be English.

But any Unix env vars for setting only the locale or specific parts of the locale, such as LC_TIME, LC_MONETARY etc are not respected. With LC_TIME=de_DE and without LANG set, Node still uses 12h format.

Node should respect these.

Reference: http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    i18n-apiIssues and PRs related to the i18n implementation.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions