diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-07-20 11:15:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 11:15:38 +0200 |
commit | 8b1c60c1a324ed3ae2c2d26e58a3040f8542a416 (patch) | |
tree | 095ee31d56cf1a87a1a2ce97acc1d73a8188d0d9 /editor | |
parent | d022f361d37ef8b8f1fe172ae38be4e3c55dcaff (diff) | |
parent | 195065db7820f1e075113638f71120df9575b502 (diff) |
Merge pull request #50505 from Calinou/editor-create-dialog-display-class-name
Display the class name in the description
Diffstat (limited to 'editor')
-rw-r--r-- | editor/create_dialog.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 3b002961f9..bfbd697409 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -195,7 +195,8 @@ void CreateDialog::_update_search() { select_type(_top_result(candidates, search_text)); } else { favorite->set_disabled(true); - help_bit->set_text(""); + help_bit->set_text(vformat(TTR("No results for \"%s\"."), search_text)); + help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 0.5)); get_ok_button()->set_disabled(true); search_options->deselect_all(); } @@ -393,8 +394,15 @@ void CreateDialog::select_type(const String &p_type) { to_select->select(0); search_options->scroll_to_item(to_select); - if (EditorHelp::get_doc_data()->class_list.has(p_type)) { - help_bit->set_text(DTR(EditorHelp::get_doc_data()->class_list[p_type].brief_description)); + if (EditorHelp::get_doc_data()->class_list.has(p_type) && !DTR(EditorHelp::get_doc_data()->class_list[p_type].brief_description).is_empty()) { + // Display both class name and description, since the help bit may be displayed + // far away from the location (especially if the dialog was resized to be taller). + help_bit->set_text(vformat("[b]%s[/b]: %s", p_type, DTR(EditorHelp::get_doc_data()->class_list[p_type].brief_description))); + help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 1)); + } else { + // Use nested `vformat()` as translators shouldn't interfere with BBCode tags. + help_bit->set_text(vformat(TTR("No description available for %s."), vformat("[b]%s[/b]", p_type))); + help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 0.5)); } favorite->set_disabled(false); |