Skip to content

Commit

Permalink
pass arg as reference
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed May 23, 2021
1 parent 5207dd4 commit 69a0fe3
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions i18n/I18N.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,30 @@
namespace i2p {
namespace i18n {

inline std::string translate (std::string arg)
inline std::string translate (const std::string& arg)
{
switch (i2p::context.GetLanguage ())
{
case eEnglish: return i2p::i18n::english::GetString (arg);
case eRussian: return i2p::i18n::russian::GetString (arg);
default: return arg;
case eEnglish:
return i2p::i18n::english::GetString (arg);
case eRussian:
return i2p::i18n::russian::GetString (arg);
default:
return arg;
}
}

template<typename inttype>
std::string translate (std::string arg, inttype&& n)
std::string translate (const std::string& arg, inttype&& n)
{
switch (i2p::context.GetLanguage ())
{
case eEnglish: return i2p::i18n::english::GetPlural (arg, (int) n);
case eRussian: return i2p::i18n::russian::GetPlural (arg, (int) n);
default: return arg;
case eEnglish:
return i2p::i18n::english::GetPlural (arg, (int) n);
case eRussian:
return i2p::i18n::russian::GetPlural (arg, (int) n);
default:
return arg;
}
}

Expand Down

0 comments on commit 69a0fe3

Please sign in to comment.