make the code to avoid multiple warnings actually work

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17332 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2007-02-24 22:54:19 +00:00
parent b555834103
commit 883e83c8e0
2 changed files with 5 additions and 4 deletions

View 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

View 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.