Make name of editor file dialog filters translatable

This commit is contained in:
Haoyu Qiu 2022-03-05 12:32:38 +08:00
parent c9d0523302
commit 86c76dca12
5 changed files with 8 additions and 7 deletions

View file

@ -1332,7 +1332,7 @@ EditorAudioBuses::EditorAudioBuses() {
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("AudioBusLayout", &ext);
for (const String &E : ext) {
file_dialog->add_filter("*." + E + "; Audio Bus Layout");
file_dialog->add_filter(vformat("*.%s; %s", E, TTR("Audio Bus Layout")));
}
add_child(file_dialog);
file_dialog->connect("file_selected", callable_mp(this, &EditorAudioBuses::_file_dialog_callback));

View file

@ -1269,8 +1269,8 @@ SceneImportSettings::SceneImportSettings() {
item_save_path = memnew(EditorFileDialog);
item_save_path->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
item_save_path->add_filter("*.tres;Text Resource");
item_save_path->add_filter("*.res;Binary Resource");
item_save_path->add_filter("*.tres; " + TTR("Text Resource"));
item_save_path->add_filter("*.res; " + TTR("Binary Resource"));
add_child(item_save_path);
item_save_path->connect("file_selected", callable_mp(this, &SceneImportSettings::_save_path_changed));

View file

@ -138,7 +138,7 @@ LightmapGIEditorPlugin::LightmapGIEditorPlugin() {
file_dialog = memnew(EditorFileDialog);
file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_dialog->add_filter("*.lmbake ; LightMap Bake");
file_dialog->add_filter("*.lmbake ; " + TTR("LightMap Bake"));
file_dialog->set_title(TTR("Select lightmap bake file:"));
file_dialog->connect("file_selected", callable_mp(this, &LightmapGIEditorPlugin::_bake_select_file));
bake->add_child(file_dialog);

View file

@ -2077,7 +2077,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("Theme", &ext);
for (const String &E : ext) {
import_another_theme_dialog->add_filter("*." + E + "; Theme Resource");
import_another_theme_dialog->add_filter(vformat("*.%s; %s", E, TTR("Theme Resource")));
}
import_another_file_hb->add_child(import_another_theme_dialog);
import_another_theme_dialog->connect("file_selected", callable_mp(this, &ThemeItemEditorDialog::_select_another_theme_cbk));
@ -3664,7 +3664,7 @@ ThemeEditor::ThemeEditor() {
List<String> ext;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &ext);
for (const String &E : ext) {
preview_scene_dialog->add_filter("*." + E + "; Scene");
preview_scene_dialog->add_filter(vformat("*.%s; %s", E, TTR("Scene")));
}
main_hs->add_child(preview_scene_dialog);
preview_scene_dialog->connect("file_selected", callable_mp(this, &ThemeEditor::_preview_scene_dialog_cbk));

View file

@ -883,7 +883,8 @@ void ProjectExportDialog::_export_project() {
List<String> extension_list = platform->get_binary_extensions(current);
for (int i = 0; i < extension_list.size(); i++) {
export_project->add_filter("*." + extension_list[i] + " ; " + platform->get_name() + " Export");
// TRANSLATORS: This is the name of a project export file format. %s will be replaced by the platform name.
export_project->add_filter(vformat("*.%s; %s", extension_list[i], vformat(TTR("%s Export"), platform->get_name())));
}
if (!current->get_export_path().is_empty()) {