1
0
mirror of synced 2025-01-19 01:24:15 +01:00

impr: Make all task names properly translatable

This commit is contained in:
WerWolv 2024-07-27 16:29:06 +02:00
parent cf2e189049
commit 1a7bd49361
22 changed files with 47 additions and 27 deletions

View File

@ -35,7 +35,7 @@ namespace hex::ui {
m_filteredEntries.clear();
m_filteredEntries.reserve(entries.size());
m_updateTask = TaskManager::createBackgroundTask("Searching"_lang, [this, &entries, searchBuffer = m_searchBuffer](Task&) {
m_updateTask = TaskManager::createBackgroundTask(Lang("Searching"), [this, &entries, searchBuffer = m_searchBuffer](Task&) {
for (auto &entry : entries) {
if (searchBuffer.empty() || m_comparator(searchBuffer, entry))
m_filteredEntries.push_back(&entry);

View File

@ -450,7 +450,7 @@ namespace hex {
// Do the destruction of the provider in the background once all tasks have finished
TaskManager::runWhenTasksFinished([providerToRemove] {
EventProviderDeleted::post(providerToRemove);
TaskManager::createBackgroundTask("Closing Provider"_lang, [providerToRemove](Task &) {
TaskManager::createBackgroundTask(Lang("Closing Provider"), [providerToRemove](Task &) {
eraseMutex.lock();
auto provider = std::move((*s_providersToRemove)[providerToRemove]);
s_providersToRemove->erase(providerToRemove);

View File

@ -85,7 +85,7 @@ namespace hex::plugin::builtin {
private:
void executeQuery() {
m_requestTask = TaskManager::createBackgroundTask("Query Docs"_lang, [this, input = m_inputBuffer](Task &) {
m_requestTask = TaskManager::createBackgroundTask("hex.builtin.task.query_docs"_lang, [this, input = m_inputBuffer](Task &) {
m_noAnswer = false;
for (auto space : { "xj7sbzGbHH260vbpZOu1", "WZzDdGjxmgMSIE3xly6o" }) {
m_answer.clear();

View File

@ -521,6 +521,21 @@
"hex.builtin.setting.toolbar.icons": "Toolbar Icons",
"hex.builtin.shortcut.next_provider": "Select next provider",
"hex.builtin.shortcut.prev_provider": "Select previous provider",
"hex.builtin.task.query_docs": "Querying Docs...",
"hex.builtin.task.sending_statistics": "Sending statistics...",
"hex.builtin.task.check_updates": "Checking for updates...",
"hex.builtin.task.exporting_data": "Exporting data...",
"hex.builtin.task.uploading_crash": "Uploading crash report...",
"hex.builtin.task.loading_banner": "Loading banner...",
"hex.builtin.task.updating_recents": "Updating recent files...",
"hex.builtin.task.updating_store": "Updating store...",
"hex.builtin.task.parsing_pattern": "Parsing pattern...",
"hex.builtin.task.analyzing_data": "Analyzing data...",
"hex.builtin.task.updating_inspector": "Updating inspector...",
"hex.builtin.task.saving_data": "Saving data...",
"hex.builtin.task.loading_encoding_file": "Loading encoding file...",
"hex.builtin.task.filtering_data": "Filtering data...",
"hex.builtin.task.evaluating_nodes": "Evaluating nodes...",
"hex.builtin.title_bar_button.debug_build": "Debug build\n\nSHIFT + Click to open Debug Menu",
"hex.builtin.title_bar_button.feedback": "Leave Feedback",
"hex.builtin.tools.ascii_table": "ASCII table",

View File

@ -59,7 +59,7 @@ namespace hex::plugin::builtin {
ContentRegistry::Settings::write<std::string>("hex.builtin.setting.general", "hex.builtin.setting.general.uuid", uuid);
}
TaskManager::createBackgroundTask("Sending statistics..."_lang, [uuid, versionString](auto&) {
TaskManager::createBackgroundTask("hex.builtin.task.sending_statistics"_lang, [uuid, versionString](auto&) {
// To avoid potentially flooding our database with lots of dead users
// from people just visiting the website, don't send telemetry data from
// the web version
@ -94,7 +94,7 @@ namespace hex::plugin::builtin {
}
bool checkForUpdates() {
TaskManager::createBackgroundTask("Checking for updates"_lang, [](auto&) { checkForUpdatesSync(); });
TaskManager::createBackgroundTask("hex.builtin.task.check_updates"_lang, [](auto&) { checkForUpdatesSync(); });
return true;
}

View File

@ -214,7 +214,7 @@ namespace hex::plugin::builtin {
for (const auto &formatter : ContentRegistry::DataFormatter::impl::getExportMenuEntries()) {
if (ImGui::MenuItem(Lang(formatter.unlocalizedName), nullptr, false, ImHexApi::Provider::get()->getActualSize() > 0)) {
fs::openFileBrowser(fs::DialogMode::Save, {}, [&formatter](const auto &path) {
TaskManager::createTask("Exporting data"_lang, TaskManager::NoProgress, [&formatter, path](auto&){
TaskManager::createTask("hex.builtin.task.exporting_data"_lang, TaskManager::NoProgress, [&formatter, path](auto&){
auto provider = ImHexApi::Provider::get();
auto selection = ImHexApi::HexEditor::getSelection()
.value_or(

View File

@ -149,7 +149,7 @@ namespace hex::plugin::builtin::recent {
}
void updateRecentEntries() {
TaskManager::createBackgroundTask("Updating recent files"_lang, [](auto&) {
TaskManager::createBackgroundTask("hex.builtin.task.updating_recents"_lang, [](auto&) {
if (s_recentEntriesUpdating)
return;

View File

@ -57,7 +57,7 @@ namespace hex::plugin::builtin {
}
void ViewDataInspector::updateInspectorRows() {
m_updateTask = TaskManager::createBackgroundTask("Update Inspector"_lang, [this](auto &) {
m_updateTask = TaskManager::createBackgroundTask(hex.builtin.task.updating_inspector"_lang, [this](auto &) {
this->updateInspectorRowsTask();
});
}

View File

@ -528,7 +528,7 @@ namespace hex::plugin::builtin {
// Reset any potential node errors
workspace.currNodeError.reset();
m_evaluationTask = TaskManager::createTask("Evaluating Nodes..."_lang, 0, [this, workspace = &workspace](Task& task) {
m_evaluationTask = TaskManager::createTask("hex.builtin.task.evaluating_nodes"_lang, 0, [this, workspace = &workspace](Task& task) {
task.setInterruptCallback([]{
dp::Node::interrupt();
});

View File

@ -924,7 +924,7 @@ namespace hex::plugin::builtin {
m_filterTask.interrupt();
if (!m_currFilter->empty()) {
m_filterTask = TaskManager::createTask("Filtering"_lang, currOccurrences.size(), [this, provider, &currOccurrences](Task &task) {
m_filterTask = TaskManager::createTask("hex.builtin.task.filtering_data"_lang, currOccurrences.size(), [this, provider, &currOccurrences](Task &task) {
u64 progress = 0;
std::erase_if(currOccurrences, [this, provider, &task, &progress](const auto &region) {
task.update(progress);

View File

@ -1055,7 +1055,7 @@ namespace hex::plugin::builtin {
ui::PopupFileChooser::open(basePaths, paths, std::vector<hex::fs::ItemFilter>{ {"Thingy Table File", "tbl"} }, false,
[this](const auto &path) {
TaskManager::createTask("Loading encoding file"_lang, 0, [this, path](auto&) {
TaskManager::createTask("hex.builtin.task.loading_encoding_file"_lang, 0, [this, path](auto&) {
auto encoding = EncodingFile(EncodingFile::Type::Thingy, path);
ImHexApi::Provider::markDirty();

View File

@ -558,7 +558,7 @@ namespace hex::plugin::builtin {
auto code = m_textEditor.GetText();
EventPatternEditorChanged::post(code);
TaskManager::createBackgroundTask("Pattern Parsing"_lang, [this, code, provider](auto &){
TaskManager::createBackgroundTask("hex.builtin.task.parsing_pattern"_lang, [this, code, provider](auto &){
this->parsePattern(code, provider);
if (m_runAutomatically)
@ -1330,7 +1330,7 @@ namespace hex::plugin::builtin {
if (m_shouldAnalyze) {
m_shouldAnalyze = false;
m_analysisTask = TaskManager::createBackgroundTask("Analyzing file content"_lang, [this, provider](const Task &task) {
m_analysisTask = TaskManager::createBackgroundTask("hex.builtin.task.analyzing_data"_lang, [this, provider](const Task &task) {
if (!m_autoLoadPatterns)
return;
@ -1584,7 +1584,7 @@ namespace hex::plugin::builtin {
m_textEditor.SetText(code);
m_sourceCode.set(provider, code);
TaskManager::createBackgroundTask("Parse pattern"_lang, [this, code, provider](auto&) { this->parsePattern(code, provider); });
TaskManager::createBackgroundTask("hex.builtin.task.parsing_pattern"_lang, [this, code, provider](auto&) { this->parsePattern(code, provider); });
}
}

View File

@ -197,7 +197,7 @@ namespace hex::plugin::builtin {
ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetCursorPosX() - 25_scaled);
ImGui::BeginDisabled(m_updateAllTask.isRunning() || m_updateCount == 0);
if (ImGuiExt::IconButton(ICON_VS_CLOUD_DOWNLOAD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
m_updateAllTask = TaskManager::createTask("Update All..."_lang, m_updateCount, [this](auto &task) {
m_updateAllTask = TaskManager::createTask("hex.builtin.task.updating_store"_lang, m_updateCount, [this](auto &task) {
for (auto &category : m_categories) {
for (auto &entry : category.entries) {
if (entry.hasUpdate) {

View File

@ -96,7 +96,7 @@ namespace hex::plugin::builtin {
}
}
TaskManager::createBackgroundTask("Upload Crash report"_lang, [path = m_logFilePath, data](auto&){
TaskManager::createBackgroundTask("hex.builtin.task.uploading_crash"_lang, [path = m_logFilePath, data](auto&){
HttpRequest request("POST", ImHexApiURL + std::string("/crash_upload"));
request.uploadFile(std::vector<u8>(data.begin(), data.end()), "file", path.filename()).wait();
});
@ -667,7 +667,7 @@ namespace hex::plugin::builtin {
auto allowNetworking = ContentRegistry::Settings::read<bool>("hex.builtin.setting.general", "hex.builtin.setting.general.network_interface", false)
&& ContentRegistry::Settings::read<int>("hex.builtin.setting.general", "hex.builtin.setting.general.server_contact", 0) != 0;
if (!s_infoBannerTexture.isValid() && allowNetworking) {
TaskManager::createBackgroundTask("Load banner"_lang, [](auto&) {
TaskManager::createBackgroundTask("hex.builtin.task.loading_banner"_lang, [](auto&) {
HttpRequest request("GET",
ImHexApiURL + hex::format("/info/{}/image", hex::toLower(ImHexApi::System::getOSName())));

View File

@ -16,6 +16,7 @@
"hex.diffing.view.diff.removed": "Removed",
"hex.diffing.view.diff.algorithm": "Diffing Algorithm",
"hex.diffing.view.diff.settings": "No settings available",
"hex.diffing.view.diff.settings.no_settings": "No settings available"
"hex.diffing.view.diff.settings.no_settings": "No settings available",
"hex.diffing.view.diff.task.diffing": "Diffing data..."
}
}

View File

@ -93,7 +93,7 @@ namespace hex::plugin::diffing {
void ViewDiff::analyze(prv::Provider *providerA, prv::Provider *providerB) {
auto commonSize = std::max(providerA->getActualSize(), providerB->getActualSize());
m_diffTask = TaskManager::createTask("Diffing..."_lang, commonSize, [this, providerA, providerB](Task &) {
m_diffTask = TaskManager::createTask("hex.diffing.view.diff.task.diffing"_lang, commonSize, [this, providerA, providerB](Task &) {
auto differences = m_algorithm->analyze(providerA, providerB);
auto providers = ImHexApi::Provider::getProviders();

View File

@ -5,6 +5,8 @@
"translations": {
"hex.script_loader.menu.run_script": "Run Script...",
"hex.script_loader.menu.loading": "Loading...",
"hex.script_loader.menu.no_scripts": "No scripts found"
"hex.script_loader.menu.no_scripts": "No scripts found",
"hex.script_loader.task.updating": "Updating scripts...",
"hex.script_loader.task.running": "Running script..."
}
}

View File

@ -91,7 +91,7 @@ namespace {
if (menuJustOpened) {
menuJustOpened = false;
if (!updaterTask.isRunning()) {
updaterTask = TaskManager::createBackgroundTask("Updating Scripts..."_lang, [] (auto&) {
updaterTask = TaskManager::createBackgroundTask("hex.script_loader.task.updating"_lang, [] (auto&) {
scripts = loadAllScripts();
});
}
@ -109,7 +109,7 @@ namespace {
continue;
if (ImGui::MenuItem(name.c_str(), loader->getTypeName().c_str())) {
runnerTask = TaskManager::createTask("Running script..."_lang, TaskManager::NoProgress, [entryPoint](auto&) {
runnerTask = TaskManager::createTask("hex.script_loader.task.running"_lang, TaskManager::NoProgress, [entryPoint](auto&) {
entryPoint();
});
}
@ -123,7 +123,7 @@ namespace {
return !runnerTask.isRunning();
});
updaterTask = TaskManager::createBackgroundTask("Updating Scripts..."_lang, [] (auto&) {
updaterTask = TaskManager::createBackgroundTask("hex.script_loader.task.updating"_lang, [] (auto&) {
scripts = loadAllScripts();
});
}

View File

@ -16,6 +16,7 @@
"hex.visualizers.pl_visualizer.coordinates.longitude": "Longitude",
"hex.visualizers.pl_visualizer.coordinates.query": "Find address",
"hex.visualizers.pl_visualizer.coordinates.querying": "Querying address...",
"hex.visualizers.pl_visualizer.coordinates.querying_no_address": "No address found"
"hex.visualizers.pl_visualizer.coordinates.querying_no_address": "No address found",
"hex.visualizers.pl_visualizer.task.visualizing": "Visualizing data..."
}
}

View File

@ -32,7 +32,7 @@ namespace hex::plugin::visualizers {
if (shouldReset) {
waveData.clear();
resetTask = TaskManager::createTask("Visualizing..."_lang, TaskManager::NoProgress, [=](Task &) {
resetTask = TaskManager::createTask("hex.visualizers.pl_visualizer.task.visualizing"_lang, TaskManager::NoProgress, [=](Task &) {
ma_device_stop(&audioDevice);
waveData = patternToArray<i16>(wavePattern.get());
sampledData = sampleData(waveData, 300_scaled * 4);

View File

@ -23,6 +23,7 @@
"hex.windows.view.tty_console.send_eot": "Send EOT",
"hex.windows.view.tty_console.send_etx": "Send ETX",
"hex.windows.view.tty_console.send_sub": "Send SUB",
"hex.windows.view.tty_console.stop_bits": "Stop bits"
"hex.windows.view.tty_console.stop_bits": "Stop bits",
"hex.windows.view.tty_console.task.transmitting": "Transmitting data..."
}
}

View File

@ -299,7 +299,7 @@ namespace hex::plugin::windows {
if (m_transmitting)
return;
TaskManager::createBackgroundTask("Transmitting data"_lang, [&, this](auto&) {
TaskManager::createBackgroundTask("hex.windows.view.tty_console.task.transmitting"_lang, [&, this](auto&) {
OVERLAPPED overlapped = { };
overlapped.hEvent = ::CreateEvent(nullptr, true, false, nullptr);