aboutsummaryrefslogtreecommitdiff
path: root/core/src/Model
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2021-06-12 22:49:54 -0700
committerrtk0c <[email protected]>2021-06-12 22:49:54 -0700
commitcf05728bc11aae1bb9545d4b0242a36dd14c7061 (patch)
tree78293ddb80caae30fd75b92a2ba46e6417acf9c0 /core/src/Model
parent90796ccce3ef9087c1288d737738f65e188cff0b (diff)
Add l10n to previously hard coded strings
Diffstat (limited to 'core/src/Model')
-rw-r--r--core/src/Model/Template/Template_RTTI.cpp5
-rw-r--r--core/src/Model/Workflow/Nodes/NumericNodes.cpp4
-rw-r--r--core/src/Model/Workflow/Value_RTTI.cpp33
-rw-r--r--core/src/Model/Workflow/Workflow_RTTI.cpp27
4 files changed, 36 insertions, 33 deletions
diff --git a/core/src/Model/Template/Template_RTTI.cpp b/core/src/Model/Template/Template_RTTI.cpp
index 1475e02..d1affe7 100644
--- a/core/src/Model/Template/Template_RTTI.cpp
+++ b/core/src/Model/Template/Template_RTTI.cpp
@@ -1,15 +1,16 @@
#include "Template.hpp"
#include "Model/Template/TableTemplate.hpp"
+#include "Utils/I18n.hpp"
const char* Template::FormatKind(Kind kind)
{
switch (kind) {
- case KD_Table: return "Table template";
+ case KD_Table: return I18N_TEXT("Table template", L10N_TEMPLATE_TABLE);
case InvalidKind: break;
}
- return "<invalid kind>";
+ return "";
}
std::unique_ptr<Template> Template::CreateByKind(Kind kind)
diff --git a/core/src/Model/Workflow/Nodes/NumericNodes.cpp b/core/src/Model/Workflow/Nodes/NumericNodes.cpp
index f0d28b1..3a81979 100644
--- a/core/src/Model/Workflow/Nodes/NumericNodes.cpp
+++ b/core/src/Model/Workflow/Nodes/NumericNodes.cpp
@@ -2,6 +2,7 @@
#include "Model/Workflow/Evaluation.hpp"
#include "Model/Workflow/Values/Basic.hpp"
+#include "Utils/I18n.hpp"
#include "Utils/Macros.hpp"
#include "Utils/RTTI.hpp"
@@ -64,8 +65,7 @@ void NumericOperationNode::Evaluate(WorkflowEvaluationContext& ctx)
case Multiplication: res = lhs * rhs; break;
case Division: {
if (rhs == 0.0) {
- // TODO localize
- ctx.ReportError("Error: division by 0", *this);
+ ctx.ReportError(I18N_TEXT("Error: division by 0", L10N_WORKFLOW_RTERROR_DIV_BY_0), *this);
return;
}
res = lhs / rhs;
diff --git a/core/src/Model/Workflow/Value_RTTI.cpp b/core/src/Model/Workflow/Value_RTTI.cpp
index dfb1273..121fa14 100644
--- a/core/src/Model/Workflow/Value_RTTI.cpp
+++ b/core/src/Model/Workflow/Value_RTTI.cpp
@@ -5,6 +5,7 @@
#include "Model/Workflow/Values/Dictionary.hpp"
#include "Model/Workflow/Values/List.hpp"
#include "UI/UI.hpp"
+#include "Utils/I18n.hpp"
constexpr BaseValue::KindInfo kNumericInfo{
.PinIcon = ImGui::IconType::Circle,
@@ -69,20 +70,20 @@ const BaseValue::KindInfo& BaseValue::QueryInfo(BaseValue::Kind kind)
const char* BaseValue::Format(Kind kind)
{
switch (kind) {
- case KD_Numeric: return "Numeric";
- case KD_Text: return "Text";
- case KD_DateTime: return "Date/time";
- case KD_DatabaseRowId: return "Row id";
- case KD_List: return "List";
- case KD_Dictionary: return "Dictionary";
+ case KD_Numeric: return I18N_TEXT("Numeric", L10N_VALUE_NUMERIC);
+ case KD_Text: return I18N_TEXT("Text", L10N_VALUE_TEXT);
+ case KD_DateTime: return I18N_TEXT("Date/time", L10N_VALUE_DATE_TIME);
+ case KD_DatabaseRowId: return I18N_TEXT("Row id", L10N_VALUE_ROW_ID);
+ case KD_List: return I18N_TEXT("List", L10N_VALUE_LIST);
+ case KD_Dictionary: return I18N_TEXT("Dictionary", L10N_VALUE_DICT);
- case KD_BaseObject: return "Object";
- case KD_SaleDatabaseRow: return "Sale record";
- case KD_PurchaseDatabaseRow: return "Purchase record";
+ case KD_BaseObject: return I18N_TEXT("Object", L10N_VALUE_OBJECT);
+ case KD_SaleDatabaseRow: return I18N_TEXT("Sale record", L10N_VALUE_SALE_RECORD);
+ case KD_PurchaseDatabaseRow: return I18N_TEXT("Purchase record", L10N_VALUE_PURCHASE_RECORD);
case InvalidKind: break;
}
- return "<invalid kind>";
+ return "";
}
std::unique_ptr<BaseValue> BaseValue::CreateByKind(BaseValue::Kind kind)
@@ -116,16 +117,16 @@ const BaseObjectDescription kEmptyObjectInfo{
const BaseObjectDescription kSaleDbRowObject{
.Properties = {
{
- .Name = "Customer",
+ .Name = I18N_TEXT("Customer", L10N_VALUE_PROPERTY_CUSTOMER),
.Kind = BaseValue::KD_Text,
.Mutatable = false,
},
{
- .Name = "Deadline",
+ .Name = I18N_TEXT("Deadline", L10N_VALUE_PROPERTY_DEADLINE),
.Kind = BaseValue::KD_DateTime,
},
{
- .Name = "Completion time",
+ .Name = I18N_TEXT("Delivery time", L10N_VALUE_PROPERTY_DELIVERY_TIME),
.Kind = BaseValue::KD_DateTime,
},
},
@@ -134,16 +135,16 @@ const BaseObjectDescription kSaleDbRowObject{
const BaseObjectDescription kPurchaseDbRowObject{
.Properties = {
{
- .Name = "Factory",
+ .Name = I18N_TEXT("Factory", L10N_VALUE_PROPERTY_FACTORY),
.Kind = BaseValue::KD_Text,
.Mutatable = false,
},
{
- .Name = "Order time",
+ .Name = I18N_TEXT("Order time", L10N_VALUE_PROPERTY_ORDER_TIME),
.Kind = BaseValue::KD_DateTime,
},
{
- .Name = "Arrival time",
+ .Name = I18N_TEXT("Delivery time", L10N_VALUE_PROPERTY_DELIVERY_TIME),
.Kind = BaseValue::KD_DateTime,
},
},
diff --git a/core/src/Model/Workflow/Workflow_RTTI.cpp b/core/src/Model/Workflow/Workflow_RTTI.cpp
index 10659d0..579fb3b 100644
--- a/core/src/Model/Workflow/Workflow_RTTI.cpp
+++ b/core/src/Model/Workflow/Workflow_RTTI.cpp
@@ -4,6 +4,7 @@
#include "Model/Workflow/Nodes/NumericNodes.hpp"
#include "Model/Workflow/Nodes/TextNodes.hpp"
#include "Model/Workflow/Nodes/UserInputNodes.hpp"
+#include "Utils/I18n.hpp"
#include "Utils/Macros.hpp"
#include <memory>
@@ -11,27 +12,27 @@
const char* WorkflowNode::FormatKind(Kind kind)
{
switch (kind) {
- case KD_NumericAddition: return "NumericOperation (addition)";
- case KD_NumericSubtraction: return "NumericOperation (subtraction)";
- case KD_NumericMultiplication: return "NumericOperation (multiplication)";
- case KD_NumericDivision: return "NumericOperation (division)";
- case KD_NumericExpression: return "NumericExpression";
- case KD_TextFormatting: return "TextFormatting";
- case KD_DocumentTemplateExpansion: return "DocumentTemplateExpansion";
- case KD_FormInput: return "FormInput";
- case KD_DatabaseRowsInput: return "DatabaseRowsInput";
+ case KD_NumericAddition: return I18N_TEXT("Add", L10N_WORKFLOW_ADD);
+ case KD_NumericSubtraction: return I18N_TEXT("Subtract", L10N_WORKFLOW_SUB);
+ case KD_NumericMultiplication: return I18N_TEXT("Multiply", L10N_WORKFLOW_MUL);
+ case KD_NumericDivision: return I18N_TEXT("Divide", L10N_WORKFLOW_DIV);
+ case KD_NumericExpression: return I18N_TEXT("Evaluate expression", L10N_WORKFLOW_EVAL);
+ case KD_TextFormatting: return I18N_TEXT("Format text", L10N_WORKFLOW_FMT);
+ case KD_DocumentTemplateExpansion: return I18N_TEXT("Expand template", L10N_WORKFLOW_INSTANTIATE_TEMPLATE);
+ case KD_FormInput: return I18N_TEXT("Form input", L10N_WORKFLOW_FORM_INPUT);
+ case KD_DatabaseRowsInput: return I18N_TEXT("Database input", L10N_WORKFLOW_DB_INPUT);
case InvalidKind: break;
}
- return "<invalid kind>";
+ return "";
}
const char* WorkflowNode::FormatType(Type type)
{
switch (type) {
- case InputType: return "input";
- case TransformType: return "transform";
- case OutputType: return "output";
+ case InputType: return I18N_TEXT("Input", L10N_WORKFLOW_KIND_INPUT);
+ case TransformType: return I18N_TEXT("Transform", L10N_WORKFLOW_KIND_TRANSFORM);
+ case OutputType: return I18N_TEXT("Output", L10N_WORKFLOW_KIND_OUTPUT);
}
return "";
}