yuripv at yuripv.dev
Sun Jul 19 17:58:14 UTC 2020
Morten Bo Johansen via freebsd-questions wrote:
> (This is FreeBSD 12.1-RELEASE-p7 amd64)
> If I unset the $LANG variable, then all other LC_* category
> locale variables will automatically be set to "C" except for
> the $LC_ALL variable:
> ~/ % LANG= locale
> Otherwise they are:
> ~/ % locale
> I don't understand this behaviour. Could someone explain the
> logic of this to me?
> To me it seems like a bug.
I'm not sure what exactly you are asking, so I'll just quote the
for the logic used:
The values of locale categories shall be determined by a precedence
order; the first condition met below determines the value:
1. If the LC_ALL environment variable is defined and is not null, the
value of LC_ALL shall be used.
2. If the LC_* environment variable (LC_COLLATE, LC_CTYPE, LC_MESSAGES,
LC_MONETARY, LC_NUMERIC, LC_TIME) is defined and is not null, the value
of the environment variable shall be used to initialize the category
that corresponds to the environment variable.
3. If the LANG environment variable is defined and is not null, the
value of the LANG environment variable shall be used.
4. If the LANG environment variable is not set or is set to the empty
string, the implementation-defined default locale shall be used.
Going backwards, when you unset LANG, the last rule is applied, and our
default locale is C. If you have LANG set, rule 3 is applied . Rules 1
and 2 are mostly used as overrides over the system-wide LANG setting, so
LC_* variables are NOT set by default.
More information about the freebsd-questions