From a66d56aece307431337fba99acdbe27602430eb6 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 1 Apr 2018 12:26:50 +0200 Subject: [PATCH] Use configured locale in UICommon::FormatSize StringFromFormat always uses the C locale, so we can't use it if we want the decimal separator to be locale aware, but we can use a stringstream. --- Source/Core/UICommon/UICommon.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index 783a3c94eb..f761313add 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -5,8 +5,10 @@ #include #include #include +#include #include #include +#include #ifdef _WIN32 #include // for SHGetFolderPath #endif @@ -406,7 +408,10 @@ std::string FormatSize(u64 bytes) // Don't need exact values, only 5 most significant digits const double unit_size = std::pow(2, unit * 10); - return StringFromFormat("%.2f %s", bytes / unit_size, GetStringT(unit_symbols[unit]).c_str()); + std::stringstream ss; + ss << std::fixed << std::setprecision(2); + ss << bytes / unit_size << ' ' << GetStringT(unit_symbols[unit]); + return ss.str(); } } // namespace UICommon