22 struct LocaleSwitch::Impl
24 explicit Impl(
const std::string &newLocale);
30 std::string m_OldLocale;
33 const std::string m_NewLocale;
36 LocaleSwitch::Impl::Impl(
const std::string &newLocale) : m_NewLocale(newLocale)
39 const char *currentLocale = std::setlocale(LC_ALL,
nullptr);
40 if (currentLocale !=
nullptr)
41 m_OldLocale = currentLocale;
46 if (m_NewLocale != m_OldLocale)
48 if (!std::setlocale(LC_ALL, m_NewLocale.c_str()))
50 MITK_INFO <<
"Could not switch to locale " << m_NewLocale;
56 LocaleSwitch::Impl::~Impl()
58 if (!m_OldLocale.empty() && m_OldLocale != m_NewLocale && !std::setlocale(LC_ALL, m_OldLocale.c_str()))
60 MITK_INFO <<
"Could not reset original locale " << m_OldLocale;
LocaleSwitch(const char *newLocale)
DataCollection - Class to facilitate loading/accessing structured data.