From 7c45e14f2f682eddcc853c0f6051c7c8c6387289 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 28 Jun 2019 11:49:40 +0300 Subject: Add bilingual message type --- src/util/translation.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/util/translation.h b/src/util/translation.h index d709b26890..c70508c01e 100644 --- a/src/util/translation.h +++ b/src/util/translation.h @@ -5,6 +5,28 @@ #ifndef BITCOIN_UTIL_TRANSLATION_H #define BITCOIN_UTIL_TRANSLATION_H +#include + +#include + +/** + * 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 +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 G_TRANSLATION_FUN; -- cgit v1.2.3