]> git.lyx.org Git - lyx.git/blobdiff - src/gettext.C
fix locale problem with --disable-nls
[lyx.git] / src / gettext.C
index 22a135152b6ef812f96d5752db6878aa8463b801..b80792ac22e2936744bc5a99bf3f0d485a9c91d4 100644 (file)
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /* This file is part of
  * ====================================================== 
  * 
 
 #include <config.h>
 
-#ifdef ENABLE_NLS
+#ifdef HAVE_LOCALE_H
+#  include <locale.h>
+#endif
 
 #include "LString.h"
 
+#ifdef ENABLE_NLS
+
 #  if HAVE_GETTEXT
 #    include <libintl.h>      // use the header already in the system *EK*
-#    ifdef HAVE_LOCALE_H
-#      include <locale.h>        // for LC_MESSAGES
-#    endif
 #  else
 #    include "../intl/libintl.h"
 #  endif
@@ -43,21 +43,21 @@ string const _(string const & str)
                char * tmp = new char[s + 1];
                str.copy(tmp, s);
                tmp[s] = '\0';
-               string ret(gettext(tmp));
+               string const ret(gettext(tmp));
                delete [] tmp;
                return ret;
-       }
-       else
+       } else {
                return string();
+       }
 }
 
 void locale_init()
 {
 #  ifdef HAVE_LC_MESSAGES
        setlocale(LC_MESSAGES, "");
+#  endif
        setlocale(LC_CTYPE, "");
        setlocale(LC_NUMERIC, "C");
-#  endif
 }
 
 void gettext_init(string const & localedir)
@@ -75,5 +75,6 @@ void locale_init()
 
 void gettext_init(string const &)
 {
+       setlocale(LC_NUMERIC, "C");
 }
 #endif