X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fgettext.C;h=506178db8ca419480b8af0cf110d98705f0e0b1e;hb=cb52251ccff29d6cbfa13ab90a96be566e3f41ac;hp=49158949ce3a10148bbcccefc77478799881b80b;hpb=67ef45b7c842efd9c971112627109724564f0c74;p=lyx.git diff --git a/src/gettext.C b/src/gettext.C index 49158949ce..506178db8c 100644 --- a/src/gettext.C +++ b/src/gettext.C @@ -1,10 +1,29 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team. + * + * ====================================================== */ + #include +#ifdef HAVE_LOCALE_H +# include +#endif + #include "LString.h" -#include "gettext.h" #ifdef ENABLE_NLS +# if HAVE_GETTEXT +# include // use the header already in the system *EK* +# else +# include "../intl/libintl.h" +# endif + char const * _(char const * str) { // I'd rather have an Assert on str, we should not allow @@ -24,12 +43,38 @@ string const _(string const & str) char * tmp = new char[s + 1]; str.copy(tmp, s); tmp[s] = '\0'; - string ret(gettext(tmp)); + string const ret(gettext(tmp)); delete [] tmp; return ret; - } - else + } else { return string(); + } +} + +void locale_init() +{ +# ifdef HAVE_LC_MESSAGES + setlocale(LC_MESSAGES, ""); +# endif + setlocale(LC_CTYPE, ""); + setlocale(LC_NUMERIC, "C"); } +void gettext_init(string const & localedir) +{ + bindtextdomain(PACKAGE, localedir.c_str()); + textdomain(PACKAGE); +} + + +#else // ENABLE_NLS + +void locale_init() +{ + setlocale(LC_NUMERIC, "C"); +} + +void gettext_init(string const &) +{ +} #endif