Skip to content

fix: localize decimal separator - #2889

Open
xhon-pelushi wants to merge 1 commit into
nextcloud:mainfrom
xhon-pelushi:fix/tables-1570-localized-decimals
Open

fix: localize decimal separator#2889
xhon-pelushi wants to merge 1 commit into
nextcloud:mainfrom
xhon-pelushi:fix/tables-1570-localized-decimals

Conversation

@xhon-pelushi

Copy link
Copy Markdown

Use locale-aware decimal separators.

Fixes #1570

Test plan

  • Review diff against issue
  • Run project lint/tests if applicable

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the number-cell renderer in the Tables Vue frontend to format decimal values using the user’s current locale (e.g., comma as decimal separator in de_DE), addressing Issue #1570’s incorrect separator display.

Changes:

  • Switch number display formatting from toFixed() to locale-aware Intl.NumberFormat using the Nextcloud locale.
  • Add Cypress component coverage to verify locale-specific decimal separators and fixed decimal precision.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/shared/components/ncTable/partials/TableCellNumber.vue Formats displayed numeric values using a locale-aware formatter instead of a hardcoded . decimal separator.
cypress/component/TableCellNumber.cy.js Adds component tests validating localized decimal separator output and preserved decimal precision.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +46 to +51
const fractionDigits = Number(this.column?.numberDecimals ?? 0)
return new Intl.NumberFormat(getCanonicalLocale(), {
maximumFractionDigits: fractionDigits,
minimumFractionDigits: fractionDigits,
useGrouping: false,
}).format(this.value)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — clamped numberDecimals to the 0..20 integer range Intl.NumberFormat accepts (via Math.trunc + min/max) so out-of-range values no longer throw RangeError when rendering. Added a Cypress case for an oversized decimal count.

Fixes nextcloud#1570

Clamp fraction digits to the 0..20 range accepted by Intl.NumberFormat so
out-of-range column settings cannot throw RangeError while rendering.

Signed-off-by: xhon-pelushi <xhon@pelushi.com>
@xhon-pelushi
xhon-pelushi force-pushed the fix/tables-1570-localized-decimals branch from 6d33a0c to aec7e1f Compare August 14, 2026 03:49
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.

Localization of decimal separator

2 participants