Skip to content

blog date locale: round-2 review leftovers (P3) #36

Description

@cverorg

From the round-2 review of #35 (mergeable, no P1/P2). English summary of the leftovers; the private lane report keeps the file:line receipts.

  1. Call-site guard has two blind spots (chrome-copy.test.mjs, the fmtDate(...) regex stops at the first ) and splits on ,): a nested comma in the second argument, or an explicit undefined third argument, both pass the guard while no language is actually passed. All 12 current call sites are the plain fmtDate(x, dateFormat, meta.lang) shape, so this only affects future edits; tightening means requiring the third argument to match \blang\b.
  2. A consequence the PR text does not name: a single-language site that declares a non-CJK lang but sets an explicit CJK format now gets the locale default (lang: en-US + cjk-md renders August 5, 2026 instead of 8月5日). This follows the ruling, so it is not a bug, but a live site with a template-default lang: en and CJK content would change on its next build; worth a note in the grammar text.
  3. The CJK gate reads the raw lang while Intl reads toBcp47(lang), and the two disagree on rare spellings: ja_JP + cjk-full renders CJK but ja_JP with no format renders English; jpn/zho/yue are "not CJK" for the gate while Intl's default still renders 2024年7月13日. None of these throw or render blank; they are malformed inputs, recorded for completeness.
  4. A site with no lang: but locales: starting with en-US still renders CJK dates by default — byte-identical to main and consistent with that page's existing <html lang="zh-Hant"> fallback, so not a regression of this PR. The real fix would infer a missing lang from locales[0], which also changes <html lang> and belongs to its own change.

None blocks a release.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions