Use RTR() for VisualScriptNode captions and texts

(cherry picked from commit 77f80aa4ee)
This commit is contained in:
Haoyu Qiu 2022-03-11 23:36:16 +08:00 committed by Rémi Verschelde
parent 93447eb1ae
commit 743f2d232a
5 changed files with 84 additions and 77 deletions

View file

@ -32,6 +32,7 @@
#include "core/engine.h"
#include "core/io/resource_loader.h"
#include "core/local_vector.h"
#include "core/os/os.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.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) + "()";
}
@ -1028,26 +1029,27 @@ 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 LocalVector<String> opname;
if (opname.empty()) {
opname.push_back(RTR("Set %s"));
opname.push_back(RTR("Add %s"));
opname.push_back(RTR("Subtract %s"));
opname.push_back(RTR("Multiply %s"));
opname.push_back(RTR("Divide %s"));
opname.push_back(RTR("Mod %s"));
opname.push_back(RTR("ShiftLeft %s"));
opname.push_back(RTR("ShiftRight %s"));
opname.push_back(RTR("BitAnd %s"));
opname.push_back(RTR("BitOr %s"));
opname.push_back(RTR("BitXor %s"));
}
String prop = property;
if (index != StringName()) {
prop += "." + String(index);
}
return vformat(TTRGET(opname[assign_op]), prop);
return vformat(opname[assign_op], prop);
}
String VisualScriptPropertySet::get_text() const {
@ -1055,13 +1057,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");
}
}
@ -1759,18 +1761,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");
}
}
@ -2281,7 +2283,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) {