Bug 796989 - some date/time does not honor user locale

because now it looks for the user locale each time when it formats
datetime, I added Fixme comments.
This commit is contained in:
YOSHINO Yoshihito 2018-12-22 01:03:49 +01:00 committed by Frank H. Ellenberger
parent b2e4148d6e
commit 7f1a711567

View File

@ -428,7 +428,8 @@ GncDateTimeImpl::format(const char* format) const
std::stringstream ss;
//The stream destructor frees the facet, so it must be heap-allocated.
auto output_facet(new Facet(normalize_format(format).c_str()));
ss.imbue(std::locale(std::locale(), output_facet));
// FIXME Rather than imbueing a locale below we probably should set std::locale::global appropriately somewhere.
ss.imbue(std::locale(std::locale(""), output_facet));
ss << m_time;
return ss.str();
}
@ -439,8 +440,9 @@ GncDateTimeImpl::format_zulu(const char* format) const
using Facet = boost::posix_time::time_facet;
std::stringstream ss;
//The stream destructor frees the facet, so it must be heap-allocated.
auto output_facet(new Facet(normalize_format(format).c_str()));
ss.imbue(std::locale(std::locale(), output_facet));
auto output_facet(new Facet(normalize_format(format).c_str()));
// FIXME Rather than imbueing a locale below we probably should set std::locale::global appropriately somewhere.
ss.imbue(std::locale(std::locale(""), output_facet));
ss << m_time.utc_time();
return ss.str();
}
@ -499,7 +501,8 @@ GncDateImpl::format(const char* format) const
std::stringstream ss;
//The stream destructor frees the facet, so it must be heap-allocated.
auto output_facet(new Facet(normalize_format(format).c_str()));
ss.imbue(std::locale(std::locale(), output_facet));
// FIXME Rather than imbueing a locale below we probably should set std::locale::global appropriately somewhere.
ss.imbue(std::locale(std::locale(""), output_facet));
ss << m_greg;
return ss.str();
}