// -*- C++ -*-
-* \file messages.h
-* This file is part of LyX, the document processor.
+/* \file messages.h
+ * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*/
#ifndef MESSAGES_H
#define MESSAGES_H
-#include "LString.h"
+#include "support/docstring.h"
-#include <locale>
+#include <map>
+#include <string>
+
+namespace lyx {
///
class Messages {
public:
+ /// messages in the language \p l.
+ /// If \p l is empty, the language will be defined by the environment.
+ Messages(std::string const & l = "");
///
- typedef std::messages<char>::catalog catalog;
- ///
- Messages(string const & l, string const & dir);
- ///
- ~Messages();
- ///
- string const get(string const & msg) const;
- ///
- string const & lang() const {
- return lang_;
- }
- ///
- string const & localedir() const {
- return localedir_;
- }
+ docstring const get(std::string const & msg) const;
private:
///
- string lang_;
+ std::string lang_;
///
- string localedir_;
- ///
- std::locale loc_gl;
- ///
- std::messages<char> const & mssg_gl;
- ///
- catalog cat_gl;
+ 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