> 1) Is it correct to use a static object? In particular, there are no > modifications of the locale in LyX initialization? > 2) Would it make sense to have it as a non-static member of the class, or is > it expensive to build?
its easy to make it nonstatic member and i dont think its expensive. see modified patch. > 3) We have a std::locale object in the Messages class, would it make sense > to use that instead of building a new one? this object as well as the code using <locale> is inside #if 0 other suggestions ? pavel
Index: frontends/controllers/frontend_helpers.cpp =================================================================== --- frontends/controllers/frontend_helpers.cpp (revision 18749) +++ frontends/controllers/frontend_helpers.cpp (working copy) @@ -42,6 +42,7 @@ #include <boost/cregex.hpp> #include <fstream> +#include <locale> using std::string; using std::vector; using std::pair; @@ -1105,10 +1106,13 @@ LanguagePair, bool> { public: + Sorter() : loc("") {}; bool operator()(LanguagePair const & lhs, LanguagePair const & rhs) const { - return lhs.first < rhs.first; + return loc(lhs.first,rhs.first); } +private: + std::locale loc; }; } // namespace anon