From b4b5baef60c315dd0937772d9888cebdfe83be73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20La=C3=BCgt?= Date: Wed, 13 Nov 2019 13:08:47 +0100 Subject: [PATCH] Use overridden locale in ostream --- include/fmt/ostream.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 18ae820c6877e..046faae7aea90 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -89,9 +89,10 @@ void write(std::basic_ostream& os, buffer& buf) { } template -void format_value(buffer& buf, const T& value) { +void format_value(buffer& buf, const T& value, internal::locale_ref loc) { formatbuf format_buf(buf); std::basic_ostream output(&format_buf); + output.imbue(loc.get()); output.exceptions(std::ios_base::failbit | std::ios_base::badbit); output << value; buf.resize(buf.size()); @@ -104,7 +105,7 @@ struct fallback_formatter::value>> template auto format(const T& value, Context& ctx) -> decltype(ctx.out()) { basic_memory_buffer buffer; - format_value(buffer, value); + format_value(buffer, value, ctx.locale()); basic_string_view str(buffer.data(), buffer.size()); return formatter, Char>::format(str, ctx); }