update locale log messages
This commit is contained in:
parent
27acc1d8b1
commit
1ab3707343
@ -37,38 +37,40 @@ const std::string& langs::Lang::getId() const {
|
|||||||
return locale;
|
return locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @brief Language key-value txt files parser
|
/// @brief Language key-value txt files parser
|
||||||
class Reader : BasicParser {
|
namespace {
|
||||||
void skipWhitespace() override {
|
class Reader : BasicParser {
|
||||||
BasicParser::skipWhitespace();
|
void skipWhitespace() override {
|
||||||
if (hasNext() && source[pos] == '#') {
|
BasicParser::skipWhitespace();
|
||||||
skipLine();
|
if (hasNext() && source[pos] == '#') {
|
||||||
if (hasNext() && is_whitespace(peek())) {
|
skipLine();
|
||||||
|
if (hasNext() && is_whitespace(peek())) {
|
||||||
|
skipWhitespace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
Reader(std::string_view file, std::string_view source)
|
||||||
|
: BasicParser(file, source) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void read(langs::Lang& lang, const std::string &prefix) {
|
||||||
|
skipWhitespace();
|
||||||
|
while (hasNext()) {
|
||||||
|
std::string key = parseString('=', true);
|
||||||
|
util::trim(key);
|
||||||
|
key = prefix + key;
|
||||||
|
std::string text = parseString('\n', false);
|
||||||
|
util::trim(text);
|
||||||
|
lang.put(util::str2wstr_utf8(key), util::str2wstr_utf8(text));
|
||||||
skipWhitespace();
|
skipWhitespace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
public:
|
}
|
||||||
Reader(std::string_view file, std::string_view source) : BasicParser(file, source) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void read(langs::Lang& lang, const std::string &prefix) {
|
|
||||||
skipWhitespace();
|
|
||||||
while (hasNext()) {
|
|
||||||
std::string key = parseString('=', true);
|
|
||||||
util::trim(key);
|
|
||||||
key = prefix + key;
|
|
||||||
std::string text = parseString('\n', false);
|
|
||||||
util::trim(text);
|
|
||||||
lang.put(util::str2wstr_utf8(key),
|
|
||||||
util::str2wstr_utf8(text));
|
|
||||||
skipWhitespace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void langs::loadLocalesInfo(const fs::path& resdir, std::string& fallback) {
|
void langs::loadLocalesInfo(const fs::path& resdir, std::string& fallback) {
|
||||||
fs::path file = resdir/fs::path(langs::TEXTS_FOLDER)/fs::path("langs.json");
|
auto file = resdir/fs::u8path(langs::TEXTS_FOLDER)/fs::u8path("langs.json");
|
||||||
auto root = files::read_json(file);
|
auto root = files::read_json(file);
|
||||||
|
|
||||||
langs::locales_info.clear();
|
langs::locales_info.clear();
|
||||||
@ -85,7 +87,7 @@ void langs::loadLocalesInfo(const fs::path& resdir, std::string& fallback) {
|
|||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
logline << "[" << key << " (" << name << ")] ";
|
logline << key << " ";
|
||||||
langs::locales_info[key] = LocaleInfo {key, name};
|
langs::locales_info[key] = LocaleInfo {key, name};
|
||||||
}
|
}
|
||||||
logline << "added";
|
logline << "added";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user