Format the whole speed test dial for the locale (#6994)
The dial already grouped its digits for the locale above 10, but below 10 it went through toFixed, which hardcodes a dot. A German desktop therefore read 9.5 and 1.235 off the same dial, switching decimal convention halfway up the scale. Send both branches through the locale. A reading is a measurement rather than interface text, so its separators follow the system's number conventions even though the interface itself stays English. English output is unchanged. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
25bee1d2a3
commit
9f109a7f3e
@@ -369,7 +369,13 @@ PanelWindow {
|
||||
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
text: dial.reading < 10 ? dial.reading.toFixed(1) : Math.round(dial.reading).toLocaleString(Qt.locale(), 'f', 0)
|
||||
// Both branches go through the locale: a reading is a measurement, so
|
||||
// its separators follow the system's number conventions rather than the
|
||||
// interface language. toFixed would have hardcoded a dot below 10 while
|
||||
// everything above it was already grouped for the locale.
|
||||
text: dial.reading < 10
|
||||
? dial.reading.toLocaleString(Qt.locale(), 'f', 1)
|
||||
: Math.round(dial.reading).toLocaleString(Qt.locale(), 'f', 0)
|
||||
color: root.onScrim
|
||||
font.family: root.fontFamily
|
||||
font.pixelSize: Style.font.display
|
||||
|
||||
Reference in New Issue
Block a user