fix: correct pluralization of call counts in usage UI#286
Open
fix: correct pluralization of call counts in usage UI#286
Conversation
Fixes grammar bugs where counts like "1 calls this month" were rendered instead of "1 call this month". Adds a shared pluralize() utility to console/src/lib/format.ts and applies it to all call-count strings in dashboard.tsx and models.tsx. Includes unit tests for the new helper.
channels-catalog.ts had its own local pluralize() with identical signature and implementation. Now imports from lib/format.ts instead. Also replaced the vacuous custom-plural test case (which passed a default- equivalent value) with an irregular plural to actually exercise the branch.
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.
Summary
callsregardless of count, producing copy like "1 calls this month" or "across 1 calls".pluralize(n, word, plural?)utility toconsole/src/lib/format.tsand replaced all affected strings.${models.length} model${...}) to use the new helper for consistency.Changes
console/src/lib/format.tspluralize()helperconsole/src/lib/format.test.tspluralize()console/src/routes/dashboard.tsxconsole/src/routes/models.tsxTest plan
pluralize(1, 'call')→"1 call"andpluralize(2, 'call')→"2 calls"viavitestunit tests