pot-app/pot-desktop · error · Error
Language not supported
Error message
Language not supported
What it means
handleSpeak in TargetArea throws this when the current target language is not a key in the selected TTS plugin's language map (ttsPluginInfo.language). Unlike SourceArea it does not auto-detect; it uses targetLanguage directly, so any translation target the user picked that the plugin doesn't register cannot be spoken aloud.
Source
Thrown at src/window/Translate/components/TargetArea/index.jsx:346
// refresh tts config
useEffect(() => {
if (ttsServiceList && getServiceSouceType(ttsServiceList[0]) === ServiceSourceType.PLUGIN) {
readTextFile(`plugins/tts/${getServiceName(ttsServiceList[0])}/info.json`, {
dir: BaseDirectory.AppConfig,
}).then((infoStr) => {
setTtsPluginInfo(JSON.parse(infoStr));
});
}
}, [ttsServiceList]);
// handle tts speak
const handleSpeak = async () => {
const instanceKey = ttsServiceList[0];
if (getServiceSouceType(instanceKey) === ServiceSourceType.PLUGIN) {
const pluginConfig = serviceInstanceConfigMap[instanceKey];
if (!(targetLanguage in ttsPluginInfo.language)) {
throw new Error('Language not supported');
}
let [func, utils] = await invoke_plugin('tts', getServiceName(instanceKey));
let data = await func(result, ttsPluginInfo.language[targetLanguage], {
config: pluginConfig,
utils,
});
speak(data);
} else {
if (!(targetLanguage in builtinTtsServices[getServiceName(instanceKey)].Language)) {
throw new Error('Language not supported');
}
const instanceConfig = serviceInstanceConfigMap[instanceKey];
let data = await builtinTtsServices[getServiceName(instanceKey)].tts(
result,
builtinTtsServices[getServiceName(instanceKey)].Language[targetLanguage],
{
config: instanceConfig,
}View on GitHub (pinned to 594d32ede9)
Solutions
- Select a TTS service that supports the chosen target language.
- Update or replace the TTS plugin with one that registers the missing language code.
- Translate to a supported target language before speaking.
- Catch the error and show which languages the plugin supports.
Example fix
// before
if (!(targetLanguage in ttsPluginInfo.language)) {
throw new Error('Language not supported');
}
// after
if (!(targetLanguage in ttsPluginInfo.language)) {
toast.error(`TTS plugin cannot speak: ${targetLanguage}`);
return;
} Defensive patterns
Strategy: validation
Validate before calling
if (getServiceSouceType(instanceKey) === ServiceSourceType.PLUGIN &&
!(targetLanguage in ttsPluginInfo.language)) {
// choose another TTS service before speaking
return false;
}
return true; Try / catch
try { await handleSpeak(); } catch (e) {
if (e.message === 'Language not supported') {
toast.error(`TTS plugin cannot speak target language: ${targetLanguage}`);
} else throw e;
} Prevention
- Re-validate TTS support whenever targetLanguage changes.
- Keep plugin language maps in sync with the app's language code scheme.
- Show supported languages in the TTS service configuration UI.
When it happens
Trigger: User clicks speak on the translation result while the first TTS instance in ttsServiceList is a PLUGIN-type service; targetLanguage is not a key of ttsPluginInfo.language.
Common situations: Translating into a language the TTS plugin doesn't support (common with niche languages or regional variants); switching target language after configuring TTS; plugin language keys using different codes than the target-language selector.
Related errors
AI-assisted analysis of pot-app/pot-desktop@594d32ede9 (2026-09-02).
Data as JSON: /api/errors/2c3576370452f669.
Report an issue: GitHub.