Host: Add plural translation support

Backport of f3aec0c965
This commit is contained in:
Stenzek
2024-05-15 08:11:44 +10:00
committed by Connor McLaughlin
parent 3a0b26225d
commit cfecbf53aa
17 changed files with 3351 additions and 3032 deletions

View File

@@ -191,6 +191,23 @@ s32 Host::Internal::GetTranslatedStringImpl(
return static_cast<s32>(msg.size());
}
std::string Host::TranslatePluralToString(const char* context, const char* msg, const char* disambiguation, int count)
{
TinyString count_str = TinyString::from_format("{}", count);
std::string ret(msg);
for (;;)
{
std::string::size_type pos = ret.find("%n");
if (pos == std::string::npos)
break;
ret.replace(pos, pos + 2, count_str.view());
}
return ret;
}
void Host::OnAchievementsLoginRequested(Achievements::LoginRequestReason reason)
{
}