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

Audit era identifiers #6232

Closed
wants to merge 4 commits into from
Closed

Conversation

robertbastian
Copy link
Member

We're pretty inconsistent in what we accept, and what we return as era codes.

This PR does not change behaviour. It documents current behaviour and moves era identifiers into constants.

@sffc
Copy link
Member

sffc commented Mar 5, 2025

Should we wait for https://unicode-org.atlassian.net/browse/CLDR-18369 to be resolved? I guess it's harmless to document that status quo

@robertbastian
Copy link
Member Author

This documents the status quo. We should then clean this up independent of CLDR-18369

@nekevss
Copy link
Contributor

nekevss commented Mar 5, 2025

Is there a general plan to support ethiopic-amete-alem as an alias?

Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

I like having the constants, good idea.

What is and isn't an "alias" is precisely defined in https://tc39.es/proposal-intl-era-monthcode/#table-eras, we should use the same terminology.

/// Taisho (Japanese)
pub const TAISHO: Era = Era(tinystr!(16, "taisho"));

// output only?!
Copy link
Member

Choose a reason for hiding this comment

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

These should be accepted on input too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, hence the "?!", but I don't want to make changes in this PR.

/// ROC
pub const ROC: Era = Era(tinystr!(16, "roc"));

/// Alias for [`Self::AD`]
Copy link
Member

Choose a reason for hiding this comment

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

The aliases go the other way: the canonical TC39 ones are coptic/coptic-inverse, and BD/AD are aliases of them

https://tc39.es/proposal-intl-era-monthcode/#table-eras

Copy link
Member Author

Choose a reason for hiding this comment

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

I marked everything that wasn't documented but still accepted as an alias.

@robertbastian
Copy link
Member Author

What is and isn't an "alias" is precisely defined in https://tc39.es/proposal-intl-era-monthcode/#table-eras

More relevantly defined for us in
https://github.com/unicode-org/cldr/blob/37225829cd14a4097fec9a5a004a45b88f593583/common/supplemental/supplementalData.xml#L4534

Is there a general plan to support ethiopic-amete-alem as an alias?

It's not currently possible with our architecture, as we use 16-byte tinystrs, and that code is longer

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.

4 participants