mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-04 10:07:27 -05:00
6702048f91
Start moving wallet and ismine code to scriptpubkeyman.h, scriptpubkeyman.cpp The easiest way to review this commit is to run: git log -p -n1 --color-moved=dimmed_zebra And check that everything is a move (other than includes and copyrights comments). This commit is move-only and doesn't change code or affect behavior.
41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
// 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
|
|
|
|
#include <tinyformat.h>
|
|
#include <functional>
|
|
|
|
/**
|
|
* Bilingual messages:
|
|
* - in GUI: user's native language + untranslated (i.e. English)
|
|
* - in log and stderr: untranslated only
|
|
*/
|
|
struct bilingual_str {
|
|
std::string original;
|
|
std::string translated;
|
|
};
|
|
|
|
namespace tinyformat {
|
|
template <typename... Args>
|
|
bilingual_str format(const bilingual_str& fmt, const Args&... args)
|
|
{
|
|
return bilingual_str{format(fmt.original, args...), format(fmt.translated, args...)};
|
|
}
|
|
} // namespace tinyformat
|
|
|
|
/** 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 bilingual_str _(const char* psz)
|
|
{
|
|
return bilingual_str{psz, G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz};
|
|
}
|
|
|
|
#endif // BITCOIN_UTIL_TRANSLATION_H
|