-
Notifications
You must be signed in to change notification settings - Fork 184
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
Conversation
{ | ||
"input": { | ||
"type": "Locale", | ||
"identifier": "en-t-en-Latn-CA-emodeng" |
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.
please test uppercase variants
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.
Praise: Clean and simple solution
Huh, |
Sporadic failure. I requested a re-run. |
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.
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).
components/locid/src/langid.rs
Outdated
@@ -327,6 +327,38 @@ impl LanguageIdentifier { | |||
} | |||
Ok(()) | |||
} | |||
|
|||
pub(crate) fn for_each_subtag_str_lowercase<E, F>(&self, f: &mut F) -> Result<(), E> |
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.
can you document why we need this function here? Explain that tlang canonicalizes differently.
components/locid/src/langid.rs
Outdated
Ok(()) | ||
} | ||
|
||
pub(crate) fn write_to_lowercase<W: core::fmt::Write + ?Sized>( |
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.
same here.
let path = "./tests/fixtures/canonicalize.json"; | ||
let data = helpers::read_fixture(path).expect("Failed to read a fixture"); | ||
|
||
test_langid_fixtures(data); |
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.
thank you for turning this into data-driven test!
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? |
4a6c072
to
d630b1f
Compare
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.
lgtm!
Friendly ping to note that this can be merged now. |
Closes #1925
For simplicity I didn't add
write_to_lowercase
methods forScript
andRegion
, but let me know if that would be preferable.