X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fgettext.C;h=f9163fcb34416c2d1b30b4cbbd377a18f53f0ad8;hb=31b56dac8042735f75229ad480b3e98531c181ff;hp=3c3c0e253f603feb292f528fd5d1049f359320b8;hpb=1e6f221aa50ade6c9807dccda2d14f3853f5517b;p=lyx.git diff --git a/src/gettext.C b/src/gettext.C index 3c3c0e253f..f9163fcb34 100644 --- a/src/gettext.C +++ b/src/gettext.C @@ -1,12 +1,33 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team. + * + * ====================================================== */ + #include #include "LString.h" -#include "gettext.h" #ifdef ENABLE_NLS +# if HAVE_GETTEXT +# include // use the header already in the system *EK* +# ifdef HAVE_LOCALE_H +# include // for LC_MESSAGES +# endif +# else +# include "../intl/libintl.h" +# endif + char const * _(char const * str) { + // I'd rather have an Assert on str, we should not allow + // null pointers here. Lgb + // Assert(str); if (str && str[0]) return gettext(str); else @@ -29,4 +50,29 @@ string const _(string const & str) return string(); } +void locale_init() +{ +# ifdef HAVE_LC_MESSAGES + setlocale(LC_MESSAGES, ""); + setlocale(LC_CTYPE, ""); + setlocale(LC_NUMERIC, "C"); +# endif +} + +void gettext_init(string const & localedir) +{ + bindtextdomain(PACKAGE, localedir.c_str()); + textdomain(PACKAGE); +} + + +#else // ENABLE_NLS + +void locale_init() +{ +} + +void gettext_init(string const &) +{ +} #endif