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"
24 docstring const _(string const & str)
26 return getGuiMessages().get(str);
30 docstring const translateIfPossible(docstring const & name)
32 if (support::isAscii(name) && !name.empty())
33 // Probably from a standard configuration file, try to
35 return _(to_ascii(name));
37 // This must be from a user defined configuration file. We
38 // cannot translate this, since gettext accepts only ascii
44 docstring const translateIfPossible(docstring const & name, std::string const & language)
46 if (support::isAscii(name) && !name.empty())
47 // Probably from a standard configuration file, try to
49 return getMessages(language).get(to_ascii(name));
51 // This must be from a user defined configuration file. We
52 // cannot translate this, since gettext accepts only ascii