]> git.lyx.org Git - lyx.git/blob - src/messages.h
Fix 3188, update the labels at each Caption insertion.
[lyx.git] / src / messages.h
1 // -*- C++ -*-
2 /* \file messages.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #ifndef MESSAGES_H
12 #define MESSAGES_H
13
14 #include "support/docstring.h"
15
16 #include <map>
17 #include <string>
18
19 namespace lyx {
20
21 ///
22 class Messages {
23 public:
24         /// messages in the language \p l.
25         /// If \p l is empty, the language will be defined by the environment.
26         Messages(std::string const & l = "");
27         ///
28         docstring const get(std::string const & msg) const;
29 private:
30         ///
31         std::string lang_;
32         ///
33         typedef std::map<std::string, docstring> TranslationCache;
34         /// Internal cache for gettext translated strings.
35         /// This is needed for performance reason within \c updateLabels()
36         /// under Windows.
37         mutable TranslationCache cache_;
38 };
39
40 /// Access to the unique Messages object for the passed \p language.
41 /// Implementation is in lyx_main.C.
42 extern Messages & getMessages(std::string const & language);
43 /// Access to the unique Messages object used for GUI element.
44 /// Implementation is in lyx_main.C.
45 extern Messages & getGuiMessages();
46
47 } // namespace lyx
48
49 #endif