]> git.lyx.org Git - lyx.git/blobdiff - src/gettext.C
do not create invalid .lyx files when importing \i{}, \j{}, \l{} or \L{}.
[lyx.git] / src / gettext.C
index ec1ea632521d3bcb71b921bfc3281cb502d0a160..55b2ef80821f79cd55665386522d35198d16868f 100644 (file)
 
 #include "gettext.h"
 #include "messages.h"
+
 #include "support/environment.h"
-#include "support/docstring.h"
+#include "support/lstrings.h"
+
+
+namespace lyx {
 
 #ifdef HAVE_LOCALE_H
 #  include <locale.h>
 #endif
 
-using lyx::support::setEnv;
-using lyx::docstring;
+using support::setEnv;
 
 using std::string;
 
 
 namespace {
 
-Messages & getLyXMessages()
+static Messages & getLyXMessages()
 {
        static Messages lyx_messages;
 
@@ -65,3 +68,20 @@ void locale_init()
 }
 
 #endif
+
+
+docstring const translateIfPossible(docstring const & name)
+{
+       if (support::isAscii(name))
+               // Probably from a standard configuration file, try to
+               // translate
+               return _(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