Skip to content
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

Canonicalize tlangs to lowercase #4134

Merged
merged 4 commits into from
Oct 14, 2023
Merged

Conversation

jedel1043
Copy link
Contributor

Closes #1925

For simplicity I didn't add write_to_lowercase methods for Script and Region, but let me know if that would be preferable.

@jedel1043 jedel1043 added the C-locale Component: Locale identifiers, BCP47 label Oct 7, 2023
@jedel1043 jedel1043 removed the C-locale Component: Locale identifiers, BCP47 label Oct 7, 2023
{
"input": {
"type": "Locale",
"identifier": "en-t-en-Latn-CA-emodeng"
Copy link
Member

Choose a reason for hiding this comment

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

please test uppercase variants

sffc
sffc previously approved these changes Oct 9, 2023
Copy link
Member

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Praise: Clean and simple solution

sffc
sffc previously approved these changes Oct 9, 2023
@jedel1043
Copy link
Contributor Author

Huh, error: failed to build archive: No space left on device (os error 28). Is this a sporadic fail?

@sffc
Copy link
Member

sffc commented Oct 9, 2023

Huh, error: failed to build archive: No space left on device (os error 28). Is this a sporadic fail?

Sporadic failure. I requested a re-run.

robertbastian
robertbastian previously approved these changes Oct 9, 2023
Copy link
Member

@zbraniecki zbraniecki left a comment

Choose a reason for hiding this comment

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

looks good and less invasive than I was worried it would be. Please, add the documentation to help readers understand why we need it (with examples).

@@ -327,6 +327,38 @@ impl LanguageIdentifier {
}
Ok(())
}

pub(crate) fn for_each_subtag_str_lowercase<E, F>(&self, f: &mut F) -> Result<(), E>
Copy link
Member

Choose a reason for hiding this comment

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

can you document why we need this function here? Explain that tlang canonicalizes differently.

Ok(())
}

pub(crate) fn write_to_lowercase<W: core::fmt::Write + ?Sized>(
Copy link
Member

Choose a reason for hiding this comment

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

same here.

let path = "./tests/fixtures/canonicalize.json";
let data = helpers::read_fixture(path).expect("Failed to read a fixture");

test_langid_fixtures(data);
Copy link
Member

Choose a reason for hiding this comment

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

thank you for turning this into data-driven test!

@jedel1043
Copy link
Contributor Author

The error seems to be similar to myoung34/docker-github-actions-runner#322, so maybe the container just needs to be removed to free its storage?

@jedel1043 jedel1043 dismissed stale reviews from robertbastian and sffc via 4a6c072 October 9, 2023 23:09
Copy link
Member

@zbraniecki zbraniecki left a comment

Choose a reason for hiding this comment

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

lgtm!

@jedel1043
Copy link
Contributor Author

Friendly ping to note that this can be merged now.

@sffc sffc merged commit c8f45ed into unicode-org:main Oct 14, 2023
26 checks passed
@jedel1043 jedel1043 deleted the lowercase-tlangs branch October 14, 2023 05:13
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.

Locale not canonicalizing tlangs to lowercase
4 participants