Skip to content

i18n: further work, expr support #8292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

RenjiSann
Copy link
Collaborator

@RenjiSann RenjiSann commented Jun 30, 2025

Replaces #7986

Internationalization of expr

Additions to uucore::i18n

  • Refactored the feature dependency tree to optimize compile times
  • Added a decimal module that allows one to access decimal and grouping separators etc...

@RenjiSann RenjiSann mentioned this pull request Jun 30, 2025
@RenjiSann RenjiSann force-pushed the collating branch 2 times, most recently from 26a0eee to 644ea84 Compare June 30, 2025 20:46
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/fmt/goal-option is no longer failing!

Copy link

github-actions bot commented Jul 1, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

Copy link

github-actions bot commented Jul 1, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

let mut split = locale_var_str.split(&['.', '@']);

if let Some(simple) = split.next() {
let bcp47 = simple.replace("_", "-");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment explaining what means bcp47 :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

Copy link

github-actions bot commented Jul 1, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

Copy link

github-actions bot commented Jul 2, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

@RenjiSann RenjiSann force-pushed the collating branch 3 times, most recently from 8ad5eb5 to 4b5b0d1 Compare July 4, 2025 00:48
@RenjiSann RenjiSann requested a review from sylvestre July 4, 2025 00:48
Comment on lines +59 to +61
#[error("Unsupported non-utf8 argument passed to match: {}", _0.quote())]
UnsupportedNonUtf8Match(String),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sylvestre This is a uutils only error at the moment. I am not sure whether adding an error like this or calling expect() at the problematic code path would be better.
Also, because I consider this a bit like an internal error, I didn't bother adding a translation. I will do it if you deem it necessary.

Comment on lines +16 to +25
let mut opts = CollatorOptions::default();
opts.alternate_handling = Some(AlternateHandling::Shifted); // This is black magic
let _ = try_init_collator(opts);
Copy link
Collaborator Author

@RenjiSann RenjiSann Jul 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, I don't exactly understand how the CollatorOptions affect the collating. I've just toyed with it until #5378 passed. That's why I said it's black magic.

@RenjiSann RenjiSann force-pushed the collating branch 2 times, most recently from da3c388 to 9660754 Compare July 4, 2025 01:22
Copy link

github-actions bot commented Jul 4, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@RenjiSann RenjiSann marked this pull request as ready for review July 4, 2025 03:13
@cakebaker
Copy link
Contributor

There is a conflict :|

@RenjiSann RenjiSann force-pushed the collating branch 2 times, most recently from bfb5cc6 to 7987ade Compare July 7, 2025 09:20
Copy link

github-actions bot commented Jul 7, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/tail-c is no longer failing!

Copy link

github-actions bot commented Jul 7, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@RenjiSann RenjiSann force-pushed the collating branch 2 times, most recently from 2b7d214 to c0538f0 Compare July 7, 2025 22:37
Copy link

github-actions bot commented Jul 7, 2025

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

// locale. Treat the special case of the given locale being "C"
// which becomes the default locale.
let encoding =
if (locale != DEFAULT_LOCALE || bcp47 == "C") && split.next() == Some("UTF-8") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think split.next() == Some("UTF-8") should be case-insensitive. At least GNU expr doesn't seem to care about it:

$ LC_ALL=de_CH.UTF-8 expr length äöü
3
$ LC_ALL=de_CH.utf-8 expr length äöü
3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I didn't think of that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

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.

3 participants