From b291156ecec7c645e8b934704a3a6fdd450ca286 Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 27 Mar 2025 18:15:16 +0100 Subject: [PATCH] Inspector localization improvements --- editor/editor_inspector.cpp | 15 ++++++++------- editor/editor_property_name_processor.cpp | 6 +----- editor/inspector_dock.cpp | 5 ++++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 94fcd31a3df..ca78710c0da 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -4750,6 +4750,12 @@ void EditorInspector::_clear_current_favorites() { void EditorInspector::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_TRANSLATION_CHANGED: { + if (property_name_style == EditorPropertyNameProcessor::STYLE_LOCALIZED) { + update_tree_pending = true; + } + } break; + case NOTIFICATION_THEME_CHANGED: { favorites_category->icon = get_editor_theme_icon(SNAME("Favorites")); @@ -4830,7 +4836,6 @@ void EditorInspector::_notification(int p_what) { } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - bool needs_update = false; if (!is_sub_inspector() && EditorThemeManager::is_generated_theme_outdated()) { add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), SNAME("Tree"))); } @@ -4839,16 +4844,12 @@ void EditorInspector::_notification(int p_what) { EditorPropertyNameProcessor::Style style = EditorPropertyNameProcessor::get_settings_style(); if (property_name_style != style) { property_name_style = style; - needs_update = true; + update_tree_pending = true; } } if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/inspector")) { - needs_update = true; - } - - if (needs_update) { - update_tree(); + update_tree_pending = true; } } break; } diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index 3055dc494da..1cbb2f3bb54 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -59,11 +59,7 @@ EditorPropertyNameProcessor::Style EditorPropertyNameProcessor::get_tooltip_styl } bool EditorPropertyNameProcessor::is_localization_available() { - if (!EditorSettings::get_singleton()) { - return false; - } - const Vector forbidden = String("en").split(","); - return !forbidden.has(EDITOR_GET("interface/editor/editor_language")); + return EditorSettings::get_singleton() && EDITOR_GET("interface/editor/editor_language") != "en"; } String EditorPropertyNameProcessor::_capitalize_name(const String &p_name) const { diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index e8ee16e7524..4ea1408bb37 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -442,8 +442,11 @@ Container *InspectorDock::get_addon_area() { void InspectorDock::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_TRANSLATION_CHANGED: { + update(current); + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: - case NOTIFICATION_TRANSLATION_CHANGED: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: { resource_new_button->set_button_icon(get_editor_theme_icon(SNAME("New"))); resource_load_button->set_button_icon(get_editor_theme_icon(SNAME("Load")));