]> git.lyx.org Git - lyx.git/blobdiff - src/support/gettext.cpp
tiger support on mac snow leopard, include Qt4 frameworks, smart build script with...
[lyx.git] / src / support / gettext.cpp
index ce3a52da6dd58df5e320dc5e5d1f4e7a433de514..119c67b8ba129b6dfdf4a1b3cf6b653ea7f9711d 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author Jean-Marc Lasgouttes
  *
  * Full author contact details are available in file CREDITS.
@@ -20,8 +20,7 @@
 #  include <locale.h>
 #endif
 
-using std::string;
-
+using namespace std;
 
 namespace lyx {
 
@@ -46,7 +45,7 @@ void locale_init()
 
 docstring const translateIfPossible(docstring const & name)
 {
-       if (support::isAscii(name))
+       if (support::isAscii(name) && !name.empty())
                // Probably from a standard configuration file, try to
                // translate
                return _(to_ascii(name));
@@ -58,4 +57,18 @@ docstring const translateIfPossible(docstring const & name)
 }
 
 
+docstring const translateIfPossible(docstring const & name, std::string const & language)
+{
+       if (support::isAscii(name) && !name.empty())
+               // Probably from a standard configuration file, try to
+               // translate
+               return getMessages(language).get(to_ascii(name));
+       else
+               // This must be from a user defined configuration file. We
+               // cannot translate this, since gettext accepts only ascii
+               // keys.
+               return name;
+}
+
+
 } // namespace lyx