mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
impr: Add localization option to store long, formatted texts in external files
This commit is contained in:
@@ -104,9 +104,21 @@ namespace hex {
|
||||
|
||||
for (const auto &entry : json.items()) {
|
||||
auto value = entry.value().get<std::string>();
|
||||
|
||||
// Skip empty values
|
||||
if (value.empty())
|
||||
continue;
|
||||
|
||||
// Handle references to files
|
||||
if (value.starts_with("#@")) {
|
||||
try {
|
||||
value = path.callback(value.substr(2));
|
||||
} catch (std::exception &e) {
|
||||
log::error("Failed to load localization file reference '{}': {}", entry.key(), e.what());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
localizations.try_emplace(LangConst::hash(entry.key()), std::move(value));
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
|
||||
Reference in New Issue
Block a user