From 8f7daa9bd100345d7e23639604c9a3a50ce6448b Mon Sep 17 00:00:00 2001 From: rtk0c Date: Fri, 11 Jun 2021 13:35:35 -0700 Subject: Convert runtime-loaded l10n to string literals chosen at compile time --- core/src/Model/Workflow/Workflow_Main.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'core/src/Model/Workflow') diff --git a/core/src/Model/Workflow/Workflow_Main.cpp b/core/src/Model/Workflow/Workflow_Main.cpp index a01ab7b..adf944e 100644 --- a/core/src/Model/Workflow/Workflow_Main.cpp +++ b/core/src/Model/Workflow/Workflow_Main.cpp @@ -2,9 +2,9 @@ #include "Model/GlobalStates.hpp" #include "Model/Project.hpp" -#include "UI/Localization.hpp" #include "UI/UI.hpp" #include "Utils/UUID.hpp" +#include "Utils/I18n.hpp" #include #include @@ -804,8 +804,6 @@ Workflow* WorkflowAssetList::LoadImpl(const SavedAsset& asset) const void WorkflowAssetList::DisplayAssetCreator(ListState& state) { - auto ls = LocaleStrings::Instance.get(); - auto ValidateNewName = [&]() -> void { if (mACNewName.empty()) { mACNewNameError = NameSelectionError::Empty; @@ -824,10 +822,10 @@ void WorkflowAssetList::DisplayAssetCreator(ListState& state) switch (mACNewNameError) { case NameSelectionError::None: break; case NameSelectionError::Duplicated: - ImGui::ErrorMessage(ls->DuplicateNameError.Get()); + ImGui::ErrorMessage(I18N_TEXT("Duplicate name", L10N_DUPLICATE_NAME_ERROR)); break; case NameSelectionError::Empty: - ImGui::ErrorMessage(ls->EmptyNameError.Get()); + ImGui::ErrorMessage(I18N_TEXT("Name cannot be empty", L10N_EMPTY_NAME_ERROR)); break; } }; @@ -841,13 +839,13 @@ void WorkflowAssetList::DisplayAssetCreator(ListState& state) ValidateNewName(); }; - if (ImGui::InputText(ls->Name.Get(), &mACNewName)) { + if (ImGui::InputText(I18N_TEXT("Name", L10N_NAME), &mACNewName)) { ValidateNewName(); } ShowNewNameErrors(); - if (ImGui::Button(ls->Confirm.Get(), !IsInputValid())) { + if (ImGui::Button(I18N_TEXT("OK", L10N_CONFIRM), !IsInputValid())) { ImGui::CloseCurrentPopup(); Create(SavedAsset{ @@ -856,18 +854,16 @@ void WorkflowAssetList::DisplayAssetCreator(ListState& state) ResetState(); } ImGui::SameLine(); - if (ImGui::Button(ls->Cancel.Get())) { + if (ImGui::Button(I18N_TEXT("Cancel", L10N_CANCEL))) { ImGui::CloseCurrentPopup(); } } void WorkflowAssetList::SetupDetailsTable(const char* tableId) const { - auto ls = LocaleStrings::Instance.get(); - ImGui::BeginTable(tableId, 1, ImGuiTableFlags_Borders); - ImGui::TableSetupColumn(ls->Name.Get()); + ImGui::TableSetupColumn(I18N_TEXT("Name", L10N_NAME)); ImGui::TableHeadersRow(); } -- cgit v1.2.3-70-g09d2