Set locale.

This commit is contained in:
tastytea 2021-08-23 20:39:01 +02:00
parent 8331b4211b
commit 6018672106
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <functional>
#include <future>
#include <iostream>
#include <locale>
#include <map>
#include <mutex>
#include <stdexcept>
@ -171,6 +172,8 @@ void print_weather()
return "#66ff66";
}()};
// NOTE: It is not possible to use local decimal separators and specify how
// many digits should be displayed after the separator. 🙁
std::cout << format(R"({0:s} <span color="{1:s}">{2:.1f}°C</span>{3:s})",
weather.icon, color, weather.temperature,
weather.old ? R"( <span color="red">⏳</span>)" : "")
@ -196,6 +199,7 @@ int main()
{
try
{
std::locale::global(std::locale(""));
// TODO: Implement clean shutdown.
std::atomic<bool> cancelled{false};
auto future{