X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fgettext.C;h=1712961c45d324b6f501fd6f92d0133ac0781c16;hb=06f9f0ea08ddcf13e99ea02cff21471aa2020c9e;hp=f9163fcb34416c2d1b30b4cbbd377a18f53f0ad8;hpb=31b56dac8042735f75229ad480b3e98531c181ff;p=lyx.git diff --git a/src/gettext.C b/src/gettext.C index f9163fcb34..1712961c45 100644 --- a/src/gettext.C +++ b/src/gettext.C @@ -1,8 +1,8 @@ /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * @@ -10,15 +10,18 @@ #include +#ifdef HAVE_LOCALE_H +# include +#endif + #include "LString.h" +#include + #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 @@ -35,33 +38,34 @@ char const * _(char const * str) } -string const _(string const & str) +string const _(string const & str) { if (!str.empty()) { int const s = str.length(); - char * tmp = new char[s + 1]; - str.copy(tmp, s); + boost::scoped_array tmp(new char[s + 1]); + str.copy(tmp.get(), s); tmp[s] = '\0'; - string ret(gettext(tmp)); - delete [] tmp; + string const ret(gettext(tmp.get())); return ret; - } - else + } else { return string(); + } } + void locale_init() { # ifdef HAVE_LC_MESSAGES setlocale(LC_MESSAGES, ""); +# endif setlocale(LC_CTYPE, ""); setlocale(LC_NUMERIC, "C"); -# endif } + void gettext_init(string const & localedir) { - bindtextdomain(PACKAGE, localedir.c_str()); + bindtextdomain(PACKAGE, localedir.c_str()); textdomain(PACKAGE); } @@ -70,8 +74,10 @@ void gettext_init(string const & localedir) void locale_init() { + setlocale(LC_NUMERIC, "C"); } + void gettext_init(string const &) { }