impr: Only reload localization when necessary

This commit is contained in:
WerWolv
2023-07-09 20:24:56 +02:00
parent 6343cb092b
commit ce9ce42c1c
3 changed files with 12 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
namespace hex {
std::string LangEntry::s_fallbackLanguage;
std::string LangEntry::s_selectedLanguage;
std::map<std::string, std::string> LangEntry::s_currStrings;
LanguageDefinition::LanguageDefinition(std::map<std::string, std::string> &&entries) {
@@ -89,6 +90,8 @@ namespace hex {
for (auto &definition : definitions[fallbackLanguage])
LangEntry::s_currStrings.insert(definition.getEntries().begin(), definition.getEntries().end());
}
LangEntry::s_selectedLanguage = language;
}
const std::map<std::string, std::string> &LangEntry::getSupportedLanguages() {
@@ -107,4 +110,8 @@ namespace hex {
LangEntry::s_currStrings.clear();
}
const std::string &LangEntry::getSelectedLanguage() {
return s_selectedLanguage;
}
}