2003-05-19 21:08:58 +00:00
|
|
|
|
/**
|
2003-10-08 11:31:51 +00:00
|
|
|
|
* \file src/gettext.C
|
2003-05-19 21:08:58 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2003-05-19 21:08:58 +00:00
|
|
|
|
* \author Jean-Marc Lasgouttes
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-05-19 21:08:58 +00:00
|
|
|
|
*/
|
2001-03-08 14:22:43 +00:00
|
|
|
|
|
2000-10-11 21:06:43 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2003-09-05 16:31:30 +00:00
|
|
|
|
#include "gettext.h"
|
2003-04-24 22:09:46 +00:00
|
|
|
|
#include "messages.h"
|
|
|
|
|
|
|
|
|
|
|
2001-10-31 12:43:09 +00:00
|
|
|
|
#ifdef HAVE_LOCALE_H
|
|
|
|
|
# include <locale.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
|
2003-04-24 22:09:46 +00:00
|
|
|
|
namespace {
|
2000-10-11 21:06:43 +00:00
|
|
|
|
|
2003-04-27 22:11:45 +00:00
|
|
|
|
Messages & getLyXMessages()
|
|
|
|
|
{
|
|
|
|
|
static Messages lyx_messages;
|
|
|
|
|
|
|
|
|
|
return lyx_messages;
|
|
|
|
|
}
|
2001-12-18 03:30:35 +00:00
|
|
|
|
|
2003-04-24 22:09:46 +00:00
|
|
|
|
} // anon namespace
|
2001-06-12 16:42:07 +00:00
|
|
|
|
|
2000-10-11 21:06:43 +00:00
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
string const _(string const & str)
|
2000-10-11 21:06:43 +00:00
|
|
|
|
{
|
2003-04-27 22:11:45 +00:00
|
|
|
|
return getLyXMessages().get(str);
|
2001-03-08 14:22:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-04-24 22:09:46 +00:00
|
|
|
|
#ifdef ENABLE_NLS
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
|
void locale_init()
|
|
|
|
|
{
|
2003-04-24 22:09:46 +00:00
|
|
|
|
# ifdef HAVE_LC_MESSAGES
|
|
|
|
|
setlocale(LC_MESSAGES, "");
|
|
|
|
|
# endif
|
|
|
|
|
setlocale(LC_CTYPE, "");
|
2001-10-31 15:19:49 +00:00
|
|
|
|
setlocale(LC_NUMERIC, "C");
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-04-24 22:09:46 +00:00
|
|
|
|
#else // ENABLE_NLS
|
2001-12-18 03:30:35 +00:00
|
|
|
|
|
2003-04-24 22:09:46 +00:00
|
|
|
|
void locale_init()
|
2001-06-05 17:05:51 +00:00
|
|
|
|
{
|
2003-04-24 22:09:46 +00:00
|
|
|
|
setlocale(LC_NUMERIC, "C");
|
2001-06-05 17:05:51 +00:00
|
|
|
|
}
|
2003-04-24 22:09:46 +00:00
|
|
|
|
|
2000-10-12 02:17:32 +00:00
|
|
|
|
#endif
|