Skip to content

Commit 932b226

Browse files
committed
Fix missing native file dialog title translation.
1 parent 76fa7b2 commit 932b226

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

editor/gui/editor_file_dialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void EditorFileDialog::_native_popup() {
6565
} else if (access == ACCESS_USERDATA) {
6666
root = OS::get_singleton()->get_user_data_dir();
6767
}
68-
DisplayServer::get_singleton()->file_dialog_with_options_show(get_title(), ProjectSettings::get_singleton()->globalize_path(dir->get_text()), root, file->get_text().get_file(), show_hidden_files, DisplayServer::FileDialogMode(mode), filters, _get_options(), callable_mp(this, &EditorFileDialog::_native_dialog_cb));
68+
DisplayServer::get_singleton()->file_dialog_with_options_show(get_translated_title(), ProjectSettings::get_singleton()->globalize_path(dir->get_text()), root, file->get_text().get_file(), show_hidden_files, DisplayServer::FileDialogMode(mode), filters, _get_options(), callable_mp(this, &EditorFileDialog::_native_dialog_cb));
6969
}
7070

7171
void EditorFileDialog::popup(const Rect2i &p_rect) {

scene/gui/file_dialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ void FileDialog::_native_popup() {
6868
root = OS::get_singleton()->get_user_data_dir();
6969
}
7070
if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_NATIVE_DIALOG_FILE_EXTRA)) {
71-
DisplayServer::get_singleton()->file_dialog_with_options_show(get_title(), ProjectSettings::get_singleton()->globalize_path(dir->get_text()), root, file->get_text().get_file(), show_hidden_files, DisplayServer::FileDialogMode(mode), filters, _get_options(), callable_mp(this, &FileDialog::_native_dialog_cb_with_options));
71+
DisplayServer::get_singleton()->file_dialog_with_options_show(get_translated_title(), ProjectSettings::get_singleton()->globalize_path(dir->get_text()), root, file->get_text().get_file(), show_hidden_files, DisplayServer::FileDialogMode(mode), filters, _get_options(), callable_mp(this, &FileDialog::_native_dialog_cb_with_options));
7272
} else {
73-
DisplayServer::get_singleton()->file_dialog_show(get_title(), ProjectSettings::get_singleton()->globalize_path(dir->get_text()), file->get_text().get_file(), show_hidden_files, DisplayServer::FileDialogMode(mode), filters, callable_mp(this, &FileDialog::_native_dialog_cb));
73+
DisplayServer::get_singleton()->file_dialog_show(get_translated_title(), ProjectSettings::get_singleton()->globalize_path(dir->get_text()), file->get_text().get_file(), show_hidden_files, DisplayServer::FileDialogMode(mode), filters, callable_mp(this, &FileDialog::_native_dialog_cb));
7474
}
7575
}
7676

scene/main/viewport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ void Viewport::_sub_window_update(Window *p_window) {
330330
int close_h_ofs = p_window->theme_cache.close_h_offset;
331331
int close_v_ofs = p_window->theme_cache.close_v_offset;
332332

333-
TextLine title_text = TextLine(p_window->atr(p_window->get_title()), title_font, font_size);
333+
TextLine title_text = TextLine(p_window->get_translated_title(), title_font, font_size);
334334
title_text.set_width(r.size.width - panel->get_minimum_size().x - close_h_ofs);
335335
title_text.set_direction(p_window->is_layout_rtl() ? TextServer::DIRECTION_RTL : TextServer::DIRECTION_LTR);
336336
int x = (r.size.width - title_text.get_size().x) / 2;

scene/main/window.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ String Window::get_title() const {
303303
return title;
304304
}
305305

306+
String Window::get_translated_title() const {
307+
ERR_READ_THREAD_GUARD_V(String());
308+
return tr_title;
309+
}
310+
306311
void Window::_settings_changed() {
307312
if (visible && initial_position != WINDOW_INITIAL_POSITION_ABSOLUTE && is_in_edited_scene_root()) {
308313
Size2 screen_size = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"));

scene/main/window.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ class Window : public Viewport {
274274

275275
void set_title(const String &p_title);
276276
String get_title() const;
277+
String get_translated_title() const;
277278

278279
void set_initial_position(WindowInitialPosition p_initial_position);
279280
WindowInitialPosition get_initial_position() const;

0 commit comments

Comments
 (0)