diff options
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/banman.cpp | 1 | ||||
-rw-r--r-- | src/bitcoin-cli.cpp | 4 | ||||
-rw-r--r-- | src/bitcoin-tx.cpp | 6 | ||||
-rw-r--r-- | src/bitcoin-wallet.cpp | 4 | ||||
-rw-r--r-- | src/bitcoind.cpp | 3 | ||||
-rw-r--r-- | src/httprpc.cpp | 9 | ||||
-rw-r--r-- | src/index/txindex.cpp | 1 | ||||
-rw-r--r-- | src/init.cpp | 24 | ||||
-rw-r--r-- | src/net.cpp | 3 | ||||
-rw-r--r-- | src/qt/main.cpp | 2 | ||||
-rw-r--r-- | src/qt/splashscreen.cpp | 1 | ||||
-rw-r--r-- | src/test/setup_common.cpp | 3 | ||||
-rw-r--r-- | src/timedata.cpp | 1 | ||||
-rw-r--r-- | src/txdb.cpp | 5 | ||||
-rw-r--r-- | src/util/error.cpp | 2 | ||||
-rw-r--r-- | src/util/system.cpp | 1 | ||||
-rw-r--r-- | src/util/system.h | 12 | ||||
-rw-r--r-- | src/util/translation.h | 20 | ||||
-rw-r--r-- | src/validation.cpp | 1 | ||||
-rw-r--r-- | src/wallet/db.cpp | 1 | ||||
-rw-r--r-- | src/wallet/init.cpp | 5 | ||||
-rw-r--r-- | src/wallet/load.cpp | 1 | ||||
-rw-r--r-- | src/wallet/rpcdump.cpp | 4 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 1 | ||||
-rw-r--r-- | src/warnings.cpp | 4 |
26 files changed, 81 insertions, 39 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 0ed412295f..0f05439227 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/banman.cpp b/src/banman.cpp index 47d64a8f31..c1f7c6f00c 100644 --- a/src/banman.cpp +++ b/src/banman.cpp @@ -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) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index d3419520a7..8ca985458d 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -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> diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp index 4d513deed8..89e2ab305b 100644 --- a/src/bitcoin-tx.cpp +++ b/src/bitcoin-tx.cpp @@ -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> diff --git a/src/bitcoin-wallet.cpp b/src/bitcoin-wallet.cpp index cbb4ea750c..a690e2facb 100644 --- a/src/bitcoin-wallet.cpp +++ b/src/bitcoin-wallet.cpp @@ -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; diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 77367d6bb8..ba021a5163 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -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; diff --git a/src/httprpc.cpp b/src/httprpc.cpp index c7a119440b..be39a5ed2e 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -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 diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 929b85bfb5..fd52590097 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -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> diff --git a/src/init.cpp b/src/init.cpp index 068b05286c..d5b50b5fc0 100644 --- a/src/init.cpp +++ b/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> diff --git a/src/net.cpp b/src/net.cpp index 7d11111b25..7a0bcafbf8 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -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> diff --git a/src/qt/main.cpp b/src/qt/main.cpp index 6a3c2249d1..999c434d23 100644 --- a/src/qt/main.cpp +++ b/src/qt/main.cpp @@ -4,6 +4,8 @@ #include <qt/bitcoin.h> +#include <util/translation.h> + #include <QCoreApplication> #include <functional> diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 98eeee1a47..b3ea3382dd 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -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> diff --git a/src/test/setup_common.cpp b/src/test/setup_common.cpp index 24c7d51898..de877fd167 100644 --- a/src/test/setup_common.cpp +++ b/src/test/setup_common.cpp @@ -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; diff --git a/src/timedata.cpp b/src/timedata.cpp index f4613eeec8..4974ad0a0a 100644 --- a/src/timedata.cpp +++ b/src/timedata.cpp @@ -12,6 +12,7 @@ #include <sync.h> #include <ui_interface.h> #include <util/system.h> +#include <util/translation.h> #include <warnings.h> diff --git a/src/txdb.cpp b/src/txdb.cpp index 90b92969b9..54b632f1ec 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -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> diff --git a/src/util/error.cpp b/src/util/error.cpp index 9331a92ad7..1b662d3700 100644 --- a/src/util/error.cpp +++ b/src/util/error.cpp @@ -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) { diff --git a/src/util/system.cpp b/src/util/system.cpp index 72b37b9187..2a069c554f 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -7,6 +7,7 @@ #include <chainparamsbase.h> #include <util/strencodings.h> +#include <util/translation.h> #include <stdarg.h> diff --git a/src/util/system.h b/src/util/system.h index dda9156488..66a9eb4612 100644 --- a/src/util/system.h +++ b/src/util/system.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(); diff --git a/src/util/translation.h b/src/util/translation.h new file mode 100644 index 0000000000..d709b26890 --- /dev/null +++ b/src/util/translation.h @@ -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 diff --git a/src/validation.cpp b/src/validation.cpp index f585bc7d2d..259127ec3f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -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> diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index b5f90deabd..e07ea9887c 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -6,6 +6,7 @@ #include <wallet/db.h> #include <util/strencodings.h> +#include <util/translation.h> #include <stdint.h> diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 4c327c77ae..a86da98d71 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -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: diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp index 54aa12dba8..1e9b166285 100644 --- a/src/wallet/load.cpp +++ b/src/wallet/load.cpp @@ -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) diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 7e973194d9..b820efc4d9 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -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> diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 452d4f7a6a..4681dc2d44 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -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> diff --git a/src/warnings.cpp b/src/warnings.cpp index 5542412a7f..2a81882583 100644 --- a/src/warnings.cpp +++ b/src/warnings.cpp @@ -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); |