#ifndef MESSAGES_H
#define MESSAGES_H
-#include <boost/scoped_ptr.hpp>
+#include "support/docstring.h"
+
+#include <map>
#include <string>
+namespace lyx {
+
///
class Messages {
public:
- /// messages in the language defined by the environment
- Messages();
- /// messages in the language \p l
- Messages(std::string const & l);
+ /// messages in the language \p l.
+ /// If \p l is empty, the language will be defined by the environment.
+ Messages(std::string const & l = "");
///
- ~Messages();
- ///
- std::string const get(std::string const & msg) const;
+ docstring const get(std::string const & msg) const;
private:
- class Pimpl;
- boost::scoped_ptr<Pimpl> pimpl_;
+ ///
+ 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_;
};
+/// 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();
+
+} // namespace lyx
+
#endif