2003-04-23 18:47:21 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-04-23 20:44:53 +00:00
|
|
|
|
/* \file messages.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
2003-04-23 18:47:21 +00:00
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-04-23 18:47:21 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef MESSAGES_H
|
|
|
|
|
#define MESSAGES_H
|
|
|
|
|
|
2006-09-09 11:16:28 +00:00
|
|
|
|
#include "support/docstring.h"
|
|
|
|
|
|
2007-01-14 09:55:08 +00:00
|
|
|
|
#include <map>
|
2003-10-07 06:45:25 +00:00
|
|
|
|
#include <string>
|
2003-04-23 18:47:21 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-04-23 18:47:21 +00:00
|
|
|
|
///
|
|
|
|
|
class Messages {
|
|
|
|
|
public:
|
2007-01-14 09:55:08 +00:00
|
|
|
|
/// messages in the language \p l.
|
|
|
|
|
/// If \p l is empty, the language will be defined by the environment.
|
|
|
|
|
Messages(std::string const & l = "");
|
2003-04-23 18:47:21 +00:00
|
|
|
|
///
|
2007-01-14 09:55:08 +00:00
|
|
|
|
docstring const get(std::string const & msg) const;
|
2003-04-23 18:47:21 +00:00
|
|
|
|
private:
|
2007-01-14 09:55:08 +00:00
|
|
|
|
///
|
|
|
|
|
std::string lang_;
|
|
|
|
|
///
|
|
|
|
|
typedef std::map<std::string, docstring> TranslationCache;
|
|
|
|
|
/// Internal cache for gettext translated strings.
|
|
|
|
|
/// This is needed for performance reason within \c updateLabels()
|
|
|
|
|
/// under Windows.
|
|
|
|
|
mutable TranslationCache cache_;
|
2003-04-23 18:47:21 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-01-14 10:37:14 +00:00
|
|
|
|
/// Access to the unique Messages object for the passed \p language.
|
|
|
|
|
/// Implementation is in lyx_main.C.
|
|
|
|
|
extern Messages & getMessages(std::string const & language);
|
|
|
|
|
/// Access to the unique Messages object used for GUI element.
|
|
|
|
|
/// Implementation is in lyx_main.C.
|
|
|
|
|
extern Messages & getGuiMessages();
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2003-04-23 18:47:21 +00:00
|
|
|
|
#endif
|