2003-05-19 21:08:58 +00:00
|
|
|
/**
|
|
|
|
* \file gettext.C
|
|
|
|
* 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-05-19 21:08:58 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
|
|
|
* \author Jean-Marc Lasgouttes
|
2002-03-21 17:27:08 +00:00
|
|
|
*
|
2003-05-19 21:08:58 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
2001-03-08 14:22:43 +00:00
|
|
|
|
2000-10-11 21:06:43 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2003-04-24 22:09:46 +00:00
|
|
|
#include "messages.h"
|
|
|
|
#include "LString.h"
|
|
|
|
#include "support/LAssert.h"
|
|
|
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
2001-10-31 12:43:09 +00:00
|
|
|
#ifdef HAVE_LOCALE_H
|
|
|
|
# include <locale.h>
|
|
|
|
#endif
|
|
|
|
|
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
|