egui_file_dialog/config/labels.rs
1/// Contains the text labels that the file dialog uses.
2///
3/// This is used to enable multiple language support.
4///
5/// # Example
6///
7/// The following example shows how the default title of the dialog can be displayed
8/// in German instead of English.
9///
10/// ```
11/// use egui_file_dialog::{FileDialog, FileDialogLabels};
12///
13/// let labels_german = FileDialogLabels {
14/// title_select_directory: "π Ordner Γffnen".to_string(),
15/// title_select_file: "π Datei Γffnen".to_string(),
16/// title_save_file: "π₯ Datei Speichern".to_string(),
17/// ..Default::default()
18/// };
19///
20/// let file_dialog = FileDialog::new().labels(labels_german);
21/// ```
22#[derive(Debug, PartialEq, Eq, Clone)]
23pub struct FileDialogLabels {
24 // ------------------------------------------------------------------------
25 // General:
26 /// The default window title used when the dialog is in `DialogMode::SelectDirectory` mode.
27 pub title_select_directory: String,
28 /// The default window title used when the dialog is in `DialogMode::SelectFile` mode.
29 pub title_select_file: String,
30 /// The default window title used when the dialog is in `DialogMode::SelectMultiple` mode.
31 pub title_select_multiple: String,
32 /// The default window title used when the dialog is in `DialogMode::SaveFile` mode.
33 pub title_save_file: String,
34
35 /// Text displayed in the buttons to cancel the current action.
36 pub cancel: String,
37 /// Text displayed in the buttons to overwrite something, such as a file.
38 pub overwrite: String,
39
40 // ------------------------------------------------------------------------
41 // Top panel:
42 /// Text used for the option to reload the file dialog.
43 pub reload: String,
44 /// Text used for the option to open the working directory.
45 pub working_directory: String,
46 /// Text used for the option to select all files in the directory.
47 pub select_all: String,
48 /// Text used for the option to show or hide hidden files and folders.
49 pub show_hidden: String,
50 /// Text used for the option to show or hide system files.
51 pub show_system_files: String,
52
53 // ------------------------------------------------------------------------
54 // Left panel:
55 /// Heading of the "Pinned" sections in the left panel
56 pub heading_pinned: String,
57 /// Heading of the "Places" section in the left panel
58 pub heading_places: String,
59 /// Heading of the "Devices" section in the left panel
60 pub heading_devices: String,
61 /// Heading of the "Removable Devices" section in the left panel
62 pub heading_removable_devices: String,
63
64 /// Name of the home directory
65 pub home_dir: String,
66 /// Name of the desktop directory
67 pub desktop_dir: String,
68 /// Name of the documents directory
69 pub documents_dir: String,
70 /// Name of the downloads directory
71 pub downloads_dir: String,
72 /// Name of the audio directory
73 pub audio_dir: String,
74 /// Name of the pictures directory
75 pub pictures_dir: String,
76 /// Name of the videos directory
77 pub videos_dir: String,
78
79 // ------------------------------------------------------------------------
80 // Central panel:
81 /// Text used for the option to pin a folder.
82 pub pin_folder: String,
83 /// Text used for the option to unpin a folder.
84 pub unpin_folder: String,
85 /// Text used for the option to rename a pinned folder.
86 pub rename_pinned_folder: String,
87
88 // ------------------------------------------------------------------------
89 // Bottom panel:
90 /// Text that appears in front of the selected folder preview in the bottom panel.
91 pub selected_directory: String,
92 /// Text that appears in front of the selected file preview in the bottom panel.
93 pub selected_file: String,
94 /// Text that appears in front of the selected items preview in the bottom panel.
95 pub selected_items: String,
96 /// Text that appears in front of the file name input in the bottom panel.
97 pub file_name: String,
98 /// Text displayed in the file filter dropdown for the "All Files" option.
99 pub file_filter_all_files: String,
100 /// Text displayed in the save extension dropdown for the "Any" option.
101 pub save_extension_any: String,
102
103 /// Button text to open the selected item.
104 pub open_button: String,
105 /// Button text to save the file.
106 pub save_button: String,
107 /// Button text to cancel the dialog.
108 pub cancel_button: String,
109
110 // ------------------------------------------------------------------------
111 // Modal windows:
112 /// Text displayed after the path within the modal to overwrite the selected file.
113 pub overwrite_file_modal_text: String,
114
115 // ------------------------------------------------------------------------
116 // Error message:
117 /// Error if no folder name was specified.
118 pub err_empty_folder_name: String,
119 /// Error if no file name was specified.
120 pub err_empty_file_name: String,
121 /// Error if the directory already exists.
122 pub err_directory_exists: String,
123 /// Error if the file already exists.
124 pub err_file_exists: String,
125}
126
127impl Default for FileDialogLabels {
128 /// Creates a new object with the default english labels.
129 fn default() -> Self {
130 Self {
131 title_select_directory: "π Select Folder".to_string(),
132 title_select_file: "π Open File".to_string(),
133 title_select_multiple: "π Select Multiple".to_string(),
134 title_save_file: "π₯ Save File".to_string(),
135
136 cancel: "Cancel".to_string(),
137 overwrite: "Overwrite".to_string(),
138
139 reload: "β² Reload".to_string(),
140 working_directory: "β Go to working directory".to_string(),
141 select_all: "π Select all".to_string(),
142 show_hidden: " Show hidden".to_string(),
143 show_system_files: " Show system files".to_string(),
144
145 heading_pinned: "Pinned".to_string(),
146 heading_places: "Places".to_string(),
147 heading_devices: "Devices".to_string(),
148 heading_removable_devices: "Removable Devices".to_string(),
149
150 home_dir: "π Home".to_string(),
151 desktop_dir: "π΅ Desktop".to_string(),
152 documents_dir: "π Documents".to_string(),
153 downloads_dir: "π₯ Downloads".to_string(),
154 audio_dir: "π΅ Audio".to_string(),
155 pictures_dir: "πΌ Pictures".to_string(),
156 videos_dir: "π Videos".to_string(),
157
158 pin_folder: "π Pin".to_string(),
159 unpin_folder: "β Unpin".to_string(),
160 rename_pinned_folder: "β Rename".to_string(),
161
162 selected_directory: "Selected directory:".to_string(),
163 selected_file: "Selected file:".to_string(),
164 selected_items: "Selected items:".to_string(),
165 file_name: "File name:".to_string(),
166 file_filter_all_files: "All Files".to_string(),
167 save_extension_any: "Any".to_string(),
168
169 open_button: "π Open".to_string(),
170 save_button: "π₯ Save".to_string(),
171 cancel_button: "π« Cancel".to_string(),
172
173 overwrite_file_modal_text: "already exists. Do you want to overwrite it?".to_string(),
174
175 err_empty_folder_name: "Name of the folder cannot be empty".to_string(),
176 err_empty_file_name: "The file name cannot be empty".to_string(),
177 err_directory_exists: "A directory with the name already exists".to_string(),
178 err_file_exists: "A file with the name already exists".to_string(),
179 }
180 }
181}