Browse Source

pass arg as reference

pull/1659/head
orignal 4 years ago
parent
commit
69a0fe3040
  1. 22
      i18n/I18N.h

22
i18n/I18N.h

@ -15,24 +15,30 @@
namespace i2p { namespace i2p {
namespace i18n { namespace i18n {
inline std::string translate (std::string arg) inline std::string translate (const std::string& arg)
{ {
switch (i2p::context.GetLanguage ()) switch (i2p::context.GetLanguage ())
{ {
case eEnglish: return i2p::i18n::english::GetString (arg); case eEnglish:
case eRussian: return i2p::i18n::russian::GetString (arg); return i2p::i18n::english::GetString (arg);
default: return arg; case eRussian:
return i2p::i18n::russian::GetString (arg);
default:
return arg;
} }
} }
template<typename inttype> template<typename inttype>
std::string translate (std::string arg, inttype&& n) std::string translate (const std::string& arg, inttype&& n)
{ {
switch (i2p::context.GetLanguage ()) switch (i2p::context.GetLanguage ())
{ {
case eEnglish: return i2p::i18n::english::GetPlural (arg, (int) n); case eEnglish:
case eRussian: return i2p::i18n::russian::GetPlural (arg, (int) n); return i2p::i18n::english::GetPlural (arg, (int) n);
default: return arg; case eRussian:
return i2p::i18n::russian::GetPlural (arg, (int) n);
default:
return arg;
} }
} }

Loading…
Cancel
Save