http://bugzilla.lyx.org/show_bug.cgi?id=2738
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21598
a592a061-630c-0410-9148-
cb99ea01b6c8
#include <algorithm>
#include <fstream>
+#include <locale>
using std::string;
using std::vector;
namespace {
-struct Sorter
+class Sorter
{
+public:
+#if !defined(USE_WCHAR_T) && defined(__GNUC__)
bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const {
return lhs.first < rhs.first;
}
+#else
+ Sorter() : loc_ok(true)
+ {
+ try {
+ loc_ = std::locale("");
+ } catch (...) {
+ loc_ok = false;
+ }
+ };
+
+ bool operator()(LanguagePair const & lhs,
+ LanguagePair const & rhs) const {
+ if (loc_ok)
+ return loc_(lhs.first, rhs.first);
+ else
+ return lhs.first < rhs.first;
+ }
+private:
+ std::locale loc_;
+ bool loc_ok;
+#endif
};