mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
@@ -200,7 +200,7 @@ namespace loot {
|
||||
|
||||
bool Message::EvalCondition(loot::Game& game, const unsigned int language) {
|
||||
|
||||
BOOST_LOG_TRIVIAL(trace) << "Choosing message language.";
|
||||
BOOST_LOG_TRIVIAL(trace) << "Choosing message content for language: " << Language(language).Name();
|
||||
|
||||
if (_content.size() > 1) {
|
||||
if (language == Language::any) //Can use a message of any language, so use the first string.
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace loot {
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages) {
|
||||
std::pair<std::string, std::string> UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages, const unsigned int language) {
|
||||
git_handler git;
|
||||
fs::path repo_path = game.MasterlistPath().parent_path();
|
||||
string repo_branch = game.RepoBranch();
|
||||
@@ -428,11 +428,11 @@ namespace loot {
|
||||
plugins = mlist["plugins"].as< list<loot::Plugin> >();
|
||||
|
||||
for (auto &plugin: plugins) {
|
||||
plugin.EvalAllConditions(game, Language::any);
|
||||
plugin.EvalAllConditions(game, language);
|
||||
}
|
||||
|
||||
for (auto &message: messages) {
|
||||
message.EvalCondition(game, Language::any);
|
||||
message.EvalCondition(game, language);
|
||||
}
|
||||
|
||||
parsingFailed = false;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
namespace loot {
|
||||
|
||||
std::pair<std::string, std::string> UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages);
|
||||
std::pair<std::string, std::string> UpdateMasterlist(Game& game, std::list<Message>& parsingErrors, std::list<Plugin>& plugins, std::list<Message>& messages, const unsigned int language);
|
||||
|
||||
std::pair<std::string, std::string> GetMasterlistRevision(const Game& game);
|
||||
}
|
||||
|
||||
+13
-10
@@ -103,14 +103,14 @@ struct plugin_list_loader {
|
||||
};
|
||||
|
||||
struct masterlist_updater_parser {
|
||||
masterlist_updater_parser(bool doUpdate, loot::Game& game, list<loot::Message>& errors, list<loot::Plugin>& plugins, list<loot::Message>& messages, string& revision, string& date) : _doUpdate(doUpdate), _game(game), _errors(errors), _plugins(plugins), _messages(messages), _revision(revision), _date(date) {}
|
||||
masterlist_updater_parser(bool doUpdate, loot::Game& game, list<loot::Message>& errors, list<loot::Plugin>& plugins, list<loot::Message>& messages, string& revision, string& date, const unsigned int language) : _doUpdate(doUpdate), _game(game), _errors(errors), _plugins(plugins), _messages(messages), _revision(revision), _date(date), _language(language) {}
|
||||
|
||||
void operator () () {
|
||||
|
||||
if (_doUpdate) {
|
||||
BOOST_LOG_TRIVIAL(debug) << "Updating masterlist";
|
||||
try {
|
||||
pair<string, string> ret = UpdateMasterlist(_game, _errors, _plugins, _messages);
|
||||
pair<string, string> ret = UpdateMasterlist(_game, _errors, _plugins, _messages, _language);
|
||||
_revision = ret.first;
|
||||
_date = ret.second;
|
||||
} catch (std::exception& e) {
|
||||
@@ -185,6 +185,7 @@ struct masterlist_updater_parser {
|
||||
list<loot::Message>& _messages;
|
||||
string& _revision;
|
||||
string& _date;
|
||||
unsigned int _language;
|
||||
};
|
||||
|
||||
bool LOOT::OnInit() {
|
||||
@@ -730,8 +731,17 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
// Load Plugins & Lists
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
//Set language.
|
||||
unsigned int lang;
|
||||
if (_settings["Language"])
|
||||
lang = Language(_settings["Language"].as<string>()).Code();
|
||||
else
|
||||
lang = loot::Language::any;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Using message language: " << Language(lang).Name();
|
||||
|
||||
bool doUpdate = _settings["Update Masterlist"] && _settings["Update Masterlist"].as<bool>();
|
||||
masterlist_updater_parser mup(doUpdate, *_game, messages, mlist_plugins, mlist_messages, revision, date);
|
||||
masterlist_updater_parser mup(doUpdate, *_game, messages, mlist_plugins, mlist_messages, revision, date, lang);
|
||||
group.create_thread(mup);
|
||||
|
||||
//First calculate the mean plugin size. Store it temporarily in a map to reduce filesystem lookups and file size recalculation.
|
||||
@@ -792,13 +802,6 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) {
|
||||
// Merge & Check Metadata
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
//Set language.
|
||||
unsigned int lang;
|
||||
if (_settings["Language"])
|
||||
lang = Language(_settings["Language"].as<string>()).Code();
|
||||
else
|
||||
lang = loot::Language::any;
|
||||
|
||||
if (fs::exists(_game->MasterlistPath()) || fs::exists(_game->UserlistPath())) {
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user