Refactor out translation.h
This is a prerequisite for introducing bilingual error messages. Note: #includes are arranged by clang-format-diff.py script.
This commit is contained in:
parent
0626b8cbdf
commit
0b86e517ad
26 changed files with 81 additions and 39 deletions
|
@ -212,6 +212,7 @@ BITCOIN_CORE_H = \
|
|||
util/rbf.h \
|
||||
util/threadnames.h \
|
||||
util/time.h \
|
||||
util/translation.h \
|
||||
util/url.h \
|
||||
util/validation.h \
|
||||
validation.h \
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <ui_interface.h>
|
||||
#include <util/system.h>
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
|
||||
BanMan::BanMan(fs::path ban_file, CClientUIInterface* client_interface, int64_t default_ban_time)
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
#include <rpc/client.h>
|
||||
#include <rpc/protocol.h>
|
||||
#include <rpc/request.h>
|
||||
#include <util/system.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
#include <tuple>
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <univalue.h>
|
||||
#include <util/rbf.h>
|
||||
#include <util/system.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/rbf.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
#include <chainparams.h>
|
||||
#include <chainparamsbase.h>
|
||||
#include <logging.h>
|
||||
#include <util/system.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <wallet/wallettool.h>
|
||||
|
||||
#include <functional>
|
||||
#include <stdio.h>
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/threadnames.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
|
|
|
@ -5,19 +5,20 @@
|
|||
#include <httprpc.h>
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <crypto/hmac_sha256.h>
|
||||
#include <httpserver.h>
|
||||
#include <key_io.h>
|
||||
#include <rpc/protocol.h>
|
||||
#include <rpc/server.h>
|
||||
#include <sync.h>
|
||||
#include <util/system.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <walletinitinterface.h>
|
||||
#include <crypto/hmac_sha256.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp> // boost::trim
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <shutdown.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <validation.h>
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
|
24
src/init.cpp
24
src/init.cpp
|
@ -19,40 +19,42 @@
|
|||
#include <compat/sanity.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <fs.h>
|
||||
#include <httpserver.h>
|
||||
#include <httprpc.h>
|
||||
#include <httpserver.h>
|
||||
#include <index/blockfilterindex.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <index/txindex.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <key.h>
|
||||
#include <validation.h>
|
||||
#include <miner.h>
|
||||
#include <netbase.h>
|
||||
#include <net.h>
|
||||
#include <net_processing.h>
|
||||
#include <netbase.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/fees.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/settings.h>
|
||||
#include <rpc/server.h>
|
||||
#include <rpc/register.h>
|
||||
#include <rpc/blockchain.h>
|
||||
#include <rpc/register.h>
|
||||
#include <rpc/server.h>
|
||||
#include <rpc/util.h>
|
||||
#include <script/standard.h>
|
||||
#include <script/sigcache.h>
|
||||
#include <scheduler.h>
|
||||
#include <script/sigcache.h>
|
||||
#include <script/standard.h>
|
||||
#include <shutdown.h>
|
||||
#include <util/threadnames.h>
|
||||
#include <timedata.h>
|
||||
#include <torcontrol.h>
|
||||
#include <txdb.h>
|
||||
#include <txmempool.h>
|
||||
#include <torcontrol.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/system.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/system.h>
|
||||
#include <util/threadnames.h>
|
||||
#include <util/translation.h>
|
||||
#include <util/validation.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
#include <walletinitinterface.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -15,11 +15,12 @@
|
|||
#include <consensus/consensus.h>
|
||||
#include <crypto/common.h>
|
||||
#include <crypto/sha256.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <netbase.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <scheduler.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <string.h>
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include <qt/bitcoin.h>
|
||||
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <functional>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <interfaces/wallet.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <version.h>
|
||||
|
||||
#include <QApplication>
|
||||
|
|
|
@ -23,10 +23,13 @@
|
|||
#include <util/memory.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
#include <util/validation.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
FastRandomContext g_insecure_rand_ctx;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <sync.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <warnings.h>
|
||||
|
||||
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
|
||||
#include <txdb.h>
|
||||
|
||||
#include <random.h>
|
||||
#include <pow.h>
|
||||
#include <random.h>
|
||||
#include <shutdown.h>
|
||||
#include <ui_interface.h>
|
||||
#include <uint256.h>
|
||||
#include <util/system.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
#include <util/error.h>
|
||||
|
||||
#include <tinyformat.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
std::string TransactionErrorString(const TransactionError err)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <chainparamsbase.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
|
|
@ -40,18 +40,6 @@ int64_t GetStartupTime();
|
|||
|
||||
extern const char * const BITCOIN_CONF_FILENAME;
|
||||
|
||||
/** Translate a message to the native language of the user. */
|
||||
const extern std::function<std::string(const char*)> G_TRANSLATION_FUN;
|
||||
|
||||
/**
|
||||
* Translation function.
|
||||
* If no translation function is set, simply return the input.
|
||||
*/
|
||||
inline std::string _(const char* psz)
|
||||
{
|
||||
return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;
|
||||
}
|
||||
|
||||
void SetupEnvironment();
|
||||
bool SetupNetworking();
|
||||
|
||||
|
|
20
src/util/translation.h
Normal file
20
src/util/translation.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) 2019 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_UTIL_TRANSLATION_H
|
||||
#define BITCOIN_UTIL_TRANSLATION_H
|
||||
|
||||
/** Translate a message to the native language of the user. */
|
||||
const extern std::function<std::string(const char*)> G_TRANSLATION_FUN;
|
||||
|
||||
/**
|
||||
* Translation function.
|
||||
* If no translation function is set, simply return the input.
|
||||
*/
|
||||
inline std::string _(const char* psz)
|
||||
{
|
||||
return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;
|
||||
}
|
||||
|
||||
#endif // BITCOIN_UTIL_TRANSLATION_H
|
|
@ -41,6 +41,7 @@
|
|||
#include <util/rbf.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <util/validation.h>
|
||||
#include <validationinterface.h>
|
||||
#include <warnings.h>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <wallet/db.h>
|
||||
|
||||
#include <util/strencodings.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -7,11 +7,12 @@
|
|||
#include <interfaces/chain.h>
|
||||
#include <net.h>
|
||||
#include <outputtype.h>
|
||||
#include <util/system.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <walletinitinterface.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <wallet/walletutil.h>
|
||||
#include <walletinitinterface.h>
|
||||
|
||||
class WalletInit : public WalletInitInterface {
|
||||
public:
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <interfaces/chain.h>
|
||||
#include <scheduler.h>
|
||||
#include <util/system.h>
|
||||
#include <util/translation.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
bool VerifyWallets(interfaces::Chain& chain, const std::vector<std::string>& wallet_files)
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
#include <util/bip32.h>
|
||||
#include <util/system.h>
|
||||
#include <util/time.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#include <util/translation.h>
|
||||
#include <wallet/rpcwallet.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <tuple>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <util/fees.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/rbf.h>
|
||||
#include <util/translation.h>
|
||||
#include <util/validation.h>
|
||||
#include <validation.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <warnings.h>
|
||||
|
||||
#include <sync.h>
|
||||
#include <util/system.h>
|
||||
#include <warnings.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
static RecursiveMutex cs_warnings;
|
||||
static std::string strMiscWarning GUARDED_BY(cs_warnings);
|
||||
|
|
Loading…
Add table
Reference in a new issue