Added support for per-language menu scaling

This commit is contained in:
Leon Styhre 2024-07-04 18:38:49 +02:00
parent dfc217d006
commit 661bb5d539
2 changed files with 11 additions and 2 deletions

View file

@ -27,6 +27,10 @@ namespace Utils
{ {
namespace Localization namespace Localization
{ {
const std::vector<std::pair<std::string, std::string>> sSupportedLocales {{{"en"}, {"US"}},
{{"sv"}, {"SE"}}};
float sMenuScaleFactor {1.0f};
std::pair<std::string, std::string> getLocale() std::pair<std::string, std::string> getLocale()
{ {
#if defined(_WIN64) #if defined(_WIN64)
@ -86,6 +90,7 @@ namespace Utils
} }
} }
sMenuScaleFactor = 1.0f;
std::string languageSetting {Settings::getInstance()->getString("ApplicationLanguage")}; std::string languageSetting {Settings::getInstance()->getString("ApplicationLanguage")};
std::vector<std::string> localeVector; std::vector<std::string> localeVector;
std::pair<std::string, std::string> localePair; std::pair<std::string, std::string> localePair;
@ -133,6 +138,10 @@ namespace Utils
locale = "en_US"; locale = "en_US";
} }
// Language-specific menu scale factor.
if (localePair.first == "sv")
sMenuScaleFactor = 1.02f;
std::string localePath; std::string localePath;
localePath.append("/") localePath.append("/")
.append(locale) .append(locale)

View file

@ -20,8 +20,8 @@ namespace Utils
{ {
namespace Localization namespace Localization
{ {
static inline std::vector<std::pair<std::string, std::string>> sSupportedLocales { extern const std::vector<std::pair<std::string, std::string>> sSupportedLocales;
{{"en"}, {"US"}}, {{"sv"}, {"SE"}}}; extern float sMenuScaleFactor;
std::pair<std::string, std::string> getLocale(); std::pair<std::string, std::string> getLocale();
void setLocale(); void setLocale();