Skip to content

Commit 117e419

Browse files
committed
Better one
1 parent d70ee07 commit 117e419

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

src/Lang.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ namespace Lang {
3333
return true;
3434
}
3535

36-
static void load_messages_from_json(const Json &data, const std::string &filename, Resource::StringMap &strings)
36+
static bool load_messages_from_file(const std::string &filename, Resource::StringMap &strings)
3737
{
38-
for (Json::iterator i = data.begin(); i != data.end(); ++i) {
38+
Json data = JsonUtils::LoadJsonDataFile(filename);
39+
if (data.is_null())
40+
return false;
41+
42+
for (Json::const_iterator i = data.begin(); i != data.end(); ++i) {
3943
const std::string token = i.key();
4044
if (token.empty()) {
4145
Log::Info("{}: found empty token, skipping it\n", filename.c_str());
@@ -89,14 +93,6 @@ namespace Lang {
8993

9094
strings[token] = text;
9195
}
92-
}
93-
94-
static bool load_messages_from_file(const std::string &filename, Resource::StringMap &strings)
95-
{
96-
Json data = JsonUtils::LoadJsonDataFile(filename);
97-
if (data.is_null())
98-
return false;
99-
load_messages_from_json(data, filename, strings);
10096
return true;
10197
}
10298

0 commit comments

Comments
 (0)