{"record":{"id":"8bb0d1a14167fb3c","repo":"Uahh/ToastFish","slug":"toastfish-xaml-8bb0d1","errorCode":null,"errorMessage":"检测到您未安装日语语音包，请去“设置”->“时间和语言”->“语音”->“添加语音”中安装日本语，以免影响正常使用。","messagePattern":"检测到您未安装日语语音包，请去“设置”->“时间和语言”->“语音”->“添加语音”中安装日本语，以免影响正常使用。","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"View/ToastFish.xaml.cs","lineNumber":557,"sourceCode":"            else if (sender.ToString() == \"专八真题高频词\")\n                TempName = \"Level8_1\";\n            else if (sender.ToString() == \"专八核心词汇\")\n                TempName = \"Level8luan_2\";\n            else if (sender.ToString() == \"顺序五十音\")\n                TempName = \"Goin\";\n            else if (sender.ToString() == \"标准日本语中级词汇\")\n            {\n                TempName = \"StdJp_Mid\";\n                bool Flag = false;\n                SpeechSynthesizer synth = new SpeechSynthesizer();\n                foreach (InstalledVoice voice in synth.GetInstalledVoices())\n                {\n                    VoiceInfo info = voice.VoiceInfo;\n                    if (info.Culture.IetfLanguageTag == \"ja-JP\")\n                        Flag = true;\n                }\n                if(Flag == false)\n                    System.Windows.Forms.MessageBox.Show(\"检测到您未安装日语语音包，请去“设置”->“时间和语言”->“语音”->“添加语音”中安装日本语，以免影响正常使用。\", \"提示\", MessageBoxButtons.OK, MessageBoxIcon.Information);\n            }\n            else if (sender.ToString() == \"随机五十音测试\")\n                TempName = \"Goin\";\n            Select.TABLE_NAME = TempName;\n            Se.UpdateBookName(TempName);\n            Se.UpdateTableCount();\n            //if (sender.ToString() == \"顺序五十音\")\n            //{\n            //     int Progress = Se.GetGoinProgress();\n            //     PushWords.PushMessage(\"当前词库：\" + sender.ToString() + \"\\n当前进度：\" + Progress.ToString() + \"/104\");\n            // }\n            // else\n            //{\n            List<int> res = Se.SelectCount();\n                pushWords.PushMessage(\"当前词库：\" + sender.ToString() + \"\\n当前进度：\" + res[0].ToString() + \"/\" + res[1].ToString());\n           // }\n        }\n","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/Uahh/ToastFish/blob/2508784a6650862a60e1f3ec3a54dd83efdec98b/View/ToastFish.xaml.cs#L539-L575","documentation":"In SelectBook_Click (View/ToastFish.xaml.cs:557), when the user selects a Japanese word book, the app iterates installed SpeechSynthesizer voices and checks for a voice whose Culture.IetfLanguageTag equals \"ja-JP\". If none is found (Flag stays false), it shows this WinForms MessageBox telling the user to install the Japanese voice via Windows Settings > Time & Language > Speech. This is not an exception but a hard dependency warning: ToastFish's Japanese push/pronunciation features rely on the OS TTS engine, which cannot speak ja-JP without the voice pack.","triggerScenarios":"User clicks a Japanese book entry (SelectBook_Click with a Japanese table name such as a Japanese word list) while the Windows speech synthesis API (System.Speech.Synthesis.SpeechSynthesizer.GetInstalledVoices) returns no voice with IetfLanguageTag == \"ja-JP\".","commonSituations":"Fresh Windows 10/11 installs (only the OS language's voice pack is installed by default); Windows N/KN editions missing media features; Chinese-language systems where ja-JP was never added in Settings; enterprise images that strip optional language features; running the app right after selecting a Japanese book without ever configuring speech.","solutions":["Install the Japanese voice pack: Windows Settings > Time & Language > Speech > Add voices > 日本語 (ja-JP), then restart ToastFish.","Alternative path: Settings > Time & Language > Language > Add a language > 日本語 (include the Speech optional feature), then reboot.","Verify programmatically with PowerShell: Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).GetInstalledVoices() and confirm a ja-JP voice appears.","If the app was running during installation, close and relaunch ToastFish so SpeechSynthesizer enumerates the newly installed voice.","If only silent push is needed and audio is unwanted, use a book without TTS dependency or ignore the dialog (the book selection still proceeds since Select.TABLE_NAME is set afterwards)."],"exampleFix":"// before\nif(Flag == false)\n    System.Windows.Forms.MessageBox.Show(\"检测到您未安装日语语音包...\");\n// after\nif (Flag == false)\n{\n    var result = System.Windows.Forms.MessageBox.Show(\n        \"检测到您未安装日语语音包，是否打开系统设置安装？\", \"提示\",\n        MessageBoxButtons.YesNo, MessageBoxIcon.Information);\n    if (result == DialogResult.Yes)\n        Process.Start(\"ms-settings:menuspeech\"); // or speech settings deep link\n}","handlingStrategy":"validation","validationCode":"using (var synth = new System.Speech.Synthesis.SpeechSynthesizer())\n{\n    bool jaInstalled = synth.GetInstalledVoices()\n        .Any(v => v.VoiceInfo.Culture.IetfLanguageTag == \"ja-JP\");\n    if (!jaInstalled)\n    {\n        // prompt user to install the ja-JP voice pack before selecting a Japanese book\n        System.Windows.Forms.MessageBox.Show(\"检测到您未安装日语语音包，请先在 设置>时间和语言>语音 中安装日本语。\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install the ja-JP speech feature before first use of Japanese word books.","Check GetInstalledVoices() at app startup and warn once, instead of on every book click.","On Windows N editions, install the Media Feature Pack which some speech components depend on.","After installing a voice pack, restart the app so voices are re-enumerated."],"tags":["windows","tts","missing-dependency","speech-synthesis","csharp"],"backgroundTag":"missing-dependency","analyzedSha":"2508784a6650862a60e1f3ec3a54dd83efdec98b","analyzedAt":"2026-09-15T23:21:32.897Z","contentChangedAt":"2026-09-15T23:21:32.897Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}