Skip to content

Commit adb7a73

Browse files
2 parents 9cf414d + 30e6f75 commit adb7a73

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/TerminalProgress/ProgressBar.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,13 @@ extension ProgressBar {
261261
private func adjustFormattedSize(_ size: String) -> String {
262262
// Ensure we always have one digit after the decimal point to prevent flickering.
263263
let zero = Int64(0).formattedSize()
264-
guard !size.contains("."), let first = size.first, first.isNumber || !size.contains(zero) else {
264+
let decimalSep = Locale.current.decimalSeparator ?? "."
265+
guard !size.contains(decimalSep), let first = size.first, first.isNumber || !size.contains(zero) else {
265266
return size
266267
}
267268
var size = size
268269
for unit in ["MB", "GB", "TB"] {
269-
size = size.replacingOccurrences(of: " \(unit)", with: ".0 \(unit)")
270+
size = size.replacingOccurrences(of: " \(unit)", with: "\(decimalSep)0 \(unit)")
270271
}
271272
return size
272273
}

0 commit comments

Comments
 (0)