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 show or hide hidden files and folders.
47    pub show_hidden: String,
48    /// Text used for the option to show or hide system files.
49    pub show_system_files: String,
50
51    // ------------------------------------------------------------------------
52    // Left panel:
53    /// Heading of the "Pinned" sections in the left panel
54    pub heading_pinned: String,
55    /// Heading of the "Places" section in the left panel
56    pub heading_places: String,
57    /// Heading of the "Devices" section in the left panel
58    pub heading_devices: String,
59    /// Heading of the "Removable Devices" section in the left panel
60    pub heading_removable_devices: String,
61
62    /// Name of the home directory
63    pub home_dir: String,
64    /// Name of the desktop directory
65    pub desktop_dir: String,
66    /// Name of the documents directory
67    pub documents_dir: String,
68    /// Name of the downloads directory
69    pub downloads_dir: String,
70    /// Name of the audio directory
71    pub audio_dir: String,
72    /// Name of the pictures directory
73    pub pictures_dir: String,
74    /// Name of the videos directory
75    pub videos_dir: String,
76
77    // ------------------------------------------------------------------------
78    // Central panel:
79    /// Text used for the option to pin a folder.
80    pub pin_folder: String,
81    /// Text used for the option to unpin a folder.
82    pub unpin_folder: String,
83    /// Text used for the option to rename a pinned folder.
84    pub rename_pinned_folder: String,
85
86    // ------------------------------------------------------------------------
87    // Bottom panel:
88    /// Text that appears in front of the selected folder preview in the bottom panel.
89    pub selected_directory: String,
90    /// Text that appears in front of the selected file preview in the bottom panel.
91    pub selected_file: String,
92    /// Text that appears in front of the selected items preview in the bottom panel.
93    pub selected_items: String,
94    /// Text that appears in front of the file name input in the bottom panel.
95    pub file_name: String,
96    /// Text displayed in the file filter dropdown for the "All Files" option.
97    pub file_filter_all_files: String,
98    /// Text displayed in the save extension dropdown for the "Any" option.
99    pub save_extension_any: String,
100
101    /// Button text to open the selected item.
102    pub open_button: String,
103    /// Button text to save the file.
104    pub save_button: String,
105    /// Button text to cancel the dialog.
106    pub cancel_button: String,
107
108    // ------------------------------------------------------------------------
109    // Modal windows:
110    /// Text displayed after the path within the modal to overwrite the selected file.
111    pub overwrite_file_modal_text: String,
112
113    // ------------------------------------------------------------------------
114    // Error message:
115    /// Error if no folder name was specified.
116    pub err_empty_folder_name: String,
117    /// Error if no file name was specified.
118    pub err_empty_file_name: String,
119    /// Error if the directory already exists.
120    pub err_directory_exists: String,
121    /// Error if the file already exists.
122    pub err_file_exists: String,
123}
124
125impl Default for FileDialogLabels {
126    /// Creates a new object with the default english labels.
127    fn default() -> Self {
128        Self {
129            title_select_directory: "πŸ“ Select Folder".to_string(),
130            title_select_file: "πŸ“‚ Open File".to_string(),
131            title_select_multiple: "πŸ— Select Multiple".to_string(),
132            title_save_file: "πŸ“₯ Save File".to_string(),
133
134            cancel: "Cancel".to_string(),
135            overwrite: "Overwrite".to_string(),
136
137            reload: "⟲  Reload".to_string(),
138            working_directory: "β†—  Go to working directory".to_string(),
139            show_hidden: " Show hidden".to_string(),
140            show_system_files: " Show system files".to_string(),
141
142            heading_pinned: "Pinned".to_string(),
143            heading_places: "Places".to_string(),
144            heading_devices: "Devices".to_string(),
145            heading_removable_devices: "Removable Devices".to_string(),
146
147            home_dir: "🏠  Home".to_string(),
148            desktop_dir: "πŸ–΅  Desktop".to_string(),
149            documents_dir: "πŸ—  Documents".to_string(),
150            downloads_dir: "πŸ“₯  Downloads".to_string(),
151            audio_dir: "🎡  Audio".to_string(),
152            pictures_dir: "πŸ–Ό  Pictures".to_string(),
153            videos_dir: "🎞  Videos".to_string(),
154
155            pin_folder: "πŸ“Œ Pin".to_string(),
156            unpin_folder: "βœ– Unpin".to_string(),
157            rename_pinned_folder: "✏ Rename".to_string(),
158
159            selected_directory: "Selected directory:".to_string(),
160            selected_file: "Selected file:".to_string(),
161            selected_items: "Selected items:".to_string(),
162            file_name: "File name:".to_string(),
163            file_filter_all_files: "All Files".to_string(),
164            save_extension_any: "Any".to_string(),
165
166            open_button: "πŸ—€  Open".to_string(),
167            save_button: "πŸ“₯  Save".to_string(),
168            cancel_button: "🚫 Cancel".to_string(),
169
170            overwrite_file_modal_text: "already exists. Do you want to overwrite it?".to_string(),
171
172            err_empty_folder_name: "Name of the folder cannot be empty".to_string(),
173            err_empty_file_name: "The file name cannot be empty".to_string(),
174            err_directory_exists: "A directory with the name already exists".to_string(),
175            err_file_exists: "A file with the name already exists".to_string(),
176        }
177    }
178}