mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
fix: forvo has no free plan now fix the apikey tooltip
in order to use forvo pronounciation ,an api key has to be aquired.
This commit is contained in:
parent
3b96b468a9
commit
cdc0fe07e0
18
forvo.cc
18
forvo.cc
|
@ -79,16 +79,18 @@ sptr< DataRequest > ForvoDictionary::getArticle( wstring const & word,
|
|||
wstring const &, bool )
|
||||
|
||||
{
|
||||
if ( word.size() > 80 )
|
||||
if ( word.size() > 80 || apiKey.isEmpty() )
|
||||
{
|
||||
// Don't make excessively large queries -- they're fruitless anyway
|
||||
|
||||
return new DataRequestInstant( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ForvoArticleRequest( word, alts, apiKey, languageCode, getId(),
|
||||
netMgr );
|
||||
}
|
||||
}
|
||||
|
||||
void ForvoDictionary::loadIcon() noexcept
|
||||
{
|
||||
|
@ -130,17 +132,7 @@ void ForvoArticleRequest::addQuery( QNetworkAccessManager & mgr,
|
|||
{
|
||||
gdDebug( "Forvo: requesting article %s\n", gd::toQString( str ).toUtf8().data() );
|
||||
|
||||
QString key;
|
||||
|
||||
if ( apiKey.simplified().isEmpty() )
|
||||
{
|
||||
// Use the default api key. That's the key I have just registered myself.
|
||||
// It has a limit of 1000 requests a day, and may also get banned in the
|
||||
// future. Can't do much about it. Get your own key, it is simple.
|
||||
key = "5efa5d045a16d10ad9c4705bd5d8e56a";
|
||||
}
|
||||
else
|
||||
key = apiKey;
|
||||
QString key = apiKey;
|
||||
|
||||
QUrl reqUrl = QUrl::fromEncoded(
|
||||
QString( "https://apifree.forvo.com"
|
||||
|
@ -351,7 +343,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
|
|||
{
|
||||
vector< sptr< Dictionary::Class > > result;
|
||||
|
||||
if ( forvo.enable )
|
||||
if ( forvo.enable && !forvo.apiKey.isEmpty())
|
||||
{
|
||||
QStringList codes = forvo.languageCodes.split( ',', Qt::SkipEmptyParts );
|
||||
|
||||
|
|
|
@ -4735,7 +4735,17 @@ GoldenDict 尚不支持此方案。</translation>
|
|||
<translation>音频文件目录</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources.ui" line="753"/>
|
||||
<location filename="../sources.ui" line="511"/>
|
||||
<source><html><head/><body><p>Use of Forvo currently requires an API key, register on the site to get your own key.</p></body></html></source>
|
||||
<translation>使用 Forvo 需要一个 API key,请在该网站注册以获取你自己的 key.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources.ui" line="534"/>
|
||||
<source><html><head/><body><p>Get your own key <a href="http://api.forvo.com/key/"><span style=" text-decoration: underline; color:#0000ff;">here</span></a></p></body></html></source>
|
||||
<translation>从<a href="http://api.forvo.com/key/">这里</a>获取自己的API Key。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources.ui" line="689"/>
|
||||
<source>The most widely used method of transcription of Japanese,
|
||||
based on English phonology</source>
|
||||
<translation>以英文语音学为基础建立的,最常用的日文转写方案</translation>
|
||||
|
|
|
@ -508,9 +508,7 @@ of the appropriate groups to use them.</string>
|
|||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="forvoApiKey">
|
||||
<property name="toolTip">
|
||||
<string>Use of Forvo currently requires an API key. Leave this field
|
||||
blank to use the default key, which may become unavailable
|
||||
in the future, or register on the site to get your own key.</string>
|
||||
<string><html><head/><body><p>Use of Forvo currently requires an API key, register on the site to get your own key.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -533,7 +531,7 @@ in the future, or register on the site to get your own key.</string>
|
|||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Get your own key <a href="http://api.forvo.com/key/">here</a>, or leave blank to use the default one.</string>
|
||||
<string><html><head/><body><p>Get your own key <a href="http://api.forvo.com/key/"><span style=" text-decoration: underline; color:#0000ff;">here</span></a></p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
|
|
Loading…
Reference in a new issue