diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp index f819e293..78e86e17 100644 --- a/src/config/ConfigDescriptions.hpp +++ b/src/config/ConfigDescriptions.hpp @@ -138,10 +138,16 @@ inline static const std::vector CONFIG_OPTIONS = { }, SConfigOptionDescription{ .value = "general:modal_parent_blocking", - .description = "If true, parent windows of modals will not be interactive.", + .description = "if true, parent windows of modals will not be interactive.", .type = CONFIG_OPTION_BOOL, .data = SConfigOptionDescription::SBoolData{true}, }, + SConfigOptionDescription{ + .value = "general:locale", + .description = "overrides the system locale", + .type = CONFIG_OPTION_STRING_SHORT, + .data = SConfigOptionDescription::SStringData{""}, + }, /* * decoration: diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 775d3beb..fc020d7a 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -463,6 +463,7 @@ CConfigManager::CConfigManager() { registerConfigVar("general:col.nogroup_border", Hyprlang::CConfigCustomValueType{&configHandleGradientSet, configHandleGradientDestroy, "0xffffaaff"}); registerConfigVar("general:col.nogroup_border_active", Hyprlang::CConfigCustomValueType{&configHandleGradientSet, configHandleGradientDestroy, "0xffff00ff"}); registerConfigVar("general:modal_parent_blocking", Hyprlang::INT{1}); + registerConfigVar("general:locale", {""}); registerConfigVar("misc:disable_hyprland_logo", Hyprlang::INT{0}); registerConfigVar("misc:disable_splash_rendering", Hyprlang::INT{0}); diff --git a/src/i18n/Engine.cpp b/src/i18n/Engine.cpp index d78689a6..64c919ba 100644 --- a/src/i18n/Engine.cpp +++ b/src/i18n/Engine.cpp @@ -1,6 +1,7 @@ #include "Engine.hpp" #include +#include "../config/ConfigValue.hpp" using namespace I18n; using namespace Hyprutils::I18n; @@ -1105,5 +1106,7 @@ I18n::CI18nEngine::CI18nEngine() { } std::string I18n::CI18nEngine::localize(eI18nKeys key, const Hyprutils::I18n::translationVarMap& vars) { - return huEngine->localizeEntry(localeStr, key, vars); + static auto CONFIG_LOCALE = CConfigValue("general:locale"); + std::string locale = *CONFIG_LOCALE != "" ? *CONFIG_LOCALE : localeStr; + return huEngine->localizeEntry(locale, key, vars); }