1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Improve auto-translation of Script Editor

This commit is contained in:
kobewi
2025-05-30 01:28:43 +02:00
parent 1b37dacc18
commit c32a031908
8 changed files with 141 additions and 91 deletions

View File

@@ -419,7 +419,7 @@ String InputMap::get_builtin_display_name(const String &p_name) const {
for (int i = 0; i < len; i++) {
if (_builtin_action_display_names[i].name == p_name) {
return RTR(_builtin_action_display_names[i].display_name);
return _builtin_action_display_names[i].display_name;
}
}

View File

@@ -105,7 +105,7 @@ void GotoLinePopup::_input_from_window(const Ref<InputEvent> &p_event) {
}
GotoLinePopup::GotoLinePopup() {
set_title(TTR("Go to Line"));
set_title(TTRC("Go to Line"));
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
@@ -115,7 +115,7 @@ GotoLinePopup::GotoLinePopup() {
add_child(vbc);
Label *l = memnew(Label);
l->set_text(TTR("Line Number:"));
l->set_text(TTRC("Line Number:"));
vbc->add_child(l);
line_input = memnew(LineEdit);
@@ -142,8 +142,13 @@ void FindReplaceBar::_notification(int p_what) {
_update_toggle_replace_button(replace_text->is_visible_in_tree());
} break;
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
if (matches_label->is_visible()) {
_update_matches_display();
}
[[fallthrough]];
}
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
_update_toggle_replace_button(replace_text->is_visible_in_tree());
} break;
@@ -572,7 +577,7 @@ void FindReplaceBar::_hide_bar() {
}
void FindReplaceBar::_update_toggle_replace_button(bool p_replace_visible) {
String tooltip = p_replace_visible ? TTR("Hide Replace") : TTR("Show Replace");
String tooltip = p_replace_visible ? TTRC("Hide Replace") : TTRC("Show Replace");
String shortcut = ED_GET_SHORTCUT(p_replace_visible ? "script_text_editor/find" : "script_text_editor/replace")->get_as_text();
toggle_replace_button->set_tooltip_text(vformat("%s (%s)", tooltip, shortcut));
StringName rtl_compliant_arrow = is_layout_rtl() ? SNAME("GuiTreeArrowLeft") : SNAME("GuiTreeArrowRight");
@@ -783,8 +788,8 @@ FindReplaceBar::FindReplaceBar() {
search_text = memnew(LineEdit);
search_text->set_keep_editing_on_text_submit(true);
vbc_lineedit->add_child(search_text);
search_text->set_placeholder(TTR("Find"));
search_text->set_tooltip_text(TTR("Find"));
search_text->set_placeholder(TTRC("Find"));
search_text->set_tooltip_text(TTRC("Find"));
search_text->set_accessibility_name(TTRC("Find"));
search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
search_text->connect(SceneStringName(text_changed), callable_mp(this, &FindReplaceBar::_search_text_changed));
@@ -798,7 +803,7 @@ FindReplaceBar::FindReplaceBar() {
find_prev = memnew(Button);
find_prev->set_flat(true);
find_prev->set_disabled(results_count < 1);
find_prev->set_tooltip_text(TTR("Previous Match"));
find_prev->set_tooltip_text(TTRC("Previous Match"));
find_prev->set_accessibility_name(TTRC("Previous Match"));
hbc_button_search->add_child(find_prev);
find_prev->set_focus_mode(FOCUS_NONE);
@@ -807,7 +812,7 @@ FindReplaceBar::FindReplaceBar() {
find_next = memnew(Button);
find_next->set_flat(true);
find_next->set_disabled(results_count < 1);
find_next->set_tooltip_text(TTR("Next Match"));
find_next->set_tooltip_text(TTRC("Next Match"));
find_next->set_accessibility_name(TTRC("Next Match"));
hbc_button_search->add_child(find_next);
find_next->set_focus_mode(FOCUS_NONE);
@@ -815,44 +820,44 @@ FindReplaceBar::FindReplaceBar() {
case_sensitive = memnew(CheckBox);
hbc_option_search->add_child(case_sensitive);
case_sensitive->set_text(TTR("Match Case"));
case_sensitive->set_text(TTRC("Match Case"));
case_sensitive->set_focus_mode(FOCUS_NONE);
case_sensitive->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
whole_words = memnew(CheckBox);
hbc_option_search->add_child(whole_words);
whole_words->set_text(TTR("Whole Words"));
whole_words->set_text(TTRC("Whole Words"));
whole_words->set_focus_mode(FOCUS_NONE);
whole_words->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
// Replace toolbar.
replace_text = memnew(LineEdit);
vbc_lineedit->add_child(replace_text);
replace_text->set_placeholder(TTR("Replace"));
replace_text->set_tooltip_text(TTR("Replace"));
replace_text->set_placeholder(TTRC("Replace"));
replace_text->set_tooltip_text(TTRC("Replace"));
replace_text->set_accessibility_name(TTRC("Replace"));
replace_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
replace_text->connect(SceneStringName(text_submitted), callable_mp(this, &FindReplaceBar::_replace_text_submitted));
replace = memnew(Button);
hbc_button_replace->add_child(replace);
replace->set_text(TTR("Replace"));
replace->set_text(TTRC("Replace"));
replace->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_replace));
replace_all = memnew(Button);
hbc_button_replace->add_child(replace_all);
replace_all->set_text(TTR("Replace All"));
replace_all->set_text(TTRC("Replace All"));
replace_all->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_replace_all));
selection_only = memnew(CheckBox);
hbc_option_replace->add_child(selection_only);
selection_only->set_text(TTR("Selection Only"));
selection_only->set_text(TTRC("Selection Only"));
selection_only->set_focus_mode(FOCUS_NONE);
selection_only->connect(SceneStringName(toggled), callable_mp(this, &FindReplaceBar::_search_options_changed));
hide_button = memnew(Button);
hide_button->set_flat(true);
hide_button->set_tooltip_text(TTR("Hide"));
hide_button->set_tooltip_text(TTRC("Hide"));
hide_button->set_accessibility_name(TTRC("Hide"));
hide_button->set_focus_mode(FOCUS_NONE);
hide_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_hide_bar));
@@ -1672,8 +1677,18 @@ void CodeTextEditor::_notification(int p_what) {
_update_text_editor_theme();
} break;
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
set_indent_using_spaces(text_editor->is_indent_using_spaces());
update_toggle_files_button();
zoom_button->set_tooltip_text(
TTR("Zoom factor") + "\n" +
// TRANSLATORS: The placeholders are keyboard shortcuts. The first one is in the form of "Ctrl+"/"Cmd+".
vformat(TTR("%sMouse wheel, %s/%s: Finetune\n%s: Reset"), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL), ED_GET_SHORTCUT("script_editor/zoom_in")->get_as_text(), ED_GET_SHORTCUT("script_editor/zoom_out")->get_as_text(), ED_GET_SHORTCUT("script_editor/reset_zoom")->get_as_text()));
[[fallthrough]];
}
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
if (toggle_files_button->is_visible()) {
update_toggle_files_button();
}
@@ -1887,6 +1902,7 @@ CodeTextEditor::CodeTextEditor() {
toggle_files_button = memnew(Button);
toggle_files_button->set_flat(true);
toggle_files_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
toggle_files_button->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
toggle_files_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_toggle_files_pressed));
toggle_files_button->set_accessibility_name(TTRC("Scripts"));
status_bar->add_child(toggle_files_button);
@@ -1901,9 +1917,10 @@ CodeTextEditor::CodeTextEditor() {
error = memnew(Label);
error->set_focus_mode(FOCUS_ACCESSIBILITY);
scroll->add_child(error);
error->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
error->set_mouse_filter(MOUSE_FILTER_STOP);
scroll->add_child(error);
error->connect(SceneStringName(gui_input), callable_mp(this, &CodeTextEditor::_error_pressed));
// Errors
@@ -1913,7 +1930,7 @@ CodeTextEditor::CodeTextEditor() {
error_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
error_button->set_default_cursor_shape(CURSOR_POINTING_HAND);
error_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_error_button_pressed));
error_button->set_tooltip_text(TTR("Errors"));
error_button->set_tooltip_text(TTRC("Errors"));
error_button->set_accessibility_name(TTRC("Errors"));
// Warnings
@@ -1923,7 +1940,7 @@ CodeTextEditor::CodeTextEditor() {
warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND);
warning_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_warning_button_pressed));
warning_button->set_tooltip_text(TTR("Warnings"));
warning_button->set_tooltip_text(TTRC("Warnings"));
warning_button->set_accessibility_name(TTRC("Warnings"));
status_bar->add_child(memnew(VSeparator));
@@ -1933,10 +1950,6 @@ CodeTextEditor::CodeTextEditor() {
status_bar->add_child(zoom_button);
zoom_button->set_flat(true);
zoom_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
zoom_button->set_tooltip_text(
TTR("Zoom factor") + "\n" +
// TRANSLATORS: The placeholders are keyboard shortcuts. The first one is in the form of "Ctrl+"/"Cmd+".
vformat(TTR("%sMouse wheel, %s/%s: Finetune\n%s: Reset"), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL), ED_GET_SHORTCUT("script_editor/zoom_in")->get_as_text(), ED_GET_SHORTCUT("script_editor/zoom_out")->get_as_text(), ED_GET_SHORTCUT("script_editor/reset_zoom")->get_as_text()));
zoom_button->set_text("100 %");
zoom_button->set_accessibility_name(TTRC("Zoom Factor"));
@@ -1957,7 +1970,9 @@ CodeTextEditor::CodeTextEditor() {
line_and_col_txt = memnew(Label);
status_bar->add_child(line_and_col_txt);
line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
line_and_col_txt->set_tooltip_text(TTR("Line and column numbers."));
line_and_col_txt->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
line_and_col_txt->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_ALWAYS);
line_and_col_txt->set_tooltip_text(TTRC("Line and column numbers."));
line_and_col_txt->set_accessibility_name(TTRC("Line and Column Numbers"));
line_and_col_txt->set_focus_mode(FOCUS_ACCESSIBILITY);
line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP);
@@ -1968,7 +1983,9 @@ CodeTextEditor::CodeTextEditor() {
indentation_txt = memnew(Label);
status_bar->add_child(indentation_txt);
indentation_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
indentation_txt->set_tooltip_text(TTR("Indentation"));
indentation_txt->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
indentation_txt->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_ALWAYS);
indentation_txt->set_tooltip_text(TTRC("Indentation"));
indentation_txt->set_accessibility_name(TTRC("Indentation"));
indentation_txt->set_focus_mode(FOCUS_ACCESSIBILITY);
indentation_txt->set_mouse_filter(MOUSE_FILTER_STOP);

View File

@@ -524,7 +524,7 @@ void EditorDebuggerNode::_debug_data(const String &p_msg, const Array &p_data, i
void EditorDebuggerNode::set_script_debug_button(MenuButton *p_button) {
script_menu = p_button;
script_menu->set_text(TTR("Debug"));
script_menu->set_text(TTRC("Debug"));
script_menu->set_switch_on_hover(true);
PopupMenu *p = script_menu->get_popup();
p->add_shortcut(ED_GET_SHORTCUT("debugger/step_into"), DEBUG_STEP);

View File

@@ -3249,9 +3249,26 @@ void EditorHelp::_notification(int p_what) {
update_toggle_files_button();
} break;
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_VISIBILITY_CHANGED: {
if (update_pending && is_visible_in_tree()) {
_update_doc();
}
update_toggle_files_button();
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
if (!is_ready()) {
break;
}
if (is_visible_in_tree()) {
_update_doc();
} else {
update_pending = true;
}
[[fallthrough]];
}
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
update_toggle_files_button();
} break;
}
@@ -3372,6 +3389,7 @@ EditorHelp::EditorHelp() {
toggle_files_button = memnew(Button);
toggle_files_button->set_accessibility_name(TTRC("Scripts"));
toggle_files_button->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
toggle_files_button->set_flat(true);
toggle_files_button->connect(SceneStringName(pressed), callable_mp(this, &EditorHelp::_toggle_files_pressed));
status_bar->add_child(toggle_files_button);

View File

@@ -94,6 +94,7 @@ class EditorHelp : public VBoxContainer {
};
bool select_locked = false;
bool update_pending = false;
String prev_search;

View File

@@ -446,12 +446,12 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() {
VBoxContainer *vbc = memnew(VBoxContainer);
add_child(vbc);
search_box = memnew(LineEdit);
vbc->add_margin_child(TTR("Search:"), search_box);
vbc->add_margin_child(TTRC("Search:"), search_box);
search_box->connect(SceneStringName(text_changed), callable_mp(this, &ScriptEditorQuickOpen::_text_changed));
search_box->connect(SceneStringName(gui_input), callable_mp(this, &ScriptEditorQuickOpen::_sbox_input));
search_options = memnew(Tree);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
set_ok_button_text(TTR("Open"));
vbc->add_margin_child(TTRC("Matches:"), search_options, true);
set_ok_button_text(TTRC("Open"));
get_ok_button()->set_disabled(true);
register_text_enter(search_box);
set_hide_on_ok(false);
@@ -1322,7 +1322,7 @@ void ScriptEditor::_menu_option(int p_option) {
for (const String &E : textfile_extensions) {
file_dialog->add_filter("*." + E, E.to_upper());
}
file_dialog->set_title(TTR("New Text File..."));
file_dialog->set_title(TTRC("New Text File..."));
file_dialog->popup_file_dialog();
open_textfile_after_create = true;
} break;
@@ -1342,7 +1342,7 @@ void ScriptEditor::_menu_option(int p_option) {
file_dialog->add_filter("*." + E, E.to_upper());
}
file_dialog->set_title(TTR("Open File"));
file_dialog->set_title(TTRC("Open File"));
file_dialog->popup_file_dialog();
return;
} break;
@@ -1485,7 +1485,7 @@ void ScriptEditor::_menu_option(int p_option) {
file_dialog->clear_filters();
file_dialog->set_current_dir(text_file->get_path().get_base_dir());
file_dialog->set_current_file(text_file->get_path().get_file());
file_dialog->set_title(TTR("Save File As..."));
file_dialog->set_title(TTRC("Save File As..."));
file_dialog->popup_file_dialog();
break;
}
@@ -1634,7 +1634,7 @@ void ScriptEditor::_theme_option(int p_option) {
file_dialog_option = THEME_IMPORT;
file_dialog->clear_filters();
file_dialog->add_filter("*.tet");
file_dialog->set_title(TTR("Import Theme"));
file_dialog->set_title(TTRC("Import Theme"));
file_dialog->popup_file_dialog();
} break;
case THEME_RELOAD: {
@@ -1660,7 +1660,7 @@ void ScriptEditor::_show_save_theme_as_dialog() {
file_dialog->clear_filters();
file_dialog->add_filter("*.tet");
file_dialog->set_current_path(EditorPaths::get_singleton()->get_text_editor_themes_dir().path_join(EDITOR_GET("text_editor/theme/color_theme")));
file_dialog->set_title(TTR("Save Theme As..."));
file_dialog->set_title(TTRC("Save Theme As..."));
file_dialog->popup_file_dialog();
}
@@ -1747,7 +1747,14 @@ void ScriptEditor::_notification(int p_what) {
[[fallthrough]];
}
case NOTIFICATION_TRANSLATION_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
_update_online_doc();
if (!make_floating->is_disabled()) {
// Override default ScreenSelect tooltip if multi-window support is available.
make_floating->set_tooltip_text(TTR("Make the script editor floating.") + "\n" + TTR("Right-click to open the screen selector."));
}
[[fallthrough]];
}
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
tab_container->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("ScriptEditor"), EditorStringName(EditorStyles)));
@@ -2143,11 +2150,11 @@ void ScriptEditor::_update_online_doc() {
if (native_class_doc) {
String name = eh->get_class();
String tooltip = vformat(TTR("Open '%s' in Godot online documentation."), name);
site_search->set_text(TTR("Open in Online Docs"));
site_search->set_text(TTRC("Open in Online Docs"));
site_search->set_tooltip_text(tooltip);
} else {
site_search->set_text(TTR("Online Docs"));
site_search->set_tooltip_text(TTR("Open Godot online documentation."));
site_search->set_text(TTRC("Online Docs"));
site_search->set_tooltip_text(TTRC("Open Godot online documentation."));
}
}
@@ -4180,7 +4187,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
list_split->add_child(scripts_vbox);
filter_scripts = memnew(LineEdit);
filter_scripts->set_placeholder(TTR("Filter Scripts"));
filter_scripts->set_placeholder(TTRC("Filter Scripts"));
filter_scripts->set_accessibility_name(TTRC("Filter Scripts"));
filter_scripts->set_clear_button_enabled(true);
filter_scripts->connect(SceneStringName(text_changed), callable_mp(this, &ScriptEditor::_filter_scripts_text_changed));
@@ -4223,7 +4230,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
members_overview_alphabeta_sort_button = memnew(Button);
members_overview_alphabeta_sort_button->set_flat(true);
members_overview_alphabeta_sort_button->set_accessibility_name(TTRC("Alphabetical Sorting"));
members_overview_alphabeta_sort_button->set_tooltip_text(TTR("Toggle alphabetical sorting of the method list."));
members_overview_alphabeta_sort_button->set_tooltip_text(TTRC("Toggle alphabetical sorting of the method list."));
members_overview_alphabeta_sort_button->set_toggle_mode(true);
members_overview_alphabeta_sort_button->set_pressed(EDITOR_GET("text_editor/script_list/sort_members_outline_alphabetically"));
members_overview_alphabeta_sort_button->connect(SceneStringName(toggled), callable_mp(this, &ScriptEditor::_toggle_members_overview_alpha_sort));
@@ -4231,7 +4238,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
buttons_hbox->add_child(members_overview_alphabeta_sort_button);
filter_methods = memnew(LineEdit);
filter_methods->set_placeholder(TTR("Filter Methods"));
filter_methods->set_placeholder(TTRC("Filter Methods"));
filter_methods->set_accessibility_name(TTRC("Filter Methods"));
filter_methods->set_clear_button_enabled(true);
filter_methods->connect(SceneStringName(text_changed), callable_mp(this, &ScriptEditor::_filter_methods_text_changed));
@@ -4279,7 +4286,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
set_process_shortcut_input(true);
file_menu = memnew(MenuButton);
file_menu->set_text(TTR("File"));
file_menu->set_text(TTRC("File"));
file_menu->set_switch_on_hover(true);
file_menu->set_shortcut_context(this);
menu_hb->add_child(file_menu);
@@ -4291,7 +4298,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
recent_scripts = memnew(PopupMenu);
recent_scripts->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
file_menu->get_popup()->add_submenu_node_item(TTR("Open Recent"), recent_scripts, FILE_MENU_OPEN_RECENT);
file_menu->get_popup()->add_submenu_node_item(TTRC("Open Recent"), recent_scripts, FILE_MENU_OPEN_RECENT);
recent_scripts->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditor::_open_recent_script));
_update_recent_scripts();
@@ -4324,7 +4331,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
theme_submenu = memnew(PopupMenu);
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/import_theme", TTRC("Import Theme...")), THEME_IMPORT);
theme_submenu->add_shortcut(ED_SHORTCUT("script_editor/reload_theme", TTRC("Reload Theme")), THEME_RELOAD);
file_menu->get_popup()->add_submenu_node_item(TTR("Theme"), theme_submenu, FILE_MENU_THEME_SUBMENU);
file_menu->get_popup()->add_submenu_node_item(TTRC("Theme"), theme_submenu, FILE_MENU_THEME_SUBMENU);
theme_submenu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditor::_theme_option));
theme_submenu->add_separator();
@@ -4348,7 +4355,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
file_menu->get_popup()->connect("popup_hide", callable_mp(this, &ScriptEditor::_file_menu_closed));
script_search_menu = memnew(MenuButton);
script_search_menu->set_text(TTR("Search"));
script_search_menu->set_text(TTRC("Search"));
script_search_menu->set_switch_on_hover(true);
script_search_menu->set_shortcut_context(this);
script_search_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptEditor::_menu_option));
@@ -4388,10 +4395,10 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
help_search = memnew(Button);
help_search->set_flat(true);
help_search->set_text(TTR("Search Help"));
help_search->set_text(TTRC("Search Help"));
help_search->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditor::_menu_option).bind(SEARCH_HELP));
menu_hb->add_child(help_search);
help_search->set_tooltip_text(TTR("Search the reference documentation."));
help_search->set_tooltip_text(TTRC("Search the reference documentation."));
menu_hb->add_child(memnew(VSeparator));
@@ -4401,7 +4408,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
script_back->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditor::_history_back));
menu_hb->add_child(script_back);
script_back->set_disabled(true);
script_back->set_tooltip_text(TTR("Go to previous edited document."));
script_back->set_tooltip_text(TTRC("Go to previous edited document."));
script_forward = memnew(Button);
script_forward->set_accessibility_name(TTRC("Next"));
@@ -4409,17 +4416,14 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
script_forward->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditor::_history_forward));
menu_hb->add_child(script_forward);
script_forward->set_disabled(true);
script_forward->set_tooltip_text(TTR("Go to next edited document."));
script_forward->set_tooltip_text(TTRC("Go to next edited document."));
menu_hb->add_child(memnew(VSeparator));
make_floating = memnew(ScreenSelect);
make_floating->set_flat(true);
make_floating->set_tooltip_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
make_floating->connect("request_open_in_screen", callable_mp(window_wrapper, &WindowWrapper::enable_window_on_screen).bind(true));
if (!make_floating->is_disabled()) {
// Override default ScreenSelect tooltip if multi-window support is available.
make_floating->set_tooltip_text(TTR("Make the script editor floating.") + "\n" + TTR("Right-click to open the screen selector."));
}
menu_hb->add_child(make_floating);
p_wrapper->connect("window_visibility_changed", callable_mp(this, &ScriptEditor::_window_changed));
@@ -4427,14 +4431,14 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
tab_container->connect("tab_changed", callable_mp(this, &ScriptEditor::_tab_changed));
erase_tab_confirm = memnew(ConfirmationDialog);
erase_tab_confirm->set_ok_button_text(TTR("Save"));
erase_tab_confirm->add_button(TTR("Discard"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
erase_tab_confirm->set_ok_button_text(TTRC("Save"));
erase_tab_confirm->add_button(TTRC("Discard"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
erase_tab_confirm->connect(SceneStringName(confirmed), callable_mp(this, &ScriptEditor::_close_current_tab).bind(true, true));
erase_tab_confirm->connect("custom_action", callable_mp(this, &ScriptEditor::_close_discard_current_tab));
add_child(erase_tab_confirm);
script_create_dialog = memnew(ScriptCreateDialog);
script_create_dialog->set_title(TTR("Create Script"));
script_create_dialog->set_title(TTRC("Create Script"));
add_child(script_create_dialog);
script_create_dialog->connect("script_created", callable_mp(this, &ScriptEditor::_script_created));
@@ -4448,13 +4452,13 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
disk_changed = memnew(ConfirmationDialog);
{
disk_changed->set_title(TTR("Files have been modified outside Godot"));
disk_changed->set_title(TTRC("Files have been modified outside Godot"));
VBoxContainer *vbc = memnew(VBoxContainer);
disk_changed->add_child(vbc);
Label *files_are_newer_label = memnew(Label);
files_are_newer_label->set_text(TTR("The following files are newer on disk:"));
files_are_newer_label->set_text(TTRC("The following files are newer on disk:"));
vbc->add_child(files_are_newer_label);
disk_changed_list = memnew(Tree);
@@ -4465,13 +4469,13 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
vbc->add_child(disk_changed_list);
Label *what_action_label = memnew(Label);
what_action_label->set_text(TTR("What action should be taken?"));
what_action_label->set_text(TTRC("What action should be taken?"));
vbc->add_child(what_action_label);
disk_changed->connect(SceneStringName(confirmed), callable_mp(this, &ScriptEditor::reload_scripts).bind(false));
disk_changed->set_ok_button_text(TTR("Reload from disk"));
disk_changed->set_ok_button_text(TTRC("Reload from disk"));
disk_changed->add_button(TTR("Ignore external changes"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
disk_changed->add_button(TTRC("Ignore external changes"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
disk_changed->connect("custom_action", callable_mp(this, &ScriptEditor::_resave_scripts));
}
@@ -4496,7 +4500,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
find_in_files_dialog->connect(FindInFilesDialog::SIGNAL_REPLACE_REQUESTED, callable_mp(this, &ScriptEditor::_start_find_in_files).bind(true));
add_child(find_in_files_dialog);
find_in_files = memnew(FindInFilesPanel);
find_in_files_button = EditorNode::get_bottom_panel()->add_item(TTR("Search Results"), find_in_files, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_search_results_bottom_panel", TTRC("Toggle Search Results Bottom Panel")));
find_in_files_button = EditorNode::get_bottom_panel()->add_item(TTRC("Search Results"), find_in_files, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_search_results_bottom_panel", TTRC("Toggle Search Results Bottom Panel")));
find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE);
find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, callable_mp(this, &ScriptEditor::_on_find_in_files_result_selected));
find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, callable_mp(this, &ScriptEditor::_on_find_in_files_modified_files));
@@ -4552,6 +4556,9 @@ void ScriptEditorPlugin::_window_visibility_changed(bool p_visible) {
void ScriptEditorPlugin::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
window_wrapper->set_window_title(vformat(TTR("%s - Godot Engine"), TTR("Script Editor")));
} break;
case NOTIFICATION_ENTER_TREE: {
connect("main_screen_changed", callable_mp(this, &ScriptEditorPlugin::_save_last_editor));
} break;
@@ -4713,7 +4720,6 @@ ScriptEditorPlugin::ScriptEditorPlugin() {
ED_SHORTCUT("script_text_editor/capitalize", TTRC("Capitalize"), KeyModifierMask::SHIFT | Key::F6);
window_wrapper = memnew(WindowWrapper);
window_wrapper->set_window_title(vformat(TTR("%s - Godot Engine"), TTR("Script Editor")));
window_wrapper->set_margins_enabled(true);
script_editor = memnew(ScriptEditor(window_wrapper));

View File

@@ -90,7 +90,7 @@ void ConnectionInfoDialog::popup_connections(const String &p_method, const Vecto
}
ConnectionInfoDialog::ConnectionInfoDialog() {
set_title(TTR("Connections to method:"));
set_title(TTRC("Connections to method:"));
VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 8 * EDSCALE);
@@ -101,6 +101,7 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
method = memnew(Label);
method->set_focus_mode(Control::FOCUS_ACCESSIBILITY);
method->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
method->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
vbc->add_child(method);
@@ -109,9 +110,9 @@ ConnectionInfoDialog::ConnectionInfoDialog() {
tree->set_columns(3);
tree->set_hide_root(true);
tree->set_column_titles_visible(true);
tree->set_column_title(0, TTR("Source"));
tree->set_column_title(1, TTR("Signal"));
tree->set_column_title(2, TTR("Target"));
tree->set_column_title(0, TTRC("Source"));
tree->set_column_title(1, TTRC("Signal"));
tree->set_column_title(2, TTRC("Target"));
vbc->add_child(tree);
tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tree->set_allow_rmb_select(true);
@@ -1881,7 +1882,6 @@ void ScriptTextEditor::_edit_option(int p_op) {
} break;
case SEARCH_LOCATE_FUNCTION: {
quick_open->popup_dialog(get_functions());
quick_open->set_title(TTR("Go to Function"));
} break;
case SEARCH_GOTO_LINE: {
goto_line_popup->popup_find_line(code_editor);
@@ -2044,6 +2044,13 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) {
void ScriptTextEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_ready() && is_visible_in_tree()) {
_update_errors();
_update_warnings();
}
} break;
case NOTIFICATION_THEME_CHANGED:
if (!editor_enabled) {
break;
@@ -2537,7 +2544,7 @@ void ScriptTextEditor::_prepare_edit_menu() {
void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p_foldable, bool p_open_docs, bool p_goto_definition, Vector2 p_pos) {
context_menu->clear();
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
context_menu->add_item(TTR("Emoji & Symbols"), EDIT_EMOJI_AND_SYMBOL);
context_menu->add_item(TTRC("Emoji & Symbols"), EDIT_EMOJI_AND_SYMBOL);
context_menu->add_separator();
}
context_menu->add_shortcut(ED_GET_SHORTCUT("ui_undo"), EDIT_UNDO);
@@ -2574,7 +2581,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color, bool p
context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_symbol"), LOOKUP_SYMBOL);
}
if (p_color) {
context_menu->add_item(TTR("Pick Color"), EDIT_PICK_COLOR);
context_menu->add_item(TTRC("Pick Color"), EDIT_PICK_COLOR);
}
}
@@ -2641,6 +2648,7 @@ void ScriptTextEditor::_enable_code_editor() {
color_panel->add_child(color_picker);
quick_open = memnew(ScriptEditorQuickOpen);
quick_open->set_title(TTRC("Go to Function"));
quick_open->connect("goto_line", callable_mp(this, &ScriptTextEditor::_goto_line));
add_child(quick_open);
@@ -2673,7 +2681,7 @@ void ScriptTextEditor::_enable_code_editor() {
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/delete_line"), EDIT_DELETE_LINE);
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"), EDIT_TOGGLE_COMMENT);
sub_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptTextEditor::_edit_option));
edit_menu->get_popup()->add_submenu_node_item(TTR("Line"), sub_menu);
edit_menu->get_popup()->add_submenu_node_item(TTRC("Line"), sub_menu);
}
{
PopupMenu *sub_menu = memnew(PopupMenu);
@@ -2682,7 +2690,7 @@ void ScriptTextEditor::_enable_code_editor() {
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/unfold_all_lines"), EDIT_UNFOLD_ALL_LINES);
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/create_code_region"), EDIT_CREATE_CODE_REGION);
sub_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptTextEditor::_edit_option));
edit_menu->get_popup()->add_submenu_node_item(TTR("Folding"), sub_menu);
edit_menu->get_popup()->add_submenu_node_item(TTRC("Folding"), sub_menu);
}
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("ui_text_completion_query"), EDIT_COMPLETE);
@@ -2694,7 +2702,7 @@ void ScriptTextEditor::_enable_code_editor() {
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS);
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT);
sub_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptTextEditor::_edit_option));
edit_menu->get_popup()->add_submenu_node_item(TTR("Indentation"), sub_menu);
edit_menu->get_popup()->add_submenu_node_item(TTRC("Indentation"), sub_menu);
}
edit_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptTextEditor::_edit_option));
edit_menu->get_popup()->add_separator();
@@ -2704,9 +2712,9 @@ void ScriptTextEditor::_enable_code_editor() {
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_lowercase"), EDIT_TO_LOWERCASE);
sub_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/capitalize"), EDIT_CAPITALIZE);
sub_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptTextEditor::_edit_option));
edit_menu->get_popup()->add_submenu_node_item(TTR("Convert Case"), sub_menu);
edit_menu->get_popup()->add_submenu_node_item(TTRC("Convert Case"), sub_menu);
}
edit_menu->get_popup()->add_submenu_node_item(TTR("Syntax Highlighter"), highlighter_menu);
edit_menu->get_popup()->add_submenu_node_item(TTRC("Syntax Highlighter"), highlighter_menu);
highlighter_menu->connect(SceneStringName(id_pressed), callable_mp(this, &ScriptTextEditor::_change_syntax_highlighter));
edit_hb->add_child(search_menu);
@@ -2729,12 +2737,12 @@ void ScriptTextEditor::_enable_code_editor() {
goto_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_symbol"), LOOKUP_SYMBOL);
goto_menu->get_popup()->add_separator();
goto_menu->get_popup()->add_submenu_node_item(TTR("Bookmarks"), bookmarks_menu);
goto_menu->get_popup()->add_submenu_node_item(TTRC("Bookmarks"), bookmarks_menu);
_update_bookmark_list();
bookmarks_menu->connect("about_to_popup", callable_mp(this, &ScriptTextEditor::_update_bookmark_list));
bookmarks_menu->connect("index_pressed", callable_mp(this, &ScriptTextEditor::_bookmark_item_pressed));
goto_menu->get_popup()->add_submenu_node_item(TTR("Breakpoints"), breakpoints_menu);
goto_menu->get_popup()->add_submenu_node_item(TTRC("Breakpoints"), breakpoints_menu);
_update_breakpoint_list();
breakpoints_menu->connect("about_to_popup", callable_mp(this, &ScriptTextEditor::_update_breakpoint_list));
breakpoints_menu->connect("index_pressed", callable_mp(this, &ScriptTextEditor::_breakpoint_item_pressed));
@@ -2794,7 +2802,7 @@ ScriptTextEditor::ScriptTextEditor() {
edit_hb = memnew(HBoxContainer);
edit_menu = memnew(MenuButton);
edit_menu->set_text(TTR("Edit"));
edit_menu->set_text(TTRC("Edit"));
edit_menu->set_switch_on_hover(true);
edit_menu->set_shortcut_context(this);
@@ -2810,12 +2818,12 @@ ScriptTextEditor::ScriptTextEditor() {
set_syntax_highlighter(highlighter);
search_menu = memnew(MenuButton);
search_menu->set_text(TTR("Search"));
search_menu->set_text(TTRC("Search"));
search_menu->set_switch_on_hover(true);
search_menu->set_shortcut_context(this);
goto_menu = memnew(MenuButton);
goto_menu->set_text(TTR("Go To"));
goto_menu->set_text(TTRC("Go To"));
goto_menu->set_switch_on_hover(true);
goto_menu->set_shortcut_context(this);

View File

@@ -563,7 +563,7 @@ void TextEditor::_prepare_edit_menu() {
void TextEditor::_make_context_menu(bool p_selection, bool p_can_fold, bool p_is_folded, Vector2 p_position) {
context_menu->clear();
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_EMOJI_AND_SYMBOL_PICKER)) {
context_menu->add_item(TTR("Emoji & Symbols"), EDIT_EMOJI_AND_SYMBOL);
context_menu->add_item(TTRC("Emoji & Symbols"), EDIT_EMOJI_AND_SYMBOL);
context_menu->add_separator();
}
if (p_selection) {
@@ -628,7 +628,7 @@ TextEditor::TextEditor() {
edit_menu = memnew(MenuButton);
edit_menu->set_shortcut_context(this);
edit_hb->add_child(edit_menu);
edit_menu->set_text(TTR("Edit"));
edit_menu->set_text(TTRC("Edit"));
edit_menu->set_switch_on_hover(true);
edit_menu->connect("about_to_popup", callable_mp(this, &TextEditor::_prepare_edit_menu));
edit_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &TextEditor::_edit_option));
@@ -661,14 +661,14 @@ TextEditor::TextEditor() {
edit_menu->get_popup()->add_separator();
PopupMenu *convert_case = memnew(PopupMenu);
edit_menu->get_popup()->add_submenu_node_item(TTR("Convert Case"), convert_case);
edit_menu->get_popup()->add_submenu_node_item(TTRC("Convert Case"), convert_case);
convert_case->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_uppercase"), EDIT_TO_UPPERCASE);
convert_case->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_to_lowercase"), EDIT_TO_LOWERCASE);
convert_case->add_shortcut(ED_GET_SHORTCUT("script_text_editor/capitalize"), EDIT_CAPITALIZE);
convert_case->connect(SceneStringName(id_pressed), callable_mp(this, &TextEditor::_edit_option));
highlighter_menu = memnew(PopupMenu);
edit_menu->get_popup()->add_submenu_node_item(TTR("Syntax Highlighter"), highlighter_menu);
edit_menu->get_popup()->add_submenu_node_item(TTRC("Syntax Highlighter"), highlighter_menu);
highlighter_menu->connect(SceneStringName(id_pressed), callable_mp(this, &TextEditor::_change_syntax_highlighter));
Ref<EditorPlainTextSyntaxHighlighter> plain_highlighter;
@@ -683,7 +683,7 @@ TextEditor::TextEditor() {
search_menu = memnew(MenuButton);
search_menu->set_shortcut_context(this);
edit_hb->add_child(search_menu);
search_menu->set_text(TTR("Search"));
search_menu->set_text(TTRC("Search"));
search_menu->set_switch_on_hover(true);
search_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &TextEditor::_edit_option));
@@ -698,7 +698,7 @@ TextEditor::TextEditor() {
MenuButton *goto_menu = memnew(MenuButton);
goto_menu->set_shortcut_context(this);
edit_hb->add_child(goto_menu);
goto_menu->set_text(TTR("Go To"));
goto_menu->set_text(TTRC("Go To"));
goto_menu->set_switch_on_hover(true);
goto_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &TextEditor::_edit_option));
@@ -706,7 +706,7 @@ TextEditor::TextEditor() {
goto_menu->get_popup()->add_separator();
bookmarks_menu = memnew(PopupMenu);
goto_menu->get_popup()->add_submenu_node_item(TTR("Bookmarks"), bookmarks_menu);
goto_menu->get_popup()->add_submenu_node_item(TTRC("Bookmarks"), bookmarks_menu);
_update_bookmark_list();
bookmarks_menu->connect("about_to_popup", callable_mp(this, &TextEditor::_update_bookmark_list));
bookmarks_menu->connect("index_pressed", callable_mp(this, &TextEditor::_bookmark_item_pressed));