]> git.lyx.org Git - features.git/commitdiff
gettext cleanup
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 8 Mar 2001 14:22:43 +0000 (14:22 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 8 Mar 2001 14:22:43 +0000 (14:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1715 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
INSTALL
src/ChangeLog
src/gettext.C
src/gettext.h
src/lyx_gui.C
src/main.C

index cd73f1e00b4a71017d4882b5dfaeb4a875b60f70..40968d173e949940fe7ecdebd574ff9a841917ff 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2001-03-08  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * INSTALL: remove mention of problem with gettext.
+
 2001-03-02  John Levon  <moz@compsoc.man.ac.uk>
 
        * configure.in:
diff --git a/INSTALL b/INSTALL
index ac82469ffea2d65c235ff2b160998fbf332ef155..30c7c6cb84d866d41e9088920b88a0c93d181d49 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -325,16 +325,6 @@ notify us.
     If you your version of gcc-c++ is > 2.96-69, you may not need to do
     this.
 
-  o If you have GNU gettext installed on your system (e.g. on linux),
-    you may get tons of warnings like:
-
-    bullet_forms.C:101: warning: passing `char *' to argument 1 of
-    `__builtin_constant_p(int)' lacks a cast
-
-    These are in harmless warnings caused by a bug in libintl.h, but
-    will be solved if you use --with-included-gettext when configuring
-    LyX.
-
   o It is possible to compile lyx with Tru64 Unix cxx compiler
     version 6.2, provided one uses
        CXX='cxx -std strict_ansi'
index a4c58c5e6dcd44a2bd27820074c5a98b14b407d8..4b3420b83069d207a077e4022c4026bda55efadc 100644 (file)
@@ -1,3 +1,15 @@
+2001-03-08  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * main.C (main): pass lyx_localedir to gettext_init().
+
+       * gettext.h: remove locale_init and gettext_init macros
+
+       * gettext.C (locale_init): new function
+       (gettext_init): new function
+
+       * lyx_gui.C (LyXGUI): use locale_init() instead of explicit
+       setlocale().
+
 2001-03-07  Edwin Leuven  <leuven@fee.uva.nl>
 
         * Moved credits to frontends:
index 49158949ce3a10148bbcccefc77478799881b80b..08a948e8f40d07dc416317f21ea084b9e41d1093 100644 (file)
@@ -1,9 +1,28 @@
+// -*- C++ -*-
+/* This file is part of
+ * ====================================================== 
+ * 
+ *           LyX, The Document Processor
+ *        
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-2001 The LyX Team.
+ *
+ * ====================================================== */
+
 #include <config.h>
 
+#ifdef ENABLE_NLS
+
 #include "LString.h"
-#include "gettext.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
 
 char const * _(char const * str)
 {
@@ -32,4 +51,20 @@ string const _(string const & str)
                return string();
 }
 
+void locale_init()
+{
+#  ifdef HAVE_LC_MESSAGES
+       setlocale(LC_MESSAGES, "");
+       setlocale(LC_CTYPE, "");
+       setlocale(LC_NUMERIC, "C");
+#  endif
+}
+
+void gettext_init(string const & localedir)
+{
+       bindtextdomain(PACKAGE, localedir.c_str()); 
+       textdomain(PACKAGE);
+}
+
+
 #endif
index 121e0428bd8bac87a6df35d0a55e2488cb047637..ebd358a739535c0e7af6b69a36b54a242f80db9d 100644 (file)
 
 #include "LString.h"
 
-#  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
-
+///
 char const * _(char const *);
-
+///
 string const _(string const &);
+///
+void locale_init();
+///
+void gettext_init(string const & localedir);
 
-//#  define _(str) gettext(str)
-#  define N_(str) (str)              // for detecting static strings
-
-#  ifdef HAVE_LC_MESSAGES
-                                // LC_TIME, LC_CTYPE, even LC_ALL
-#    define locale_init() { setlocale (LC_MESSAGES, ""); setlocale (LC_CTYPE, ""); setlocale(LC_NUMERIC, "C"); }
-#  else
-#    define locale_init()
-#  endif
-#  define gettext_init() { bindtextdomain (PACKAGE, lyx_localedir.c_str()); \
-       textdomain (PACKAGE); }
 #else
 ///
 #  define _(str) (str)
 ///
 #  define S_(str) (str)
 ///
-#  define N_(str) (str)
-///
 #  define locale_init()
 ///
-#  define gettext_init()
+#  define gettext_init(package, localedir)
+
 #endif
 
+#  define N_(str) (str)              // for detecting static strings
+
 #endif
index 306d8749e918fff0488e29fff4bea5f7c513f190..0880fdd93cb73bf9d6581d3956ef9ab63d7b916c 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 #include <cstdlib>
-#include <clocale>
 
 #ifdef __GNUG__
 #pragma implementation
@@ -103,7 +102,7 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
        fl_initialize(argc, argv, "LyX", cmdopt, num_res);
        // It appears that, in xforms >=0.89.5, fl_initialize()
        // calls setlocale() and ruins our LC_NUMERIC setting.
-       setlocale(LC_NUMERIC, "C");
+       locale_init();
        fl_get_app_resources(res, num_res);
 
        static const int geometryBitmask =
index 8d525321f078ff7677f61376690bafeb52cf74fa..770b5aedcaffc0a8a429aa495f9cd942ddf20be7 100644 (file)
@@ -30,8 +30,8 @@ int main(int argc, char * argv[])
                lyx_localedir = LOCALEDIR;
        
        // initialize for internationalized version *EK*
-       locale_init(); // macro
-       gettext_init(); // macro
+       locale_init(); 
+       gettext_init(lyx_localedir); 
 
 #ifdef __EMX__
        _wildcard(&argc, &argv);