Skip to content

Commit 554d9e0

Browse files
committed
Add name info to EditorAutoloadSettings invalid name message
1 parent 6c9aa4c commit 554d9e0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

editor/settings/editor_autoload_settings.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,31 +95,31 @@ void EditorAutoloadSettings::_notification(int p_what) {
9595
bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, String *r_error) {
9696
if (!p_name.is_valid_unicode_identifier()) {
9797
if (r_error) {
98-
*r_error = TTR("Invalid name.") + " " + TTR("Must be a valid Unicode identifier.");
98+
*r_error = TTR("Invalid name.") + "\n" + vformat("%s: %s", p_name, TTR("Must be a valid Unicode identifier."));
9999
}
100100

101101
return false;
102102
}
103103

104104
if (ClassDB::class_exists(p_name)) {
105105
if (r_error) {
106-
*r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing engine class name.");
106+
*r_error = TTR("Invalid name.") + "\n" + vformat("%s: %s", p_name, TTR("Must not collide with an existing engine class name."));
107107
}
108108

109109
return false;
110110
}
111111

112112
if (ScriptServer::is_global_class(p_name)) {
113113
if (r_error) {
114-
*r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing global script class name.");
114+
*r_error = TTR("Invalid name.") + "\n" + vformat("%s: %s", p_name, TTR("Must not collide with an existing global script class name."));
115115
}
116116

117117
return false;
118118
}
119119

120120
if (Variant::get_type_by_name(p_name) < Variant::VARIANT_MAX) {
121121
if (r_error) {
122-
*r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing built-in type name.");
122+
*r_error = TTR("Invalid name.") + "\n" + vformat("%s: %s", p_name, TTR("Must not collide with an existing built-in type name."));
123123
}
124124

125125
return false;
@@ -128,7 +128,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin
128128
for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
129129
if (CoreConstants::get_global_constant_name(i) == p_name) {
130130
if (r_error) {
131-
*r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing global constant name.");
131+
*r_error = TTR("Invalid name.") + "\n" + vformat("%s: %s", p_name, TTR("Must not collide with an existing global constant name."));
132132
}
133133

134134
return false;
@@ -139,7 +139,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin
139139
for (const String &keyword : ScriptServer::get_language(i)->get_reserved_words()) {
140140
if (keyword == p_name) {
141141
if (r_error) {
142-
*r_error = TTR("Invalid name.") + " " + TTR("Keyword cannot be used as an Autoload name.");
142+
*r_error = TTR("Invalid name.") + "\n" + vformat("%s: %s", p_name, TTR("Keyword cannot be used as an Autoload name."));
143143
}
144144

145145
return false;

0 commit comments

Comments
 (0)