]> git.lyx.org Git - lyx.git/blob - src/support/Messages.h
add toFilesystemEncoding for --binary-dir argument
[lyx.git] / src / support / 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 = std::string());
27         ///
28         docstring const get(std::string const & msg) const;
29         /// What is the language associated with this translation?
30         std::string language() const;
31         /// Is an (at least partial) translation of language with code \p c available?
32         static bool available(std::string const & c);
33         ///
34         static void guiLanguage(std::string const & l) { gui_lang_ = l; }
35         ///
36         static std::string const & guiLanguage() { return gui_lang_; }
37
38 private:
39         /// Read the strings from the .mo file. Returns true on success.
40         bool readMoFile();
41         ///
42         std::string lang_;
43         ///
44         typedef std::map<std::string, docstring> TranslationMap;
45         TranslationMap trans_map_;
46         /// The language used by the Gui
47         static std::string gui_lang_;
48 };
49
50 /// Access to the unique Messages object for the passed \p language.
51 /// Implementation is in LyX.cpp.
52 extern Messages const & getMessages(std::string const & language);
53 /// Access to the unique Messages object used for GUI element.
54 /// Implementation is in LyX.cpp.
55 extern Messages const & getGuiMessages();
56
57 /// Remove the context suffix from \p trans
58 extern void cleanTranslation(docstring & trans);
59
60 } // namespace lyx
61
62 #endif