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

Merge pull request #102562 from KoBeWi/edytor_dans_todos_Sprache

Enable changing editor language without restart
This commit is contained in:
Thaddeus Crews
2025-03-24 15:27:33 -05:00
3 changed files with 13 additions and 9 deletions

View File

@@ -7436,7 +7436,7 @@ EditorNode::EditorNode() {
main_menu->set_switch_on_hover(true); main_menu->set_switch_on_hover(true);
file_menu = memnew(PopupMenu); file_menu = memnew(PopupMenu);
file_menu->set_name(TTR("Scene")); file_menu->set_name(TTRC("Scene"));
main_menu->add_child(file_menu); main_menu->add_child(file_menu);
main_menu->set_menu_tooltip(0, TTR("Operations with scene files.")); main_menu->set_menu_tooltip(0, TTR("Operations with scene files."));
@@ -7562,7 +7562,7 @@ EditorNode::EditorNode() {
#endif #endif
project_menu = memnew(PopupMenu); project_menu = memnew(PopupMenu);
project_menu->set_name(TTR("Project")); project_menu->set_name(TTRC("Project"));
main_menu->add_child(project_menu); main_menu->add_child(project_menu);
project_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/project_settings", TTRC("Project Settings..."), Key::NONE, TTRC("Project Settings")), PROJECT_OPEN_SETTINGS); project_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/project_settings", TTRC("Project Settings..."), Key::NONE, TTRC("Project Settings")), PROJECT_OPEN_SETTINGS);
@@ -7619,11 +7619,11 @@ EditorNode::EditorNode() {
// Options are added and handled by DebuggerEditorPlugin. // Options are added and handled by DebuggerEditorPlugin.
debug_menu = memnew(PopupMenu); debug_menu = memnew(PopupMenu);
debug_menu->set_name(TTR("Debug")); debug_menu->set_name(TTRC("Debug"));
main_menu->add_child(debug_menu); main_menu->add_child(debug_menu);
settings_menu = memnew(PopupMenu); settings_menu = memnew(PopupMenu);
settings_menu->set_name(TTR("Editor")); settings_menu->set_name(TTRC("Editor"));
main_menu->add_child(settings_menu); main_menu->add_child(settings_menu);
#ifdef MACOS_ENABLED #ifdef MACOS_ENABLED
@@ -7673,7 +7673,7 @@ EditorNode::EditorNode() {
#endif #endif
help_menu = memnew(PopupMenu); help_menu = memnew(PopupMenu);
help_menu->set_name(TTR("Help")); help_menu->set_name(TTRC("Help"));
if (global_menu && NativeMenu::get_singleton()->has_system_menu(NativeMenu::HELP_MENU_ID)) { if (global_menu && NativeMenu::get_singleton()->has_system_menu(NativeMenu::HELP_MENU_ID)) {
help_menu->set_system_menu(NativeMenu::HELP_MENU_ID); help_menu->set_system_menu(NativeMenu::HELP_MENU_ID);
} }

View File

@@ -77,6 +77,10 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
} }
} }
emit_signal(SNAME("settings_changed")); emit_signal(SNAME("settings_changed"));
if (p_name == SNAME("interface/editor/editor_language")) {
setup_language();
}
} }
return true; return true;
} }
@@ -1323,9 +1327,9 @@ fail:
void EditorSettings::setup_language() { void EditorSettings::setup_language() {
String lang = get("interface/editor/editor_language"); String lang = get("interface/editor/editor_language");
TranslationServer::get_singleton()->set_locale(lang);
if (lang == "en") { if (lang == "en") {
TranslationServer::get_singleton()->set_locale(lang);
return; // Default, nothing to do. return; // Default, nothing to do.
} }
// Load editor translation for configured/detected locale. // Load editor translation for configured/detected locale.
@@ -1337,6 +1341,8 @@ void EditorSettings::setup_language() {
// Load extractable translation for projects. // Load extractable translation for projects.
load_extractable_translations(lang); load_extractable_translations(lang);
TranslationServer::get_singleton()->set_locale(lang);
} }
void EditorSettings::setup_network() { void EditorSettings::setup_network() {

View File

@@ -769,9 +769,7 @@ void SceneTree::_main_window_focus_in() {
void SceneTree::_notification(int p_notification) { void SceneTree::_notification(int p_notification) {
switch (p_notification) { switch (p_notification) {
case NOTIFICATION_TRANSLATION_CHANGED: { case NOTIFICATION_TRANSLATION_CHANGED: {
if (!Engine::get_singleton()->is_editor_hint()) { get_root()->propagate_notification(p_notification);
get_root()->propagate_notification(p_notification);
}
} break; } break;
case NOTIFICATION_OS_MEMORY_WARNING: case NOTIFICATION_OS_MEMORY_WARNING: