goldendict / goldendict

A feature-rich dictionary lookup program, supporting multiple dictionary formats (StarDict/Babylon/Lingvo/Dictd) and online dictionaries, featuring perfect article rendering with the complete markup, illustrations and other content retained, and allowing you to type in words without any accents or correct case.
http://goldendict.org/
Other
5.9k stars 729 forks source link

Online dictionary pronunciation problem #1680

Open bAH7JgbXrMsXEhggm4 opened 8 months ago

bAH7JgbXrMsXEhggm4 commented 8 months ago

Because I can't speak English, I have to use Google Translate to write these. It may be difficult to understand. I'm really sorry

Thank you for developing this software, It help me a lot.

I use goldendict like this.

Screenshot from 2023-12-17 10-46-35

content of youdao.html

<!DOCTYPE html>
<html>
<head>
    <meta charset=utf-8 />
    <style>
        iframe{ width: 850px; height: 650px; margin-top:-190px; margin-left:-120px;
        }
    </style>
</head>

<body>
    <iframe id="a" frameborder="0">
    </iframe>
    <script>
    var word = location.href.slice(location.href.indexOf('?a')+3);
    document.getElementById('a').setAttribute(
        'src', 
        'https://dict.youdao.com/result?word=' + word + '&lang=en');
    </script>
</body>
</html>

content of bing.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset=utf-8 />
    <style>
        iframe{ width: 750px; height: 750px; margin-top:-150px; margin-left:-120px;
        }
    </style>
</head>

<body>
    <iframe id="a" frameborder="0">
    </iframe>
    <script>
    var word = location.href.slice(location.href.indexOf('?a')+3);
    document.getElementById('a').setAttribute(
        'src', 
        'https://cn.bing.com/dict/search?q=' + word + '');
    </script>
</body>
</html>

After the configuration is completed, it looks like this

Screenshot from 2023-12-17 10-55-10

goldendict performs very well, there is only one problem: when using 有道 online dictionary, clicking pronunciation has no effect

youdao

However, when using the bing(必应) online dictionary, it can be pronounced normally.

bing

It is worth mentioning that using this version of the GOLDENDICT https://aur.archlinux.org/packages/goldendict-ng, everything is normal, the above two online dictionaries can be pronounced normally.However, this version can only be used in Arch Linux and cannot be used on Debian.

Version: Screenshot from 2023-12-17 11-23-38

ngoclong19 commented 1 month ago

When using the Youdao dictionary, I have this error in GoldenDict's developer console, SyntaxError: Unexpected token 'const'. So I think the Qt version used by GoldenDict doesn't support JavaScript ES6, hence it can't execute the code for pronunciation.

Just curious, why don't you use the link directly, instead of local HTML files, like this? https://dict.youdao.com/result?word=%GDWORD%&lang=en https://cn.bing.com/dict/search?q=%GDWORD%