Repository navigation
Support the CLDR 49 ordinal day of month pattern field - #1383
Open
summeriver13 wants to merge 1 commit into
Open
summeriver13 wants to merge 1 commit into
summeriver13 wants to merge 1 commit into
Conversation
CLDR 49 uses the "ddd" field for ordinal days of the month, e.g. "Sept 13th"; parse_pattern() rejected it, so scripts/import_cldr.py could not import CLDR 49 data at all. "ddd" now formats the day with the locale's ordinal forms, keyed by the ordinal plural category, and falls back to a single "d" for locales that have none. Refs python-babel#1379
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scripts/import_cldr.pyaborts on the CLDR 49 data withValueError: Invalid length for field: 'ddd'(babel/dates.py:1809): CLDR 49 usesdddfor ordinal days of the month("Sept 13th"), which the
dfield did not accept.Changes
babel/dates.py: acceptdddfordand format the ordinal day picked byLocale.ordinal_form; locales without ordinal forms fall back to a singledas the CLDRspec prescribes, so the day is not zero-padded.
babel/core.py: newLocale.ordinal_day_formatsproperty (CLDR 49<dayOfMonth>patternsby ordinal plural category,
{0}replaced by the day).scripts/import_cldr.py: importdayOfMonthsfor the gregorian calendar(
dayOfMonthContext[@type="format"]/dayOfMonthWidth[@type="abbreviated"]), plus testsfor parsing, the ordinal output and the fallback.
Verification
uv run pytest -qon the pinned CLDR 48.2 data: 7875 passed, 10 skipped, 2 xfailed.ValueErrorfrom the issue.I left the second half of #1379 (
cldr-exemplars-deltaimport) to the maintainers.Disclosure: written with AI assistance; I reviewed the diff, ran the importer and the suite.