22using Microsoft . Data . Sqlite ;
33using Microsoft . Win32 ;
44using MiniExcelLibs ;
5+ using QuickLook . Common . Helpers ;
56using System ;
67using System . Collections . Generic ;
78using System . Data ;
89using System . IO ;
910using System . Linq ;
11+ using System . Reflection ;
1012using System . Windows ;
1113using System . Windows . Controls ;
1214
@@ -15,6 +17,7 @@ namespace QuickLook.Plugin.DbViewer;
1517public partial class DbViewerPanel : UserControl
1618{
1719 private const int DefaultPageSize = 200 ;
20+ private static readonly string Domain = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Name ;
1821 private string _path ;
1922 private string _sqlitePassword ;
2023 private DatabaseType _databaseType ;
@@ -62,7 +65,7 @@ public void LoadDatabase(string path, string password = null)
6265 }
6366 else
6467 {
65- MessageBox . Show ( "数据库中没有可显示的表或集合" ) ;
68+ MessageBox . Show ( TranslationHelper . Get ( "MSG_NoTables" , domain : Domain ) ) ;
6669 }
6770 }
6871
@@ -93,16 +96,16 @@ public void ExportCurrentTableToExcel(string sourcePath)
9396
9497 if ( table is null )
9598 {
96- MessageBox . Show ( "无法导出数据。" , "QuickLook" , MessageBoxButton . OK , MessageBoxImage . Warning ) ;
99+ MessageBox . Show ( TranslationHelper . Get ( "MSG_ExportCannotExport" , domain : Domain ) , "QuickLook" , MessageBoxButton . OK , MessageBoxImage . Warning ) ;
97100 return ;
98101 }
99102
100103 MiniExcel . SaveAs ( dialog . FileName , table ) ;
101- MessageBox . Show ( $ "导出成功: { dialog . FileName } " , "QuickLook" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
104+ MessageBox . Show ( string . Format ( TranslationHelper . Get ( "MSG_ExportSuccess" , domain : Domain ) , dialog . FileName ) , "QuickLook" , MessageBoxButton . OK , MessageBoxImage . Information ) ;
102105 }
103106 catch ( Exception ex )
104107 {
105- MessageBox . Show ( $ "导出失败: { ex . Message } " , "QuickLook" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
108+ MessageBox . Show ( string . Format ( TranslationHelper . Get ( "MSG_ExportError" , domain : Domain ) , ex . Message ) , "QuickLook" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
106109 }
107110 }
108111
0 commit comments