-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: main
Are you sure you want to change the base?
Conversation
26a0eee
to
644ea84
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
let mut split = locale_var_str.split(&['.', '@']); | ||
|
||
if let Some(simple) = split.next() { | ||
let bcp47 = simple.replace("_", "-"); |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
GNU testsuite comparison:
|
GNU testsuite comparison:
|
8ad5eb5
to
4b5b0d1
Compare
#[error("Unsupported non-utf8 argument passed to match: {}", _0.quote())] | ||
UnsupportedNonUtf8Match(String), |
There was a problem hiding this comment.
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.
let mut opts = CollatorOptions::default(); | ||
opts.alternate_handling = Some(AlternateHandling::Shifted); // This is black magic | ||
let _ = try_init_collator(opts); |
There was a problem hiding this comment.
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.
da3c388
to
9660754
Compare
GNU testsuite comparison:
|
There is a conflict :| |
bfb5cc6
to
7987ade
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
2b7d214
to
c0538f0
Compare
GNU testsuite comparison:
|
// 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") { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
- Add locale comparison test (issue uutils#5378) - Implement GNU expr-multibyte test
Replaces #7986
Internationalization of
expr
length
,substr
andindex
, which now supportmatch
can't be ported, as the regex engine we use (onig
) doesn't handle non UTF-8 input (someday we will Replace Oniguruma #1145)expr-multibyte.pl
pass at 75%, match tests are still missing. Seeexpr
is failing with multibyte chars #3132Additions to
uucore::i18n
decimal
module that allows one to access decimal and grouping separators etc...