Use RTR() for VisualScriptNode captions and texts

This commit is contained in:
Haoyu Qiu 2022-03-11 23:36:16 +08:00
parent 3f3826edb8
commit 77f80aa4ee
5 changed files with 82 additions and 76 deletions

View file

@ -33,6 +33,7 @@
#include "core/config/engine.h"
#include "core/io/resource_loader.h"
#include "core/os/os.h"
#include "core/templates/local_vector.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
#include "visual_script_nodes.h"
@ -261,13 +262,13 @@ String VisualScriptFunctionCall::get_text() const {
String text;
if (call_mode == CALL_MODE_BASIC_TYPE) {
text = vformat(TTR("On %s"), Variant::get_type_name(basic_type));
text = vformat(RTR("On %s"), Variant::get_type_name(basic_type));
} else if (call_mode == CALL_MODE_INSTANCE) {
text = vformat(TTR("On %s"), base_type);
text = vformat(RTR("On %s"), base_type);
} else if (call_mode == CALL_MODE_NODE_PATH) {
text = "[" + String(base_path.simplified()) + "]";
} else if (call_mode == CALL_MODE_SELF) {
text = TTR("On Self");
text = RTR("On Self");
} else if (call_mode == CALL_MODE_SINGLETON) {
text = String(singleton) + ":" + String(function) + "()";
}
@ -1032,18 +1033,18 @@ PropertyInfo VisualScriptPropertySet::get_output_value_port_info(int p_idx) cons
}
String VisualScriptPropertySet::get_caption() const {
static const char *opname[ASSIGN_OP_MAX] = {
TTRC("Set %s"),
TTRC("Add %s"),
TTRC("Subtract %s"),
TTRC("Multiply %s"),
TTRC("Divide %s"),
TTRC("Mod %s"),
TTRC("ShiftLeft %s"),
TTRC("ShiftRight %s"),
TTRC("BitAnd %s"),
TTRC("BitOr %s"),
TTRC("BitXor %s")
static const LocalVector<String> opname = {
RTR("Set %s"),
RTR("Add %s"),
RTR("Subtract %s"),
RTR("Multiply %s"),
RTR("Divide %s"),
RTR("Mod %s"),
RTR("ShiftLeft %s"),
RTR("ShiftRight %s"),
RTR("BitAnd %s"),
RTR("BitOr %s"),
RTR("BitXor %s"),
};
String prop = property;
@ -1051,7 +1052,7 @@ String VisualScriptPropertySet::get_caption() const {
prop += "." + String(index);
}
return vformat(TTRGET(opname[assign_op]), prop);
return vformat(opname[assign_op], prop);
}
String VisualScriptPropertySet::get_text() const {
@ -1059,13 +1060,13 @@ String VisualScriptPropertySet::get_text() const {
return "";
}
if (call_mode == CALL_MODE_BASIC_TYPE) {
return vformat(TTR("On %s"), Variant::get_type_name(basic_type));
return vformat(RTR("On %s"), Variant::get_type_name(basic_type));
} else if (call_mode == CALL_MODE_INSTANCE) {
return vformat(TTR("On %s"), base_type);
return vformat(RTR("On %s"), base_type);
} else if (call_mode == CALL_MODE_NODE_PATH) {
return " [" + String(base_path.simplified()) + "]";
} else {
return TTR("On Self");
return RTR("On Self");
}
}
@ -1776,18 +1777,18 @@ String VisualScriptPropertyGet::get_caption() const {
prop += "." + String(index);
}
return vformat(TTR("Get %s"), prop);
return vformat(RTR("Get %s"), prop);
}
String VisualScriptPropertyGet::get_text() const {
if (call_mode == CALL_MODE_BASIC_TYPE) {
return vformat(TTR("On %s"), Variant::get_type_name(basic_type));
return vformat(RTR("On %s"), Variant::get_type_name(basic_type));
} else if (call_mode == CALL_MODE_INSTANCE) {
return vformat(TTR("On %s"), base_type);
return vformat(RTR("On %s"), base_type);
} else if (call_mode == CALL_MODE_NODE_PATH) {
return " [" + String(base_path.simplified()) + "]";
} else {
return TTR("On Self");
return RTR("On Self");
}
}
@ -2303,7 +2304,7 @@ PropertyInfo VisualScriptEmitSignal::get_output_value_port_info(int p_idx) const
}
String VisualScriptEmitSignal::get_caption() const {
return vformat(TTR("Emit %s"), name);
return vformat(RTR("Emit %s"), name);
}
void VisualScriptEmitSignal::set_signal(const StringName &p_type) {