summaryrefslogtreecommitdiff
path: root/editor/editor_settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_settings.cpp')
-rw-r--r--editor/editor_settings.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 433f501fc8..29363e29c1 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -256,8 +256,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
String best;
- for (int i = 0; i < translations.size(); i++) {
- String locale = translations[i]->get_locale();
+ EditorTranslationList *etl = _editor_translations;
+
+ while (etl->data) {
+
+ const String &locale = etl->lang;
lang_hint += ",";
lang_hint += locale;
@@ -268,6 +271,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
if (best == String() && host_lang.begins_with(locale)) {
best = locale;
}
+
+ etl++;
}
if (best == String()) {
@@ -382,8 +387,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("text_editor/completion/callhint_tooltip_offset", Vector2());
_initial_set("text_editor/files/restore_scripts_on_load", true);
_initial_set("text_editor/completion/complete_file_paths", true);
- _initial_set("text_editor/files/maximum_recent_files", 20);
- hints["text_editor/files/maximum_recent_files"] = PropertyInfo(Variant::INT, "text_editor/files/maximum_recent_files", PROPERTY_HINT_RANGE, "1, 200, 1");
_initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false);
_initial_set("docks/scene_tree/draw_relationship_lines", false);
@@ -885,11 +888,29 @@ void EditorSettings::setup_language() {
if (lang == "en")
return; //none to do
- for (int i = 0; i < translations.size(); i++) {
- if (translations[i]->get_locale() == lang) {
- TranslationServer::get_singleton()->set_tool_translation(translations[i]);
- break;
+ EditorTranslationList *etl = _editor_translations;
+
+ while (etl->data) {
+
+ if (etl->lang == lang) {
+
+ Vector<uint8_t> data;
+ data.resize(etl->uncomp_size);
+ Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE);
+
+ FileAccessMemory *fa = memnew(FileAccessMemory);
+ fa->open_custom(data.ptr(), data.size());
+
+ Ref<Translation> tr = TranslationLoaderPO::load_translation(fa, NULL, "translation_" + String(etl->lang));
+
+ if (tr.is_valid()) {
+ tr->set_locale(etl->lang);
+ TranslationServer::get_singleton()->set_tool_translation(tr);
+ break;
+ }
}
+
+ etl++;
}
}
@@ -1459,27 +1480,6 @@ EditorSettings::EditorSettings() {
optimize_save = true;
save_changed_setting = true;
- EditorTranslationList *etl = _editor_translations;
-
- while (etl->data) {
-
- Vector<uint8_t> data;
- data.resize(etl->uncomp_size);
- Compression::decompress(data.ptrw(), etl->uncomp_size, etl->data, etl->comp_size, Compression::MODE_DEFLATE);
-
- FileAccessMemory *fa = memnew(FileAccessMemory);
- fa->open_custom(data.ptr(), data.size());
-
- Ref<Translation> tr = TranslationLoaderPO::load_translation(fa, NULL, "translation_" + String(etl->lang));
-
- if (tr.is_valid()) {
- tr->set_locale(etl->lang);
- translations.push_back(tr);
- }
-
- etl++;
- }
-
_load_defaults();
}