uttrflow / uttrflow/uttrflow-swift
Diagnostics timings ignore the locale's decimal separator, because MainFormatting.seconds uses String(format:)
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
`MainFormatting.seconds(_:)` (`Sources/UttrflowUX/MainPresentation.swift:228-232`) formats every timing on the Diagnostics page with `String(format: "%.2fs", value)`. `String(format:)` without a locale always uses a full stop as the decimal separator. Every other number formatter in the same enum takes a `Locale` (`bytes`, `percentage`, `compact`, `time`, lines 240-290), and the enum's doc comment (line 225) says that is the rule.
It is used for the Diagnostics headline and every stage row (`Sources/UttrflowUX/DiagnosticsPresentation.swift:276-277`, `:291`), including the copy that goes into Copy Diagnostics.
## Why it matters
In a region that writes decimals with a comma (Germany, France, most of Europe and Latin America), Diagnostics shows `1.25s` right beside percentages and byte counts that use `1,25`. A reader can take `1.250s` for 1,250 seconds.
## How to reproduce
Set System Settings, General, Language & Region to Germany, dictate once, and open Diagnostics. The timings use a full stop while the storage sizes use a comma. Or, headlessly, `MainFormatting.seconds(.milliseconds(1_250))` returns `"1.25s"` whatever `Locale.current` is (pinned by `Tests/UttrflowUXTests/MainPresentationTests.swift:182`).
## Acceptance criteria
- `seconds(_:locale:)` takes a `Locale` (defaulting to `.autoupdatingCurrent`, like `bytes`) and formats with two fraction digits in that locale, for example `value.formatted(.number.precision(.fractionLength(2)).locale(locale))`, then the unit.
- The "under 0.01s" floor and the `"0.00s"` literal in `DiagnosticsPresentation.swift:295` go through the same formatter.
- `MainFormattingTests.seconds` checks `en_US` (`1.25s`) and `de_DE` (`1,25s`).
## Where to start
- `Sources/UttrflowUX/MainPresentation.swift:228` and its callers in `DiagnosticsPresentation.swift`.
- Test: `Tests/UttrflowUXTests/MainPresentationTests.swift`, `MainFormattingTests`.
- Run `make verify`, and see `CONTRIBUTING.md`.
Size: small.
Contributor guide
Research direction
Start with MainFormatting.seconds in Sources/UttrflowUX/MainPresentation.swift and its callers in DiagnosticsPresentation.swift, then read MainFormattingTests in Tests/UttrflowUXTests/MainPresentationTests.swift. Done means locale-aware timing output, including the floor and Diagnostics literal, with en_US and de_DE coverage; run make verify.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, swift
- Domain
- desktop, localization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100