mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-01 13:40:39 +00:00
12dbcf2ee1
* src/gettext.cpp (locale_init): factor some code; call Messages::init(). * LyX.cpp (exec): call Messages::init() after initializing package(). * Messages.cpp (init): new method, factor some code from get(). (get): change the method used to set the locale. Should be much more robust than it was (and simpler too). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19360 a592a061-630c-0410-9148-cb99ea01b6c8
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
// -*- C++ -*-
|
|
/* \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.
|
|
*/
|
|
|
|
#ifndef MESSAGES_H
|
|
#define MESSAGES_H
|
|
|
|
#include "support/docstring.h"
|
|
|
|
#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 = std::string());
|
|
///
|
|
docstring const get(std::string const & msg) const;
|
|
///
|
|
static void init();
|
|
private:
|
|
///
|
|
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_;
|
|
};
|
|
|
|
/// Access to the unique Messages object for the passed \p language.
|
|
/// Implementation is in LyX.cpp.
|
|
extern Messages & getMessages(std::string const & language);
|
|
/// Access to the unique Messages object used for GUI element.
|
|
/// Implementation is in LyX.cpp.
|
|
extern Messages & getGuiMessages();
|
|
|
|
} // namespace lyx
|
|
|
|
#endif
|