From f26f1298cf79cbdb6c3cd3a1b4c2369c571d7f07 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 24 Aug 2025 21:24:39 +0200 Subject: [PATCH] impr: Added localization for save editor view --- plugins/builtin/romfs/lang/en_US.json | 5 +++++ .../views/fullscreen/view_fullscreen_save_editor.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/builtin/romfs/lang/en_US.json b/plugins/builtin/romfs/lang/en_US.json index b3faefd85..e95a5c635 100644 --- a/plugins/builtin/romfs/lang/en_US.json +++ b/plugins/builtin/romfs/lang/en_US.json @@ -802,6 +802,11 @@ "hex.builtin.view.fullscreen.file_info.match_info.magic": "Matched using Magic value at offset 0x{0:04X}", "hex.builtin.view.fullscreen.file_info.information": "Information", "hex.builtin.view.fullscreen.file_info.no_information": "No further information available.", + "hex.builtin.view.fullscreen.save_editor.name": "Save Editor", + "hex.builtin.view.fullscreen.save_editor.select_file": "Select Save File", + "hex.builtin.view.fullscreen.save_editor.error.not_readable": "The selected file could not be opened. Please ensure the file exists and is readable.", + "hex.builtin.view.fullscreen.save_editor.error.failed_execution": "Failed to execute the save editor script. Please check the log for errors.", + "hex.builtin.view.fullscreen.save_editor.should_close": "Do you want to close the Save Editor?", "hex.builtin.view.help.about.commits": "Commit History", "hex.builtin.view.help.about.contributor": "Contributors", "hex.builtin.view.help.about.donations": "Donations", diff --git a/plugins/builtin/source/content/views/fullscreen/view_fullscreen_save_editor.cpp b/plugins/builtin/source/content/views/fullscreen/view_fullscreen_save_editor.cpp index 5e849cbb8..d44287ba2 100644 --- a/plugins/builtin/source/content/views/fullscreen/view_fullscreen_save_editor.cpp +++ b/plugins/builtin/source/content/views/fullscreen/view_fullscreen_save_editor.cpp @@ -46,7 +46,7 @@ namespace hex::plugin::builtin { const auto optionsWindowSize = ImVec2(windowSize.x * 2 / 3, 0); ImGui::NewLine(); ImGui::SetCursorPosX((windowSize.x - optionsWindowSize.x) / 2.0F); - if (ImGuiExt::BeginSubWindow(m_saveEditorName.empty() ? "Save Editor" : m_saveEditorName.c_str(), nullptr, optionsWindowSize)) { + if (ImGuiExt::BeginSubWindow(m_saveEditorName.empty() ? "hex.builtin.view.fullscreen.save_editor.name"_lang : m_saveEditorName.c_str(), nullptr, optionsWindowSize)) { for (const auto &author : m_saveEditorAuthors) { ImGui::TextUnformatted(author.c_str()); ImGui::SameLine(); @@ -64,16 +64,16 @@ namespace hex::plugin::builtin { ImGui::NewLine(); - if (ImGuiExt::DimmedButton(fmt::format("{} {}", ICON_VS_OPEN_PREVIEW, "Select Save File").c_str(), ImVec2(-1, 0))) { + if (ImGuiExt::DimmedButton(fmt::format("{} {}", ICON_VS_OPEN_PREVIEW, "hex.builtin.view.fullscreen.save_editor.select_file"_lang).c_str(), ImVec2(-1, 0))) { fs::openFileBrowser(fs::DialogMode::Open, {}, [this](const std::fs::path &path) { this->m_provider.setPath(path); if (!this->m_provider.open()) { - ui::ToastError::open("The selected file could not be opened. Please ensure the file exists and is readable."); + ui::ToastError::open("hex.builtin.view.fullscreen.save_editor.error.not_readable"_lang); } ContentRegistry::PatternLanguage::configureRuntime(m_runtime, &m_provider); if (!m_runtime.executeString(this->m_sourceCode)) { - ui::ToastError::open("Failed to execute the save editor script. Please check the log for errors."); + ui::ToastError::open("hex.builtin.view.fullscreen.save_editor.error.failed_execution"_lang); for (const auto &error : m_runtime.getCompileErrors()) { log::error("Save Editor Error: {}", error.format()); } @@ -108,7 +108,7 @@ namespace hex::plugin::builtin { } ImGui::SameLine(); if (ImGuiExt::DimmedIconButton(ICON_VS_CLOSE, ImGuiExt::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed))) { - ui::PopupQuestion::open("Do you want to close the Save Editor?", [this] { + ui::PopupQuestion::open("hex.builtin.view.fullscreen.save_editor.should_close"_lang, [this] { this->m_provider.close(); }, []{}); }