]> git.lyx.org Git - lyx.git/blobdiff - src/support/Messages.cpp
Fix samba related crashes
[lyx.git] / src / support / Messages.cpp
index b578c53dc53131ab4d5ce3e5b2e7901d896b3d57..58dcb729b39f8cfc0dd7f46d5a547c590da91afb 100644 (file)
@@ -14,6 +14,7 @@
 #include "support/debug.h"
 #include "support/docstring.h"
 #include "support/environment.h"
+#include "support/lstrings.h"
 #include "support/Package.h"
 #include "support/unicode.h"
 
@@ -105,7 +106,7 @@ void Messages::init()
        int e = errno;
        if (e) {
                LYXERR(Debug::LOCALE, "Error code: " << errno << '\n'
-                       << "Directory : " << package().locale_dir().absFilename() << '\n'
+                       << "Directory : " << package().locale_dir().absFileName() << '\n'
                        << "Rtn value : " << c);
        }
 
@@ -121,6 +122,14 @@ void Messages::init()
 }
 
 
+bool Messages::available() const
+{
+       string const test = languageTestString();
+       string const trans = to_utf8(get(test));
+       return !trans.empty() && trans != test;
+}
+
+
 docstring const Messages::get(string const & m) const
 {
        if (m.empty())
@@ -159,9 +168,10 @@ docstring const Messages::get(string const & m) const
        char const * m_c = m.c_str();
        char const * trans_c = gettext(m_c);
        docstring trans;
-       if (!trans_c)
-               LYXERR(Debug::LOCALE, "Undefined result from gettext");
-       else if (trans_c == m_c) {
+       if (!trans_c) {
+               LYXERR(Debug::LOCALE, "Undefined result from gettext for `" << m << "'.");
+               trans = from_ascii(m);
+       } else if (trans_c == m_c) {
                //LYXERR(Debug::LOCALE, "Same as entered returned");
                trans = from_ascii(m);
        } else {
@@ -204,7 +214,7 @@ docstring const Messages::get(string const & m) const
 
 namespace lyx {
 
-Messages::Messages(string const & l) {}
+Messages::Messages(string const & /* l */) {}
 
 void Messages::init()
 {
@@ -218,6 +228,12 @@ docstring const Messages::get(string const & m) const
        return trans;
 }
 
+
+bool Messages::available() const
+{
+       return false;
+}
+
 } // namespace lyx
 
 #endif