From a760a7656c814bb60e7f092153313564d8c88150 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Tue, 17 Jun 2025 21:15:53 +0800 Subject: [PATCH] Show "No Translations Configured" message for empty translation preview menu --- .../translations/editor_translation_preview_menu.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/editor/translations/editor_translation_preview_menu.cpp b/editor/translations/editor_translation_preview_menu.cpp index 0aee1edfebb..17268bd4789 100644 --- a/editor/translations/editor_translation_preview_menu.cpp +++ b/editor/translations/editor_translation_preview_menu.cpp @@ -45,10 +45,16 @@ void EditorTranslationPreviewMenu::_prepare() { set_item_checked(-1, true); } + add_separator(); + const Vector locales = TranslationServer::get_singleton()->get_loaded_locales(); - if (!locales.is_empty()) { - add_separator(); + if (locales.is_empty()) { + add_item(TTRC("No Translations Configured")); + set_item_tooltip(-1, TTRC("You can add translations in the Project Settings.")); + set_item_disabled(-1, true); + return; } + for (const String &locale : locales) { const String name = TranslationServer::get_singleton()->get_locale_name(locale); add_radio_check_item(name == locale ? name : name + " [" + locale + "]");