]> git.lyx.org Git - features.git/commitdiff
make the code to avoid multiple warnings actually work
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 24 Feb 2007 22:54:19 +0000 (22:54 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 24 Feb 2007 22:54:19 +0000 (22:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17332 a592a061-630c-0410-9148-cb99ea01b6c8

src/messages.C
src/messages.h

index bb83e90dfc143fd87c4ccad1e0b7e54135b8fd3e..3a628fe9bfdd62ae6acf9a35d49f6b7422173c74 100644 (file)
@@ -60,7 +60,7 @@ using support::setEnv;
 
 // This version use the traditional gettext.
 Messages::Messages(string const & l)
-       : lang_(l)
+       : lang_(l), warned_(false)
 {
        if ( lang_.empty() ) {
                char const * lc_msgs = 0;
@@ -107,9 +107,8 @@ docstring const Messages::get(string const & m) const
        // Since this method gets called for every translatable
        // buffer string like e.g. "Figure:" we warn only once.
 #if !defined(_WIN32) && !defined(__CYGWIN__)
-       bool warned = false;
-       if (!warned && !lc_msgs) {
-               warned = true;
+       if (!warned_ && !lc_msgs) {
+               warned_ = true;
                lyxerr << "Locale " << lang_ << " could not be set" << endl;
        }
 #endif
index 166f4601d01b28d232e64e298d7ddf14d536bbf8..87ebb4025d0bc427b59d83ed89151d391469497f 100644 (file)
@@ -29,6 +29,8 @@ public:
 private:
        ///
        std::string lang_;
+       /// Did we warn about unavailable locale already? 
+       mutable bool warned_;
        ///
        typedef std::map<std::string, docstring> TranslationCache;
        /// Internal cache for gettext translated strings.