Skip to content

Support locale-aware numeric input without silently truncating decimal commas #17

Open

Description

@mkroemer

UI display formatting follows strings.locale, but numeric input parsing does not. This is a follow-up to #6 and is separate from the translation and optional-language bundling work.

Current behavior:

  • src/core/xlsx/editor.ts (parseInput) recognizes decimal dots only. With German UI/formatting (strings.locale = 'de-DE'), entering 1,5 in a spreadsheet cell stores text rather than the numeric value 1.5.
  • src/react/edit/Toolbar.tsx (SizeBox) uses parseFloat. An input such as 12,5 can silently become 12 instead of 12.5.
  • Translated labels and localized number display therefore do not imply localized input support.

Reproduce:

  1. Import the German table from @p10node/office-engine/locales/de and pass it as strings to an editable viewer.
  2. Enter 1,5 in a spreadsheet cell and inspect its saved type/value: it is text.
  3. Enter 12,5 in a font-size field and commit: the parser can truncate at the comma.

Expected behavior / acceptance criteria:

  • Parse numeric user input according to the active strings.locale (for example, 1,5 in de-DE and 1.5 in en-US both produce the numeric value 1.5).
  • Apply the same parsing rules consistently to spreadsheet numeric/percentage input and editable numeric controls such as font size.
  • Validate the entire input; reject invalid or ambiguous separators rather than silently accepting a prefix.
  • Define and document grouping-separator behavior, including locale-specific spaces, and distinguish grouping from decimal separators.
  • Preserve canonical OOXML numeric storage and formula syntax; changing the UI language must not reinterpret existing workbook values or rewrite stored formulas.
  • Cover decimal-dot/comma locales, percentages, grouping/ambiguity, invalid input, and saved-value round trips with focused tests.

Formula-entry localization (localized function names or argument separators) can be scoped separately; it should not be conflated with UI number parsing.

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