Skip to content

Conversation

@lordeji
Copy link

@lordeji lordeji commented Jan 29, 2026

TL;DR

Fix #8922.


Implementation :

When creating the locale string, check in this order :
LC_ALL -> LC_MESSAGES -> LANG
According to the documentation on the precedence of each variable.

Important note : I did not include the LANGUAGE variable as it seems more specific to gettext and does not follow the the same pattern as the other variables (specify multiple languages).


Testing :

I'm using the devcontainer.
For completeness, here is the result of the locale command inside the container:

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

Built successfully with

cargo build

Ran tests with no error

cargo nextest run -p uucore -p coreutils --no-fail-fast

Tried all these combinations which output the correct language

[FRENCH OUTPUT]
$ LANG=fr_FR.UTF-8 ./target/debug/coreutils split --help
$ LC_MESSAGES=fr_FR.UTF-8 ./target/debug/coreutils split --help
$ LC_ALL=fr_FR.UTF-8 ./target/debug/coreutils split --help

$ LC_MESSAGES=fr_FR.UTF-8 LANG=en_US.UTF-8 ./target/debug/coreutils split --help
$ LC_ALL=fr_FR.UTF-8 LC_MESSAGES=en_US.UTF-8 ./target/debug/coreutils split --help
$ LC_ALL=fr_FR.UTF-8 LANG=en_US.UTF-8 ./target/debug/coreutils split --help


[ENGLISH OUTPUT]
$ LC_MESSAGES=en_US.UTF-8 LANG=fr_FR.UTF-8 ./target/debug/coreutils split --help
$ LC_ALL=en_US.UTF-8 LC_MESSAGES=fr_FR.UTF-8 ./target/debug/coreutils split --help
$ LC_ALL=en_US.UTF-8 LANG=fr_FR.UTF-8 ./target/debug/coreutils split --help

The order for checking is :
LC_ALL -> LC_MESSAGES -> LANG -> DEFAULT_LOCALE (fallback).
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/cut/cut. tests/cut/cut is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/expr/expr. tests/expr/expr is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/join/join. tests/join/join is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/uniq/uniq. tests/uniq/uniq is passing on 'main'. Maybe you have to rebase?

@sylvestre
Copy link
Contributor

It regressed a bunch of tests

@lordeji
Copy link
Author

lordeji commented Jan 30, 2026

@sylvestre Indeed, gonna install the github actions extensions and update the PR when the test are ok (so I won't waste actions and times).

By the way, do you think a workflow should be added ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

l10n: LC_ALL is ignored

2 participants