Repository navigation
Fix CLDR pattern letters left in locale formats - #3370
Merged
Merged
Conversation
CLDR 48.2.2 es-PH: short = d/M/yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 fo-DK: short = dd.MM.yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 hr-BA: short = d. M. yy. Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 ms-BN: short = d/MM/yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 ms-SG: short = d/MM/yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 ne-IN: short = yy/M/d Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 nnh: short = dd/MM/yy, long = 'lyɛ'̌ʼ d 'na' MMMM, y Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 pa-Guru: short = d/M/yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 sr-Cyrl-BA: short = d. M. y. (2-digit year kept, see PR) Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 sr-Latn-BA: short = d. M. y. (2-digit year kept, see PR) Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 ta-MY: short = d/M/yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 ta-SG: short = d/M/yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 uz-Cyrl: short = dd/MM/yy Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 fur: long = d 'di' MMMM 'dal' y Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 ps: short = y/M/d Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
CLDR 48.2.2 seh: long = d 'de' MMMM 'de' y Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
Checks that no locale format or calendar format contains unescaped y or N (CLDR year/era letters, printed literally by isoFormat()), and checks the output of every format fixed in this branch. Refs briannesbitt#3368 Co-Authored-By: Claude Opus 5.5
kylekatarnls
approved these changes
Oct 2, 2026
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.
Fixes #3371
Problem
Some locale formats were copied from CLDR patterns without converting them to
isoFormat()tokens. In CLDR,yyis a 2-digit year anddis the day of the month. InisoFormat(),yyis not a token (so it's printed literally), anddis the day of the week:es_PHL30/9/yy30/9/26ne_INLLy/9/3(the leadingLis the macro bug fixed in #3369)26/9/30ps,ps_AFL2026/9/32026/9/30sehLL3 de Set de 202630 de Set de 2026fur,fur_ITLL30 3i setembar 3pm30. 9. 26 202630 di setembar dal 2026(Examples use 2026-09-30, a Wednesday.)
In
fur, the words "di" and "dal" weren't escaped, sod,aandlwere read as tokens.Changes
One commit per file. Each commit message cites the CLDR 48.2.2 pattern it was checked against (cldr-json,
cldr-dates-full/main//ca-gregorian.json ).es_PHLD/M/yyD/M/YYd/M/yyfo_DKLDD.MM.yyDD.MM.YYdd.MM.yyhr_BALD. M. yy.D. M. YY.d. M. yy.ms_BNLD/MM/yyD/MM/YYd/MM/yyms_SGLD/MM/yyD/MM/YYd/MM/yyne_INLyy/M/dYY/M/Dyy/M/dnnhLDD/MM/yyDD/MM/YYdd/MM/yynnhLLL,LLLL[lyɛ]̌ʼ d [na] MMMM…[lyɛ]̌ʼ D [na] MMMM…'lyɛ'̌ʼ d 'na' MMMM, ypa_GuruLD/M/yyD/M/YYd/M/yysr_Cyrl_BALD.M.yy.D.M.YY.d. M. y.sr_Latn_BALD.M.yy.D.M.YY.d. M. y.ta_MYLD/M/yyD/M/YYd/M/yyta_SGLD/M/yyD/M/YYd/M/yyuz_CyrlLDD/MM/yyDD/MM/YYdd/MM/yyfur_ITLL,LLL,LLLLDD di MMMM dal YYYY…DD [di] MMMM [dal] YYYY…d 'di' MMMM 'dal' ypsLYYYY/M/dYYYY/M/Dy/M/dsehLL,LLL,LLLLd [de] MMM…D [de] MMM…d 'de' MMM 'de' ysr_Cyrl_XK,sr_Latn_XK(inheriting from_BA),ps_AFandfurget the fix through their parent file.Only the token letters changed. Everything else in each format was left as it was, including zero-padding and separators. There's one exception: CLDR 48 now uses
d. M. y.(4-digit year, with spaces) forsr_*_BA. I kept the 2-digit year that the current format intends, so the only change isyy→YY. I can switch them toD. M. YYYY.if you'd prefer following current CLDR.Tests
New
tests/Language/LocaleFormatsTest.php:testFormatsHaveNoCldrOnlyLettersgoes through every locale and fails if a format (LT…llll) or calendar format has an unescapedyorN. Those are CLDR year/era letters and are printed literally today. Before this PR, it lists 15 locales.testCldrFormatsUseIsoTokenschecks the output of each fixed format.No existing expected value had to change. The full phpunit suite, phpstan and phpmd pass locally on PHP 8.4, and php-cs-fixer reports nothing for the changed files.
Notes
nnhLLL/LLLLstart with[, so they're also hit by the macro bug fixed in Fix first character after macro expansion in isoFormat() #3369. Their output is only fully right with both PRs, which is why the tests here only checknnhL.Authorsheader of the 3 files that have one (hr_BA,fur_IT,ps), following 5f0ac3b.This change was written with the help of Claude Code (AI). I reviewed the diff myself.
🤖 Generated with Claude Code