]> git.lyx.org Git - lyx.git/blobdiff - src/gettext.C
hopefully fix tex2lyx linking.
[lyx.git] / src / gettext.C
index 6165efb3fbb91e3938d5585a3137e2bab97f879c..925e433363d50ab80972a4c4c70d3f5df129db64 100644 (file)
@@ -1,28 +1,35 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file src/gettext.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Lars Gullik Bjønnes
+ * \author Jean-Marc Lasgouttes
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
+#include "gettext.h"
 #include "messages.h"
-#include "LString.h"
-#include "support/LAssert.h"
+#include "support/environment.h"
+
 
-#include <boost/scoped_ptr.hpp>
+namespace lyx {
 
 #ifdef HAVE_LOCALE_H
 #  include <locale.h>
 #endif
 
+using support::setEnv;
+
+using std::string;
+
+
 namespace {
 
-Messages & getLyXMessages()
+static Messages & getLyXMessages()
 {
        static Messages lyx_messages;
 
@@ -32,13 +39,7 @@ Messages & getLyXMessages()
 } // anon namespace
 
 
-char const * _(char const * str)
-{
-       return getLyXMessages().get(str).c_str();
-}
-
-
-string const _(string const & str)
+docstring const _(string const & str)
 {
        return getLyXMessages().get(str);
 }
@@ -48,6 +49,8 @@ string const _(string const & str)
 
 void locale_init()
 {
+       // Disable, as otherwise it overrides everything else incl. the doc language
+       setEnv("LANGUAGE", "");
 #  ifdef HAVE_LC_MESSAGES
        setlocale(LC_MESSAGES, "");
 #  endif
@@ -63,3 +66,6 @@ void locale_init()
 }
 
 #endif
+
+
+} // namespace lyx