]> git.lyx.org Git - lyx.git/blobdiff - src/messages.C
minimal effort implementation of:
[lyx.git] / src / messages.C
index 989bb9a0d0c5b84bd0b48d0948d2105cbe455be9..fbab556bcb1bb7cee401e5f2d8bf1663fd99089c 100644 (file)
@@ -90,14 +90,17 @@ public:
                : lang_(l)
        {
                if ( lang_.empty() ) {
-                       char const * lc_msgs = setlocale(LC_MESSAGES, NULL);
+                       char const * lc_msgs = 0;
+#ifdef HAVE_LC_MESSAGES
+                       lc_msgs = setlocale(LC_MESSAGES, NULL);
+#endif
                        lang_ = lc_msgs ? lc_msgs : "";
                }
                // strip off any encoding suffix, i.e., assume 8-bit po files
                string::size_type i = lang_.find(".");
                lang_ = lang_.substr(0, i);
                lyxerr[Debug::DEBUG] << BOOST_CURRENT_FUNCTION
-                                     << ": language(" << lang_ << ")" << std::endl;
+                                    << ": language(" << lang_ << ")" << std::endl;
        }
 
        ~Pimpl() {}
@@ -117,8 +120,9 @@ public:
                                        lang = "C";
                        }
                }
-               
+#ifdef HAVE_LC_MESSAGES
                char const * lc_msgs = setlocale(LC_MESSAGES, lang_.c_str());
+#endif
                // setlocale fails (returns NULL) if the corresponding locale
                // is not installed.
                // On windows (mingw) it always returns NULL.
@@ -141,11 +145,11 @@ public:
                int e = errno;
                if (e) {
                        lyxerr[Debug::DEBUG]
-                                << BOOST_CURRENT_FUNCTION << '\n'
-                                << "Error code: " << errno << '\n'
-                                << "Lang, mess: " << lang_ << " " << m << '\n'
-                                << "Directory : " << package().locale_dir() << '\n'
-                                << "Rtn value : " << c << std::endl;
+                               << BOOST_CURRENT_FUNCTION << '\n'
+                               << "Error code: " << errno << '\n'
+                               << "Lang, mess: " << lang_ << " " << m << '\n'
+                               << "Directory : " << package().locale_dir() << '\n'
+                               << "Rtn value : " << c << std::endl;
                }
                textdomain(PACKAGE);
                const char* msg = gettext(m.c_str());
@@ -164,7 +168,9 @@ public:
                boost::smatch sub;
                if (regex_match(translated, sub, reg))
                        translated = sub.str(1);
+#ifdef HAVE_LC_MESSAGES
                setlocale(LC_MESSAGES, lang.c_str());
+#endif
                setlocale(LC_CTYPE, oldCTYPE.c_str());
                return translated;
        }