Skip to content

[diffs] fix pluralization of '0 unmodified lines'#694

Open
necolas wants to merge 1 commit into
mainfrom
nicolas/diffs-plural-fix
Open

[diffs] fix pluralization of '0 unmodified lines'#694
necolas wants to merge 1 commit into
mainfrom
nicolas/diffs-plural-fix

Conversation

@necolas
Copy link
Copy Markdown
Contributor

@necolas necolas commented May 18, 2026

Does what it says on the tin

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffshub Error Error May 18, 2026 7:26pm
pierre-docs-trees Ready Ready Preview May 18, 2026 7:26pm
pierrejs-diff-demo Ready Ready Preview May 18, 2026 7:26pm
pierrejs-docs Ready Ready Preview May 18, 2026 7:26pm

Request Review

@necolas necolas requested a review from amadeus May 18, 2026 19:26
@amadeus
Copy link
Copy Markdown
Member

amadeus commented May 18, 2026

Might be worth applying this on the beta instead of stable, since i don't think we'll do a stable release before 1.2 at this point

@SlexAxton
Copy link
Copy Markdown
Contributor

Might not be worth it, but the More Official™ to do this would be:

const enCardinalRules = new Intl.PluralRules("en-US"); // can cache this once

const pluralKey = enCardinalRules.select(lines);

if (pluralKey === 'one') {
  return `${lines} unmodified line`;
} else if (pluralKey === 'other') {
  return `${lines} unmodified lines`;
} else {
  throw new Error(`Unexpected plural key: ${pluralKey}`);
}

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.

3 participants