Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
localize.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <fc/variant.hpp>
4
5namespace sysio { namespace client { namespace localize {
6 #if !defined(_)
7 #define _(str) str
8 #endif
9
10 #define localized(str, ...) localized_with_variant((str), fc::mutable_variant_object() __VA_ARGS__ )
11
12 inline auto localized_with_variant( const char* raw_fmt, const fc::variant_object& args) {
13 if (raw_fmt != nullptr) {
14 try {
15 return fc::format_string(raw_fmt, args);
16 } catch (...) {
17 }
18 return std::string(raw_fmt);
19 }
20 return std::string();
21 }
22}}}
An order-preserving dictionary of variants.
fc::string format_string(const fc::string &, const variant_object &, bool minimize=false)
Definition variant.cpp:773
auto localized_with_variant(const char *raw_fmt, const fc::variant_object &args)
Definition localize.hpp:12