Skip to content

fix(results): format the summary numbers for the user's locale - #3972

Merged
Chartman123 merged 1 commit into
mainfrom
fix/results-number-format
Nov 21, 2026
Merged

Chartman123 merged 1 commit into
mainfrom
fix/results-number-format

Conversation

@AndyScherzinger

@AndyScherzinger AndyScherzinger commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

The results summary printed its numbers as raw JavaScript numbers: the answer counts and percentages of the bars, the Borda scores and average rank of ranking questions, the counts, percentages and averages of grids, and the "No response" line of text answers. They always used Latin digits, a decimal point and a "%" glued to the number, whatever the user's language. A German user saw "2.3" and "50%" instead of "2,3" and "50 %", a Persian user Latin instead of Persian digits.

All of them are now formatted with Intl.NumberFormat for the user's locale (getCanonicalLocale()): counts as whole numbers with the locale's grouping, percentages with the locale's percent style, averages with one decimal. English output is unchanged except that counts of 1,000 and more get a thousands separator.

Found in the review of #3635, which formats its new scale figures the same way.

How to verify

Open the results summary of a form with a multiple choice, a ranking, a radio grid, a number grid and a short answer question that have answers. Set your language to German: the bars read "1 (25 %)", the average rank "2,5", grid averages "3,0". Set it to Persian (فارسی): all of them use Persian digits. In English the output is as before.

Checked: ESLint, Prettier, stylelint and the build pass, vue-tsc reports no new errors (107, same as main), and the formatters give 1,234 / 50%, 1.234 / 50 %, ۱٬۲۳۴ / ۵۰٪ for en-US / de-DE / fa-IR. Not yet checked on a live instance.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The results summary printed its counts, percentages, Borda scores and
averages as raw JavaScript numbers: toFixed(1) for the average rank and
grid averages, and a literal "%" after the percentages. They always used
Latin digits, a decimal point and the English percent placement,
whatever the user's language.

Format them with Intl.NumberFormat for the user's locale instead, keeping
one decimal for the averages and whole percentages.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@AndyScherzinger
AndyScherzinger force-pushed the fix/results-number-format branch from c8f914b to 39f4172 Compare November 21, 2026 10:59
@AndyScherzinger AndyScherzinger changed the title fix(results): format ranking and grid averages for the user's locale fix(results): format the summary numbers for the user's locale Nov 21, 2026
@Chartman123

Copy link
Copy Markdown
Collaborator

/backport to stable5.4

@backportbot backportbot Bot added the backport-request Pending backport by the backport-bot label Nov 21, 2026
@Chartman123
Chartman123 merged commit 1bf2717 into main Nov 21, 2026
43 checks passed
@Chartman123
Chartman123 deleted the fix/results-number-format branch November 21, 2026 11:23
@backportbot backportbot Bot removed the backport-request Pending backport by the backport-bot label Nov 21, 2026
@AndyScherzinger AndyScherzinger added this to the 5.5 milestone Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants