mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
Separate CTranslationInterface from CClientUIInterface
This commit is contained in:
20
src/util.h
20
src/util.h
@@ -25,8 +25,17 @@
|
||||
#include <vector>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/signals2/signal.hpp>
|
||||
#include <boost/thread/exceptions.hpp>
|
||||
|
||||
/** Signals for translation. */
|
||||
class CTranslationInterface
|
||||
{
|
||||
public:
|
||||
/** Translate a message to the native language of the user. */
|
||||
boost::signals2::signal<std::string (const char* psz)> Translate;
|
||||
};
|
||||
|
||||
extern std::map<std::string, std::string> mapArgs;
|
||||
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
|
||||
extern bool fDebug;
|
||||
@@ -37,6 +46,17 @@ extern std::string strMiscWarning;
|
||||
extern bool fLogTimestamps;
|
||||
extern bool fLogIPs;
|
||||
extern volatile bool fReopenDebugLog;
|
||||
extern CTranslationInterface translationInterface;
|
||||
|
||||
/**
|
||||
* Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
|
||||
* If no translation slot is registered, nothing is returned, and simply return the input.
|
||||
*/
|
||||
inline std::string _(const char* psz)
|
||||
{
|
||||
boost::optional<std::string> rv = translationInterface.Translate(psz);
|
||||
return rv ? (*rv) : psz;
|
||||
}
|
||||
|
||||
void SetupEnvironment();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user