Skip to content

sort: Introduce locale-aware month sorting #8421

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 3 commits into
base: main
Choose a base branch
from

Conversation

RenjiSann
Copy link
Collaborator

This PR adds support for locale-aware month-sorting.

Note: There is a known discrepancy between icu and GNU locale regarding the french abbreviated month name of april in french (avril vs avr.). There is a patch in build-gnu.sh to account for this

Copy link

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/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)

Copy link

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)


match response.payload.get() {
MonthNames::Linear(months) => Some(months.iter().map(ToString::to_string).collect()),
_ => todo!("unsupported"),
Copy link
Contributor

Choose a reason for hiding this comment

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

please add a comment detailing what should happen here

}

pub fn locale_abbr_month_names() -> Option<&'static [String]> {
static DECIMAL_SEP: OnceLock<Option<Vec<String>>> = OnceLock::new();
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry but what means DECIMAL_SEP in this context?

# to the abbreviated month of april in the French locale:
# GNU is 'avril'
# ICU is 'avr.'
# sed -i -e 's|\(LC_ALL=$LOC locale abmon 2>/dev/null\)|\1 \| sed s/avril/avr./|' tests/sort/sort-month.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

why commented ?

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.

2 participants