Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions editor/settings/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "editor/inspector/editor_property_name_processor.h"
#include "editor/project_manager/engine_update_label.h"
#include "editor/translations/editor_translation.h"
#include "main/main.h"
#include "modules/regex/regex.h"
#include "scene/gui/color_picker.h"
#include "scene/main/node.h"
Expand Down Expand Up @@ -79,7 +80,7 @@ bool EditorSettings::_set(const StringName &p_name, const Variant &p_value) {
emit_signal(SNAME("settings_changed"));

if (p_name == SNAME("interface/editor/editor_language")) {
setup_language();
setup_language(false);
}
}
return true;
Expand Down Expand Up @@ -1289,7 +1290,7 @@ void EditorSettings::create() {

print_verbose("EditorSettings: Load OK!");

singleton->setup_language();
singleton->setup_language(true);
singleton->setup_network();
singleton->load_favorites_and_recent_dirs();
singleton->update_text_editor_themes_list();
Expand All @@ -1316,13 +1317,19 @@ void EditorSettings::create() {
singleton->set_path(config_file_path, true);
singleton->save_changed_setting = true;
singleton->_load_defaults(extra_config);
singleton->setup_language();
singleton->setup_language(true);
singleton->setup_network();
singleton->update_text_editor_themes_list();
}

void EditorSettings::setup_language() {
void EditorSettings::setup_language(bool p_initial_setup) {
String lang = _EDITOR_GET("interface/editor/editor_language");
if (p_initial_setup) {
String lang_ov = Main::get_locale_override();
if (!lang_ov.is_empty()) {
lang = lang_ov;
}
}

if (lang == "en") {
TranslationServer::get_singleton()->set_locale(lang);
Expand Down
2 changes: 1 addition & 1 deletion editor/settings/editor_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class EditorSettings : public Resource {
static String get_newest_settings_path();

static void create();
void setup_language();
void setup_language(bool p_initial_setup);
void setup_network();
static void save();
static void destroy();
Expand Down
8 changes: 7 additions & 1 deletion main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
arg == "--display-driver" ||
arg == "--rendering-method" ||
arg == "--rendering-driver" ||
arg == "--xr-mode") {
arg == "--xr-mode" ||
arg == "-l" ||
arg == "--language") {
if (N) {
forwardable_cli_arguments[CLI_SCOPE_TOOL].push_back(arg);
forwardable_cli_arguments[CLI_SCOPE_TOOL].push_back(N->get());
Expand Down Expand Up @@ -3842,6 +3844,10 @@ String Main::get_rendering_driver_name() {
return rendering_driver;
}

String Main::get_locale_override() {
return locale;
}

// everything the main loop needs to know about frame timings
static MainTimerSync main_timer_sync;

Expand Down
1 change: 1 addition & 0 deletions main/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Main {
static Error setup(const char *execpath, int argc, char *argv[], bool p_second_phase = true);
static Error setup2(bool p_show_boot_logo = true); // The thread calling setup2() will effectively become the main thread.
static String get_rendering_driver_name();
static String get_locale_override();
static void setup_boot_logo();
#ifdef TESTS_ENABLED
static Error test_setup();
Expand Down
Loading