55
66use eframe:: egui;
77use memmap2:: Mmap ;
8+ use rust_i18n:: t;
89use std:: collections:: HashMap ;
910use std:: fs:: { self , File } ;
1011use std:: path:: PathBuf ;
@@ -279,7 +280,7 @@ impl UltraLogApp {
279280 pub fn start_loading_file ( & mut self , path : PathBuf ) {
280281 // Check for duplicate
281282 if self . files . iter ( ) . any ( |f| f. path == path) {
282- self . show_toast_warning ( "File already loaded" ) ;
283+ self . show_toast_warning ( & t ! ( "toast.file_already_loaded" ) ) ;
283284 return ;
284285 }
285286
@@ -536,7 +537,7 @@ impl UltraLogApp {
536537 self . tabs . push ( tab) ;
537538 self . active_tab = Some ( self . tabs . len ( ) - 1 ) ;
538539
539- self . show_toast_success ( "File loaded successfully" ) ;
540+ self . show_toast_success ( & t ! ( "toast.file_loaded" ) ) ;
540541
541542 // Switch to Channels panel so user can select channels
542543 self . active_panel = ActivePanel :: Channels ;
@@ -804,20 +805,20 @@ impl UltraLogApp {
804805 /// Add a channel to the active tab's selection
805806 pub fn add_channel ( & mut self , file_index : usize , channel_index : usize ) {
806807 let Some ( tab_idx) = self . active_tab else {
807- self . show_toast_warning ( "No active tab" ) ;
808+ self . show_toast_warning ( & t ! ( "toast.no_active_tab" ) ) ;
808809 return ;
809810 } ;
810811
811812 let tab = & self . tabs [ tab_idx] ;
812813
813814 // Only allow adding channels from the tab's file
814815 if file_index != tab. file_index {
815- self . show_toast_warning ( "Channel must be from the active tab's file" ) ;
816+ self . show_toast_warning ( & t ! ( "toast.channel_from_active_tab" ) ) ;
816817 return ;
817818 }
818819
819820 if tab. selected_channels . len ( ) >= MAX_CHANNELS {
820- self . show_toast_warning ( "Maximum 10 channels reached" ) ;
821+ self . show_toast_warning ( & t ! ( "toast.max_channels" ) ) ;
821822 return ;
822823 }
823824
@@ -827,7 +828,7 @@ impl UltraLogApp {
827828 . iter ( )
828829 . any ( |c| c. file_index == file_index && c. channel_index == channel_index)
829830 {
830- self . show_toast_warning ( "Channel already selected" ) ;
831+ self . show_toast_warning ( & t ! ( "toast.channel_already_selected" ) ) ;
831832 return ;
832833 }
833834
@@ -1081,7 +1082,7 @@ impl UltraLogApp {
10811082 /// Add a computed channel to the active file
10821083 pub fn add_computed_channel ( & mut self , computed : ComputedChannel ) {
10831084 let Some ( tab_idx) = self . active_tab else {
1084- self . show_toast_warning ( "No active tab" ) ;
1085+ self . show_toast_warning ( & t ! ( "toast.no_active_tab" ) ) ;
10851086 return ;
10861087 } ;
10871088
@@ -1107,9 +1108,9 @@ impl UltraLogApp {
11071108 /// Save the computed channel library to disk
11081109 pub fn save_computed_library ( & mut self ) {
11091110 if let Err ( e) = self . computed_library . save ( ) {
1110- self . show_toast_error ( & format ! ( "Failed to save library: {}" , e) ) ;
1111+ self . show_toast_error ( & t ! ( "toast.library_save_failed" , error = e) ) ;
11111112 } else {
1112- self . show_toast_success ( "Library saved" ) ;
1113+ self . show_toast_success ( & t ! ( "toast.library_saved" ) ) ;
11131114 }
11141115 }
11151116
@@ -1167,14 +1168,14 @@ impl UltraLogApp {
11671168 analytics:: track_update_checked ( false ) ;
11681169 // Only show toast for manual checks (not startup)
11691170 if self . startup_check_done {
1170- self . show_toast_success ( "You're running the latest version" ) ;
1171+ self . show_toast_success ( & t ! ( "toast.up_to_date" ) ) ;
11711172 }
11721173 }
11731174 UpdateCheckResult :: Error ( e) => {
11741175 self . update_state = UpdateState :: Error ( e. clone ( ) ) ;
11751176 // Only show error toast for manual checks
11761177 if self . startup_check_done {
1177- self . show_toast_error ( & format ! ( "Update check failed: {} " , e) ) ;
1178+ self . show_toast_error ( & t ! ( "toast.update_check_failed " , error = & e) ) ;
11781179 }
11791180 }
11801181 }
@@ -1189,11 +1190,11 @@ impl UltraLogApp {
11891190 match result {
11901191 DownloadResult :: Success ( path) => {
11911192 self . update_state = UpdateState :: ReadyToInstall ( path) ;
1192- self . show_toast_success ( "Update downloaded successfully" ) ;
1193+ self . show_toast_success ( & t ! ( "toast.update_downloaded" ) ) ;
11931194 }
11941195 DownloadResult :: Error ( e) => {
11951196 self . update_state = UpdateState :: Error ( e. clone ( ) ) ;
1196- self . show_toast_error ( & format ! ( "Download failed: {} " , e) ) ;
1197+ self . show_toast_error ( & t ! ( "toast.download_failed " , error = & e) ) ;
11971198 }
11981199 }
11991200 self . update_download_receiver = None ;
0 commit comments