From 179efb7a4634139f775c61be9a702112562d1027 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 28 Jan 2006 20:13:10 +0000 Subject: [PATCH] fix bug 2177 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10790 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/messages.C | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 8226045f6c..e08d16113c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2006-01-28 Georg Baum + + * messages.C (get): Only warn once if setlocale fails (bug 2177) + 2006-01-28 Martin Vermeer * text2.C (setCharFont): take inset's own font settings into account diff --git a/src/messages.C b/src/messages.C index 3baa83c3e4..989bb9a0d0 100644 --- a/src/messages.C +++ b/src/messages.C @@ -107,7 +107,6 @@ public: if (m.empty()) return m; - //string oldMSG = setlocale(LC_MESSAGES, NULL); // In this order, see support/filetools.C: string lang = getEnv("LC_ALL"); if (lang.empty()) { @@ -120,9 +119,17 @@ public: } char const * lc_msgs = setlocale(LC_MESSAGES, lang_.c_str()); + // setlocale fails (returns NULL) if the corresponding locale + // is not installed. + // On windows (mingw) it always returns NULL. + // Since this method gets called for every translatable + // buffer string like e.g. "Figure:" we warn only once. #ifndef _WIN32 - if (!lc_msgs) + static bool warned = false; + if (!warned && !lc_msgs) { + warned = true; lyxerr << "Locale " << lang_ << " could not be set" << std::endl; + } #endif // CTYPE controls what getmessage thinks what encoding the po file uses char const * lc_ctype = setlocale(LC_CTYPE, NULL); -- 2.39.2