26 struct LocaleSwitch::Impl
28 explicit Impl(
const std::string &newLocale);
34 std::string m_OldLocale;
37 const std::string m_NewLocale;
40 LocaleSwitch::Impl::Impl(
const std::string &newLocale) : m_NewLocale(newLocale)
43 const char *currentLocale = std::setlocale(LC_ALL,
nullptr);
44 if (currentLocale !=
nullptr)
45 m_OldLocale = currentLocale;
50 if (m_NewLocale != m_OldLocale)
52 if (!std::setlocale(LC_ALL, m_NewLocale.c_str()))
54 MITK_INFO <<
"Could not switch to locale " << m_NewLocale;
60 LocaleSwitch::Impl::~Impl()
62 if (!m_OldLocale.empty() && m_OldLocale != m_NewLocale && !std::setlocale(LC_ALL, m_OldLocale.c_str()))
64 MITK_INFO <<
"Could not reset original locale " << m_OldLocale;
LocaleSwitch(const char *newLocale)
DataCollection - Class to facilitate loading/accessing structured data.