]> git.lyx.org Git - lyx.git/blobdiff - src/messages.C
Change to use preffered calling of Boost.Function
[lyx.git] / src / messages.C
index 18b30d06058780727e90aadb445705c1e09cb250..d1aa3f52217c77a1bf95f0b17ca5c69bf9dd223e 100644 (file)
@@ -4,37 +4,27 @@
  *
  * \author Lars Gullik Bjønnes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "messages.h"
-#include "debug.h"
 #include "support/filetools.h"
+#include "support/path_defines.h"
 
+using lyx::support::GetEnvPath;
+using lyx::support::lyx_localedir;
 
-#ifdef ENABLE_NLS
-
-namespace {
+using std::string;
 
-string const & getLocaleDir()
-{
-       static string locale_dir;
 
-       if (locale_dir.empty()) {
-               locale_dir = GetEnvPath("LYX_LOCALEDIR");
-               if (locale_dir.empty())
-                       locale_dir = LOCALEDIR;
-       }
-       return locale_dir;
-}
+#ifdef ENABLE_NLS
 
-} // anon namespace
 
 #if 0
 
-#include <locale>
+-#include <locale>
 
 // This version of the Pimpl utilizes the message capability of
 // libstdc++ that is distributed with GNU G++.
@@ -50,7 +40,7 @@ public:
                //lyxerr << "Messages: language(" << l
                //       << ") in dir(" << dir << ")" << std::endl;
 
-               cat_gl = mssg_gl.open(PACKAGE, loc_gl, getLocaleDir().c_str());
+               cat_gl = mssg_gl.open(PACKAGE, loc_gl, lyx_localedir().c_str());
 
        }
 
@@ -94,8 +84,6 @@ public:
                //lyxerr << "Messages: language(" << l
                //       << ") in dir(" << dir << ")" << std::endl;
 
-             bindtextdomain(PACKAGE, getLocaleDir().c_str());
-             textdomain(PACKAGE);
        }
 
        ~Pimpl() {}
@@ -107,6 +95,8 @@ public:
 
                char * old = strdup(setlocale(LC_ALL, 0));
                char * n = setlocale(LC_ALL, lang_.c_str());
+               bindtextdomain(PACKAGE, lyx_localedir().c_str());
+               textdomain(PACKAGE);
                const char* msg = gettext(m.c_str());
                setlocale(LC_ALL, old);
                free(old);