Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13115957
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/src/util/translation.h b/src/util/translation.h
index 101939f102..8d0458ea0a 100644
--- a/src/util/translation.h
+++ b/src/util/translation.h
@@ -1,21 +1,42 @@
// 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>
+#include <utility>
+
+/**
+ * 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 std::string _(const char *psz) {
return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;
}
#endif // BITCOIN_UTIL_TRANSLATION_H
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Mar 2, 12:53 (18 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5176734
Default Alt Text
(1 KB)
Attached To
rSTAGING Bitcoin ABC staging
Event Timeline
Log In to Comment