2 * \file src/gettext.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
9 * Full author contact details are available in file CREDITS.
14 #include "support/gettext.h"
16 #include "support/lstrings.h"
17 #include "support/Messages.h"
18 #include "support/Package.h"
28 docstring const _(string const & str)
30 return getGuiMessages().get(str);
37 # ifdef HAVE_LC_MESSAGES
38 setlocale(LC_MESSAGES, "");
40 setlocale(LC_CTYPE, "");
43 setlocale(LC_NUMERIC, "C");
47 docstring const translateIfPossible(docstring const & name)
49 if (support::isAscii(name) && !name.empty())
50 // Probably from a standard configuration file, try to
52 return _(to_ascii(name));
54 // This must be from a user defined configuration file. We
55 // cannot translate this, since gettext accepts only ascii
61 docstring const translateIfPossible(docstring const & name, std::string const & language)
63 if (support::isAscii(name) && !name.empty())
64 // Probably from a standard configuration file, try to
66 return getMessages(language).get(to_ascii(name));
68 // This must be from a user defined configuration file. We
69 // cannot translate this, since gettext accepts only ascii