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.
This commit is contained in:
parent
0dca432836
commit
a66d56aece
|
@ -5,8 +5,10 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <clocale>
|
#include <clocale>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <iomanip>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <sstream>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <shlobj.h> // for SHGetFolderPath
|
#include <shlobj.h> // for SHGetFolderPath
|
||||||
#endif
|
#endif
|
||||||
|
@ -406,7 +408,10 @@ std::string FormatSize(u64 bytes)
|
||||||
|
|
||||||
// Don't need exact values, only 5 most significant digits
|
// Don't need exact values, only 5 most significant digits
|
||||||
const double unit_size = std::pow(2, unit * 10);
|
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
|
} // namespace UICommon
|
||||||
|
|
Loading…
Reference in New Issue