@@ -29,12 +29,13 @@ public partial class App : Application
2929
3030 protected override void OnStartup ( StartupEventArgs e )
3131 {
32+ I18n . InitializeFromSettings ( ) ;
3233 base . OnStartup ( e ) ; // Call base implementation
3334 VoiceRuntimeLog . Info ( "App startup." ) ;
3435 VoiceRuntimeLog . Info ( $ "ProcessBitness: { ( Environment . Is64BitProcess ? "x64" : "x86" ) } , OS: { ( Environment . Is64BitOperatingSystem ? "x64" : "x86" ) } ") ;
3536 VoiceRuntimeLog . Info ( $ "BaseDirectory: { AppDomain . CurrentDomain . BaseDirectory } ") ;
3637 VoiceRuntimeLog . Info ( $ "Config: VoiceAsrProvider={ ConfigurationManager . AppSettings [ "VoiceAsrProvider" ] } , FunAsrAutoBootstrap={ ConfigurationManager . AppSettings [ "FunAsrAutoBootstrap" ] } ") ;
37- VoiceListenerStatusCenter . Publish ( VoiceListenerState . Unavailable , "语音监听不可用(启动初始化中)" ) ;
38+ VoiceListenerStatusCenter . Publish ( VoiceListenerState . Unavailable , I18n . T ( "Voice_StatusUnavailable" ) ) ;
3839 FunAsrRuntimeManager . KickoffIfNeeded ( ) ;
3940
4041 // 启动自动更新检查(后台执行)
@@ -55,10 +56,8 @@ protected override void OnStartup(StartupEventArgs e)
5556 if ( string . IsNullOrWhiteSpace ( apiKey ) || apiKey == PlaceholderApiKey )
5657 {
5758 System . Windows . MessageBox . Show (
58- "The OpenAI API key is not configured or is using the placeholder value. " +
59- "LLM-powered features like smart suggestions and automatic task classification will use dummy responses or may not function correctly. " +
60- "Please refer to the readme.md file for instructions on how to set up your API key in the App.config file." ,
61- "API Key Configuration Warning" ,
59+ I18n . T ( "App_ApiKeyWarningText" ) ,
60+ I18n . T ( "App_ApiKeyWarningTitle" ) ,
6261 System . Windows . MessageBoxButton . OK ,
6362 System . Windows . MessageBoxImage . Warning
6463 ) ;
@@ -107,17 +106,16 @@ protected override void OnStartup(StartupEventArgs e)
107106 _legacyAudioService = new AudioCaptureService ( ) ;
108107 _legacyAudioService . Start ( ) ;
109108 VoiceRuntimeLog . Info ( "Legacy AudioCaptureService started as fallback." ) ;
110- VoiceListenerStatusCenter . Publish ( VoiceListenerState . Ready , "已回退到系统语音引擎,监听可用" ) ;
109+ VoiceListenerStatusCenter . Publish ( VoiceListenerState . Ready , I18n . T ( "Voice_StatusReady" ) ) ;
111110 }
112111 catch ( Exception ex2 )
113112 {
114113 Console . WriteLine ( $ "[App] Legacy AudioCaptureService also failed: { ex2 . Message } ") ;
115114 VoiceRuntimeLog . Error ( "Legacy AudioCaptureService start failed." , ex2 ) ;
116- VoiceListenerStatusCenter . Publish ( VoiceListenerState . Unavailable , "语音监听不可用" ) ;
115+ VoiceListenerStatusCenter . Publish ( VoiceListenerState . Unavailable , I18n . T ( "Voice_StatusUnavailable" ) ) ;
117116 MessageBox . Show (
118- "语音识别初始化失败,系统未检测到可用语音识别引擎或麦克风权限异常。\n " +
119- $ "请查看日志:{ VoiceRuntimeLog . LogFilePath } ",
120- "语音功能不可用" ,
117+ I18n . Tf ( "App_VoiceInitFailedTextFormat" , VoiceRuntimeLog . LogFilePath ) ,
118+ I18n . T ( "App_VoiceInitFailedTitle" ) ,
121119 MessageBoxButton . OK ,
122120 MessageBoxImage . Warning ) ;
123121 }
0 commit comments