]> git.lyx.org Git - lyx.git/blobdiff - src/support/Messages.h
Improve quotation mark opening/closing guess
[lyx.git] / src / support / Messages.h
index cb6af76e924ec3da72cf46d072407057b778ce7b..dd24e1c5fccc29b8fba98c90d9f43d9bc26ead6f 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -21,32 +21,42 @@ namespace lyx {
 ///
 class Messages {
 public:
+       /// dummy instantiation: no translation is done
+       Messages() {}
        /// messages in the language \p l.
-       /// If \p l is empty, the language will be defined by the environment.
-       Messages(std::string const & l = std::string());
+       Messages(std::string const & l);
        ///
        docstring const get(std::string const & msg) const;
+       /// What is the language associated with this translation?
+       std::string language() const;
+       /// Is an (at least partial) translation of language with code \p c available?
+       static bool available(std::string const & c);
        ///
-       static void init();
+       static void guiLanguage(std::string const & l) { gui_lang_ = l; }
+       ///
+       static std::string const & guiLanguage() { return gui_lang_; }
+
 private:
+       /// Read the strings from the .mo file. Returns true on success.
+       bool readMoFile();
        ///
        std::string lang_;
-       /// Did we warn about unavailable locale already?
-       mutable bool warned_;
        ///
-       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_;
+       typedef std::map<std::string, docstring> TranslationMap;
+       TranslationMap trans_map_;
+       /// The language used by the Gui
+       static std::string gui_lang_;
 };
 
 /// Access to the unique Messages object for the passed \p language.
 /// Implementation is in LyX.cpp.
-extern Messages & getMessages(std::string const & language);
+extern Messages const & getMessages(std::string const & language);
 /// Access to the unique Messages object used for GUI element.
 /// Implementation is in LyX.cpp.
-extern Messages & getGuiMessages();
+extern Messages const & getGuiMessages();
+
+/// Remove the context suffix from \p trans
+extern void cleanTranslation(docstring & trans);
 
 } // namespace lyx