X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FMessages.h;h=eb14aacac59df53c166c149e43303e46e6aa72e9;hb=79cf3f5ec1088e7de988e889247ec300d42fb70b;hp=9ef8dc3ae9a0703516346eab43249bef6489dd56;hpb=a2e8cb758b70269da40d13d7b272d256a29a022a;p=lyx.git diff --git a/src/support/Messages.h b/src/support/Messages.h index 9ef8dc3ae9..eb14aacac5 100644 --- a/src/support/Messages.h +++ b/src/support/Messages.h @@ -21,33 +21,34 @@ 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); + /// Return the tranlation of message \c msg, or the original + /// string if no context was found. Context is always removed. docstring const get(std::string const & msg) const; - /// Is an (at least partial) translation of this language available? - bool available() const; /// - static void init(); + docstring const getIfFound(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 guiLanguage(std::string const & l) { gui_lang_ = l; } /// - static std::string const & defaultLanguage() { return main_lang_; } + static std::string const & guiLanguage() { return gui_lang_; } private: - /// - static void setDefaultLanguage(); - /// - static std::string main_lang_; + /// 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 TranslationCache; - /// Internal cache for gettext translated strings. - /// This is needed for performance reason within \c updateBuffer() - /// under Windows. - mutable TranslationCache cache_; + typedef std::map 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.