Host: Re-introduce plural translation support

This commit is contained in:
Stenzek
2024-05-13 01:46:45 +10:00
parent a2abcc9bb3
commit f3aec0c965
13 changed files with 230 additions and 150 deletions

View File

@ -178,6 +178,23 @@ s32 Host::Internal::GetTranslatedStringImpl(std::string_view context, std::strin
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::LoadSettings(SettingsInterface& si, std::unique_lock<std::mutex>& lock)
{
}