Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

[Editor] Replace few hardcoded `Alt` strings with `keycode_get_string(KeyModifierMask::ALT)`.

Pāvels Nadtočajevseba75f45e656
diff --git a/editor/run/game_view_plugin.cpp b/editor/run/game_view_plugin.cpp
index 32fc99aeedf..db212068db4 100644
--- a/editor/run/game_view_plugin.cpp
+++ b/editor/run/game_view_plugin.cpp
@@ -1162,7 +1162,7 @@ void GameView::_camera_override_menu_id_pressed(int p_id) {
void GameView::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
- select_mode_button[RuntimeNodeSelect::SELECT_MODE_SINGLE]->set_tooltip_text(vformat(TTR("%s+Alt+RMB: Show list of all nodes at position clicked."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL)));
+ select_mode_button[RuntimeNodeSelect::SELECT_MODE_SINGLE]->set_tooltip_text(vformat(TTR("%s+%s+RMB: Show list of all nodes at position clicked."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL), keycode_get_string((Key)KeyModifierMask::ALT)));
_update_ui();
} break;
diff --git a/editor/scene/2d/scene_paint_2d_editor_plugin.cpp b/editor/scene/2d/scene_paint_2d_editor_plugin.cpp
index 6ba12036599..5d5b381c41f 100644
--- a/editor/scene/2d/scene_paint_2d_editor_plugin.cpp
+++ b/editor/scene/2d/scene_paint_2d_editor_plugin.cpp
@@ -758,7 +758,7 @@ void ScenePaint2DEditor::_bind_methods() {
void ScenePaint2DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
- advanced_settings_button->set_tooltip_text(TTR("Advanced Settings") + "\n" + TTR("Hold Alt while painting to temporarily switch to the previously used paint snap mode."));
+ advanced_settings_button->set_tooltip_text(TTR("Advanced Settings") + "\n" + vformat(TTR("Hold %s while painting to temporarily switch to the previously used paint snap mode."), keycode_get_string((Key)KeyModifierMask::ALT)));
if (toolbar->is_visible()) {
_update_hint_label();
}
diff --git a/editor/scene/3d/node_3d_editor_plugin.cpp b/editor/scene/3d/node_3d_editor_plugin.cpp
index b4a34f0d808..486126b1e16 100644
--- a/editor/scene/3d/node_3d_editor_plugin.cpp
+++ b/editor/scene/3d/node_3d_editor_plugin.cpp
@@ -2417,7 +2417,7 @@ void Node3DEditor::_update_theme() {
void Node3DEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
- const String show_list_tooltip = TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.");
+ const String show_list_tooltip = vformat(TTR("%s+RMB: Show list of all nodes at position clicked, including locked."), keycode_get_string((Key)KeyModifierMask::ALT));
tool_button[TOOL_MODE_TRANSFORM]->set_tooltip_text(vformat(TTR("%s+Drag: Rotate selected node around pivot."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL)) + "\n" + show_list_tooltip);
tool_button[TOOL_MODE_MOVE]->set_tooltip_text(vformat(TTR("%s+Drag: Use snap."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL)) + "\n" + show_list_tooltip);
tool_button[TOOL_MODE_ROTATE]->set_tooltip_text(vformat(TTR("%s+Drag: Use snap."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL)) + "\n" + show_list_tooltip);
@@ -3302,7 +3302,7 @@ Node3DEditor::Node3DEditor() {
tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true);
tool_button[TOOL_MODE_LIST_SELECT]->set_theme_type_variation(SceneStringName(FlatButton));
tool_button[TOOL_MODE_LIST_SELECT]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_LIST_SELECT));
- tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked."));
+ tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.") + "\n" + vformat(TTR("%s+RMB: Show list of all nodes at position clicked, including locked."), keycode_get_string((Key)KeyModifierMask::ALT)));
tool_button[TOOL_MODE_LIST_SELECT]->set_accessibility_name(TTRC("Show List of Selectable Nodes"));
tool_button[TOOL_LOCK_SELECTED] = memnew(Button);
diff --git a/editor/scene/3d/node_3d_editor_viewport.cpp b/editor/scene/3d/node_3d_editor_viewport.cpp
index 854dc878459..7eb6113f4be 100644
--- a/editor/scene/3d/node_3d_editor_viewport.cpp
+++ b/editor/scene/3d/node_3d_editor_viewport.cpp
@@ -6044,9 +6044,10 @@ bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant
"[b]Hold Shift:[/b] Add as children of selected node.",
files.size()) +
"\n" +
- TTRN("[b]Hold Alt:[/b] Add as child of root node.",
- "[b]Hold Alt:[/b] Add as children of root node.",
- files.size());
+ vformat(TTRN("[b]Hold %s:[/b] Add as child of root node.",
+ "[b]Hold %s:[/b] Add as children of root node.",
+ files.size()),
+ keycode_get_string((Key)KeyModifierMask::ALT));
if (files.size() > 1) {
title = TTR("Dropping multiple files...");
diff --git a/editor/scene/canvas_item_editor_plugin.cpp b/editor/scene/canvas_item_editor_plugin.cpp
index 204d0bd4f26..a9cca2f9362 100644
--- a/editor/scene/canvas_item_editor_plugin.cpp
+++ b/editor/scene/canvas_item_editor_plugin.cpp
@@ -4388,8 +4388,8 @@ void CanvasItemEditor::_project_settings_changed() {
void CanvasItemEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
- const String show_list_tooltip = TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.");
- select_button->set_tooltip_text(vformat(TTR("%s+Drag: Rotate selected node around pivot."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL)) + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + vformat(TTR("%s+Alt+Drag: Scale selected node."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL)) + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + show_list_tooltip + "\n" + TTR("RMB: Add node at position clicked."));
+ const String show_list_tooltip = vformat(TTR("%s+RMB: Show list of all nodes at position clicked, including locked."), keycode_get_string((Key)KeyModifierMask::ALT));
+ select_button->set_tooltip_text(vformat(TTR("%s+Drag: Rotate selected node around pivot."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL)) + "\n" + vformat(TTR("%s+Drag: Move selected node."), keycode_get_string((Key)KeyModifierMask::ALT)) + "\n" + vformat(TTR("%s+%s+Drag: Scale selected node."), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL), keycode_get_string((Key)KeyModifierMask::ALT)) + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + show_list_tooltip + "\n" + TTR("RMB: Add node at position clicked."));
move_button->set_tooltip_text(show_list_tooltip);
rotate_button->set_tooltip_text(show_list_tooltip);
scale_button->set_tooltip_text(TTR("Shift: Scale proportionally.") + "\n" + show_list_tooltip);
@@ -6644,9 +6644,10 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian
"[b]Hold Shift:[/b] Add as children of selected node.",
files.size()) +
"\n" +
- TTRN("[b]Hold Alt:[/b] Add as child of root node.",
- "[b]Hold Alt:[/b] Add as children of root node.",
- files.size());
+ vformat(TTRN("[b]Hold %s:[/b] Add as child of root node.",
+ "[b]Hold %s:[/b] Add as children of root node.",
+ files.size()),
+ keycode_get_string((Key)KeyModifierMask::ALT));
if (files.size() > 1) {
title = TTR("Dropping multiple files...");
@@ -6661,7 +6662,7 @@ bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Varian
title = TTR("Dropping a Mesh file...");
}
if (instantiate_type & TEXTURE) {
- desc += "\n" + TTR("[b]Hold Alt + Shift:[/b] Add Texture as a different node type.");
+ desc += "\n" + vformat(TTR("[b]Hold %s + Shift:[/b] Add Texture as a different node type."), keycode_get_string((Key)KeyModifierMask::ALT));
}
desc += "[/ul]";
diff --git a/editor/script/script_text_editor.cpp b/editor/script/script_text_editor.cpp
index f5d196c1c0f..bba19105d9d 100644
--- a/editor/script/script_text_editor.cpp
+++ b/editor/script/script_text_editor.cpp
@@ -1981,12 +1981,12 @@ void ScriptTextEditor::_set_drop_info_text(const Dictionary &p_info) const {
text = TTRN("Drop file path.", "Drop file paths.", files.size()) +
"\n" + vformat(TTRN("Hold %s: Add const preload by %s.", "Hold %s: Add const preloads by %s.", files.size()), c, default_drop_option) +
"\n" + vformat(TTRN("Hold %s+Shift: Add const preload by %s.", "Hold %s+Shift: Add const preloads by %s.", files.size()), c, alternate_drop_option) +
- "\n" + TTRN("Hold Alt: Add @export var pointing to the resource.", "Hold Alt: Add @export vars pointing to the resources.", files.size());
+ "\n" + vformat(TTRN("Hold %s: Add @export var pointing to the resource.", "Hold %s: Add @export vars pointing to the resources.", files.size()), keycode_get_string((Key)KeyModifierMask::ALT));
} else if (type == "nodes") {
Array nodes = p_info["nodes"];
text = TTRN("Drop node path.", "Drop node paths.", nodes.size()) +
"\n" + vformat(TTRN("Hold %s: Add @onready var pointing to the node path.", "Hold %s: Add @onready vars pointing to the node paths.", nodes.size()), c) +
- "\n" + TTRN("Hold Alt: Add @export var pointing to the node.", "Hold Alt: Add @export vars pointing to the nodes.", nodes.size());
+ "\n" + vformat(TTRN("Hold %s: Add @export var pointing to the node.", "Hold %s: Add @export vars pointing to the nodes.", nodes.size()), keycode_get_string((Key)KeyModifierMask::ALT));
} else if (type == "obj_property") {
text = TTR("Drop property path.");
}