Host: Add TranslatePluralToSmallString()
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/heap_array.h"
|
||||
#include "common/small_string.h"
|
||||
#include "common/types.h"
|
||||
|
||||
#include <ctime>
|
||||
@ -62,6 +63,7 @@ std::string TranslateToString(std::string_view context, std::string_view msg);
|
||||
|
||||
/// Returns a localized version of the specified string within the specified context, adjusting for plurals using %n.
|
||||
std::string TranslatePluralToString(const char* context, const char* msg, const char* disambiguation, int count);
|
||||
SmallString TranslatePluralToSmallString(const char* context, const char* msg, const char* disambiguation, int count);
|
||||
|
||||
/// Clears the translation cache. All previously used strings should be considered invalid.
|
||||
void ClearTranslationCache();
|
||||
@ -79,8 +81,10 @@ s32 GetTranslatedStringImpl(std::string_view context, std::string_view msg, char
|
||||
#define TRANSLATE_FS(context, msg) fmt::runtime(Host::TranslateToStringView(context, msg))
|
||||
#define TRANSLATE_PLURAL_STR(context, msg, disambiguation, count) \
|
||||
Host::TranslatePluralToString(context, msg, disambiguation, count)
|
||||
#define TRANSLATE_PLURAL_SSTR(context, msg, disambiguation, count) \
|
||||
Host::TranslatePluralToSmallString(context, msg, disambiguation, count)
|
||||
#define TRANSLATE_PLURAL_FS(context, msg, disambiguation, count) \
|
||||
fmt::runtime(Host::TranslatePluralToString(context, msg, disambiguation, count))
|
||||
fmt::runtime(Host::TranslatePluralToSmallString(context, msg, disambiguation, count).view())
|
||||
|
||||
// Does not translate the string at runtime, but allows the UI to in its own way.
|
||||
#define TRANSLATE_NOOP(context, msg) msg
|
||||
|
||||
Reference in New Issue
Block a user