7 #include <Poco/SharedPtr.h>
8 #include <Poco/Dynamic/Var.h>
16 typedef Poco::SharedPtr<Translator> Ptr;
26 template <
typename... Rest>
28 const std::string &key,
29 const Rest & ... rest)
31 std::vector<Poco::Dynamic::Var> tmp;
32 formatCollect(tmp, rest...);
34 return result.empty()? key : result;
42 template <
typename... Rest>
44 const std::string &key,
45 const std::string &def,
46 const Rest & ... rest)
48 std::vector<Poco::Dynamic::Var> tmp;
49 formatCollect(tmp, rest...);
51 return result.empty() ?
61 const std::string &key,
62 const std::string &def,
63 const std::vector<Poco::Dynamic::Var> &args)
66 return result.empty() ?
71 void prepareArg(std::vector<Poco::Dynamic::Var> &tmp,
const char *first)
73 tmp.push_back(std::string(first));
76 template <
typename Type>
77 void prepareArg(std::vector<Poco::Dynamic::Var> &tmp,
const Type &value)
82 void formatCollect(std::vector<Poco::Dynamic::Var> &)
86 template <
typename First,
typename... Rest>
87 void formatCollect(std::vector<Poco::Dynamic::Var> &tmp,
89 const Rest & ... rest)
91 prepareArg(tmp, first);
92 formatCollect(tmp, rest...);
99 const std::string &key,
100 const std::vector<Poco::Dynamic::Var> &args) = 0;
108 const std::string &def,
109 const std::vector<Poco::Dynamic::Var> &args)
const;
114 typedef Poco::SharedPtr<TranslatorFactory> Ptr;
124 const std::string &name =
"") = 0;
std::string format(const std::string &key, const std::string &def, const Rest &...rest)
Definition: Translator.h:43
Definition: Translator.h:112
std::string formatSure(const std::string &key, const Rest &...rest)
Definition: Translator.h:27
std::string vformat(const std::string &key, const std::string &def, const std::vector< Poco::Dynamic::Var > &args)
Definition: Translator.h:60
std::string formatFallback(const std::string &def, const std::vector< Poco::Dynamic::Var > &args) const
Definition: Translator.cpp:16
virtual std::string formatImpl(const std::string &key, const std::vector< Poco::Dynamic::Var > &args)=0
virtual Translator * create(const Locale &locale, const std::string &name="")=0
Definition: Translator.h:14