From cccb1f818e620a0f13b27d7d6c1a0622c016c312 Mon Sep 17 00:00:00 2001 From: Clement-Jean Date: Tue, 18 Sep 2018 13:55:33 +0800 Subject: [PATCH] English translation in addons21 --- addons/fastwq/service/dict/youdao.py | 34 ++++++++++++------------ addons/fastwq/service/dict/youdaofr.py | 2 +- addons/fastwq/service/dict/youdaoko.py | 2 +- addons21/fastwq/service/dict/esdict.py | 16 +++++------ addons21/fastwq/service/dict/frdic.py | 16 +++++------ addons21/fastwq/service/dict/iciba.py | 24 ++++++++--------- addons21/fastwq/service/dict/minidict.py | 10 +++---- addons21/fastwq/service/dict/youdao.py | 34 ++++++++++++------------ addons21/fastwq/service/dict/youdaofr.py | 10 +++---- addons21/fastwq/service/dict/youdaoko.py | 10 +++---- 10 files changed, 79 insertions(+), 79 deletions(-) diff --git a/addons/fastwq/service/dict/youdao.py b/addons/fastwq/service/dict/youdao.py index 15fab7e..6d5bd9f 100644 --- a/addons/fastwq/service/dict/youdao.py +++ b/addons/fastwq/service/dict/youdao.py @@ -64,11 +64,11 @@ class Youdao(WebService): pass return self.cache_this(result) - @export(u'音标') + @export([u'音标', u'Phonetic symbols']) def fld_phonetic(self): return self._get_field('phonetic') - @export(u'基本释义') + @export([u'基本释义', u'Explanations']) def fld_explains(self): return self._get_field('explains') @@ -93,7 +93,7 @@ class Youdao(WebService): except: return '' - @export(u'英式发音') + @export([u'英式发音', u'British pronounciation']) def fld_british_audio(self): audio_url = u'http://dict.youdao.com/dictvoice?audio={}&type=1'.format(self.quote_word) if youdao_download_mp3: @@ -102,7 +102,7 @@ class Youdao(WebService): return self.get_anki_label(filename, 'audio') return audio_url - @export(u'美式发音') + @export([u'美式发音', u'American pronounciation']) def fld_american_audio(self): audio_url = u'http://dict.youdao.com/dictvoice?audio={}&type=2'.format(self.quote_word) if youdao_download_mp3: @@ -111,54 +111,54 @@ class Youdao(WebService): return self.get_anki_label(filename, 'audio') return audio_url - @export(u'柯林斯英汉') + @export([u'柯林斯英汉', u'Collins']) def fld_collins(self): return self._get_singledict('collins') - @export(u'21世纪') + @export([u'21世纪', u'21st century']) def fld_ec21(self): return self._get_singledict('ec21') - @export(u'英英释义') + @export([u'英英释义', u'English-english dictionary']) def fld_ee(self): return self._get_singledict('ee') - @export(u'网络释义') + @export([u'网络释义', u'Web translation']) def fld_web_trans(self): return self._get_singledict('web_trans') - @export(u'同根词') + @export([u'同根词', u'Related words']) def fld_rel_word(self): return self._get_singledict('rel_word') - @export(u'同近义词') + @export([u'同近义词', u'Synonyms']) def fld_syno(self): return self._get_singledict('syno') - @export(u'双语例句') + @export([u'双语例句', u'Bilingual examples']) def fld_blng_sents_part(self): return self._get_singledict('blng_sents_part') - @export(u'原生例句') + @export([u'原生例句', u'Native examples']) def fld_media_sents_part(self): return self._get_singledict('media_sents_part') - @export(u'权威例句') + @export([u'权威例句', u'Authoritative examples']) def fld_auth_sents_part(self): return self._get_singledict('auth_sents_part') - @export(u'新英汉大辞典(中)') + @export([u'新英汉大辞典(中)', u'New english-chinese dictionary']) def fld_ce_new(self): return self._get_singledict('ce_new') - @export(u'百科') + @export([u'百科', u'baike']) def fld_baike(self): return self._get_singledict('baike') - @export(u'汉语词典(中)') + @export([u'汉语词典(中)', u'Chinese dictionary']) def fld_hh(self): return self._get_singledict('hh') - @export(u'专业释义(中)') + @export([u'专业释义(中)', u'Professional translation']) def fld_special(self): return self._get_singledict('special') diff --git a/addons/fastwq/service/dict/youdaofr.py b/addons/fastwq/service/dict/youdaofr.py index 7c9507a..c1f5b25 100644 --- a/addons/fastwq/service/dict/youdaofr.py +++ b/addons/fastwq/service/dict/youdaofr.py @@ -67,7 +67,7 @@ class Youdaofr(WebService): def fld_blng_sents_part(self): return self._get_singledict('blng_sents_part') - @export([u'百科', u'Encyclopedia']) + @export([u'百科', u'baike']) def fld_baike(self): return self._get_singledict('baike') diff --git a/addons/fastwq/service/dict/youdaoko.py b/addons/fastwq/service/dict/youdaoko.py index d6217b5..19a342b 100644 --- a/addons/fastwq/service/dict/youdaoko.py +++ b/addons/fastwq/service/dict/youdaoko.py @@ -67,7 +67,7 @@ class Youdaoko(WebService): def fld_blng_sents_part(self): return self._get_singledict('blng_sents_part') - @export([u'百科', u'Encyclopedia']) + @export([u'百科', u'baike']) def fld_baike(self): return self._get_singledict('baike') diff --git a/addons21/fastwq/service/dict/esdict.py b/addons21/fastwq/service/dict/esdict.py index 68dde69..8336122 100644 --- a/addons21/fastwq/service/dict/esdict.py +++ b/addons21/fastwq/service/dict/esdict.py @@ -8,7 +8,7 @@ from ..base import * css = '' -@register(u'西语助手') +@register([u'西语助手', u'esdict']) class Esdict(WebService): def __init__(self): @@ -55,7 +55,7 @@ class Esdict(WebService): except Exception as e: return {} - @export(u'真人发音') + @export([u'真人发音', u'Real person pronounciation']) def fld_sound(self): url = 'https://api.frdic.com/api/v2/speech/speakweb?langid=es&txt=QYN{word}'.format( word=urllib2.quote(base64.b64encode(self.word.encode('utf-8'))) @@ -65,30 +65,30 @@ class Esdict(WebService): return self.get_anki_label(filename, 'audio') return '' - @export(u'音标') + @export([u'音标', u'Phonetic symbols']) def fld_phonetic(self): return self._get_field('phonitic') - @export(u'西汉-汉西词典') + @export([u'西汉-汉西词典', u'Spanish-chinese/chinese-spanish dictionary']) @with_styles(css=css) def fld_fccf(self): return self._get_field('fccf') - @export(u'西语例句库') + @export([u'西语例句库', u'Spanish examples']) @with_styles(css=css) def fld_example(self): return self._get_field('example') - @export(u'近义、反义、派生词典') + @export([u'近义、反义、派生词典', u'Synonyms, antonyms, derivatives']) def fld_syn(self): return self._get_field('syn') - @export(u'西西词典') + @export([u'西西词典', u'Spanish-spanish dictionary']) @with_styles(css=css) def fld_ff(self): return self._get_field('ff') - @export(u'西英词典') + @export([u'西英词典', u'Spanish-english dictionary']) @with_styles(css=css) def fld_fe(self): return self._get_field('fe') diff --git a/addons21/fastwq/service/dict/frdic.py b/addons21/fastwq/service/dict/frdic.py index bc4c47c..ac40aa5 100644 --- a/addons21/fastwq/service/dict/frdic.py +++ b/addons21/fastwq/service/dict/frdic.py @@ -8,7 +8,7 @@ from ..base import * css = '' -@register(u'法语助手') +@register([u'法语助手', u'frdic']) class Frdic(WebService): def __init__(self): @@ -55,7 +55,7 @@ class Frdic(WebService): except Exception as e: return {} - @export(u'真人发音') + @export([u'真人发音', u'Real person pronounciation']) def fld_sound(self): url = 'https://api.frdic.com/api/v2/speech/speakweb?langid=fr&txt=QYN{word}'.format( word=urllib2.quote(base64.b64encode(self.word.encode('utf-8'))) @@ -65,30 +65,30 @@ class Frdic(WebService): return self.get_anki_label(filename, 'audio') return '' - @export(u'音标') + @export([u'音标', u'Phonetic symbols']) def fld_phonetic(self): return self._get_field('phonitic') - @export(u'法汉-汉法词典') + @export([u'法汉-汉法词典', u'French-chinese/chinese-french dictionary']) def fld_fccf(self): return self._get_field('fccf') - @export(u'法语例句库') + @export([u'法语例句库', u'French examples']) @with_styles(css=css) def fld_example(self): return self._get_field('example') - @export(u'近义、反义、派生词典') + @export([u'近义、反义、派生词典', u'Synonyms, antonyms, derivatives']) @with_styles(css=css) def fld_syn(self): return self._get_field('syn') - @export(u'法法词典') + @export([u'法法词典', u'French-french dictionary']) @with_styles(css=css) def fld_ff(self): return self._get_field('ff') - @export(u'法英词典') + @export([u'法英词典', u'French-english dictionary']) @with_styles(css=css) def fld_fe(self): return self._get_field('fe') diff --git a/addons21/fastwq/service/dict/iciba.py b/addons21/fastwq/service/dict/iciba.py index 794a555..c2b2ccb 100644 --- a/addons21/fastwq/service/dict/iciba.py +++ b/addons21/fastwq/service/dict/iciba.py @@ -11,7 +11,7 @@ from ...utils import ignore_exception iciba_download_mp3 = True -@register(u'爱词霸') +@register([u'爱词霸', u'iciba']) class ICIBA(WebService): def __init__(self): @@ -39,19 +39,19 @@ class ICIBA(WebService): # return resp @ignore_exception - @export(u'美式音标') + @export([u'美式音标', u'American phonetic']) def fld_phonetic_us(self): seg = self._get_field('baesInfo') return '/' + seg['symbols'][0]['ph_am'] + '/' @ignore_exception - @export(u'英式音标') + @export([u'英式音标', u'British phonetic']) def fld_phonetic_uk(self): seg = self._get_field('baesInfo') return '/' + seg['symbols'][0]['ph_en'] + '/' @ignore_exception - @export(u'美式发音') + @export([u'美式发音', u'American pronounciation') def fld_mp3_us(self): seg = self._get_field('baesInfo') audio_url, t = seg['symbols'][0]['ph_am_mp3'], 'am' @@ -64,7 +64,7 @@ class ICIBA(WebService): return audio_url @ignore_exception - @export(u'英式发音') + @export([u'英式发音', u'British pronounciation']) def fld_mp3_uk(self): seg = self._get_field('baesInfo') audio_url, t = seg['symbols'][0]['ph_en_mp3'], 'en' @@ -77,14 +77,14 @@ class ICIBA(WebService): return audio_url @ignore_exception - @export(u'释义') + @export([u'释义', u'Translation']) def fld_definition(self): seg = self._get_field('baesInfo') parts = seg['symbols'][0]['parts'] return u'
'.join([part['part'] + ' ' + '; '.join(part['means']) for part in parts]) @ignore_exception - @export(u'双语例句') + @export([u'双语例句', u'Bilingual examples']) def fld_samples(self): sentences = '' segs = self._get_field('sentence') @@ -97,7 +97,7 @@ class ICIBA(WebService): return u"""
    {}
""".format(sentences) @ignore_exception - @export(u'权威例句') + @export([u'权威例句', u'Authoritative examples']) def fld_auth_sentence(self): sentences = '' segs = self._get_field('auth_sentence') @@ -108,7 +108,7 @@ class ICIBA(WebService): return u"""
    {}
""".format(sentences) @ignore_exception - @export(u'句式用法') + @export([u'句式用法', u'Sentence pattern usage']) def fld_usage(self): sentences = '' segs = self._get_field('jushi') @@ -121,13 +121,13 @@ class ICIBA(WebService): return u"""
    {}
""".format(sentences) @ignore_exception - @export(u'使用频率') + @export([u'使用频率', u'Frequency rate']) def fld_frequence(self): seg = self._get_field('baesInfo') return str(seg['frequence']) @ignore_exception - @export(u'英文例句') + @export([u'英文例句', u'English example']) def fld_st(self): sentences = '' segs = self._get_field('sentence') @@ -137,7 +137,7 @@ class ICIBA(WebService): return sentences @ignore_exception - @export(u'例句翻译') + @export([u'例句翻译', u'Examples']) def fld_sttr(self): sentences = '' segs = self._get_field('sentence') diff --git a/addons21/fastwq/service/dict/minidict.py b/addons21/fastwq/service/dict/minidict.py index f623579..0dda1cd 100644 --- a/addons21/fastwq/service/dict/minidict.py +++ b/addons21/fastwq/service/dict/minidict.py @@ -3,7 +3,7 @@ from ..base import * -@register(u'海词迷你词典') +@register([u'海词迷你词典', u'dict.cn']) class MiniDict(WebService): def __init__(self): @@ -45,19 +45,19 @@ class MiniDict(WebService): return self.cache_this(result) - @export(u'音标') + @export([u'音标', u'Phonetic symbols']) def fld_phonetic(self): return self._get_field('phonetic') - @export(u'基本释义') + @export([u'基本释义', u'Expressions']) def fld_explains(self): return self._get_field('expressions') - @export(u'例句与用法') + @export([u'例句与用法', u'Examples and patterns']) @with_styles(css='em {color:#cc0066;font-style:normal;}', need_wrap_css=True, wrap_class='minidict') def fld_sentences(self): return self._get_field('sentences') - @export(u'词形变化') + @export([u'词形变化', u'Inflections']) def fld_variations(self): return self._get_field('variations') diff --git a/addons21/fastwq/service/dict/youdao.py b/addons21/fastwq/service/dict/youdao.py index 15fab7e..8d1ac5a 100644 --- a/addons21/fastwq/service/dict/youdao.py +++ b/addons21/fastwq/service/dict/youdao.py @@ -64,11 +64,11 @@ class Youdao(WebService): pass return self.cache_this(result) - @export(u'音标') + @export([u'音标', u'Phonetic symbols']) def fld_phonetic(self): return self._get_field('phonetic') - @export(u'基本释义') + @export([u'基本释义', u'Explanations']) def fld_explains(self): return self._get_field('explains') @@ -93,7 +93,7 @@ class Youdao(WebService): except: return '' - @export(u'英式发音') + @export([u'英式发音', u'British pronounciation']) def fld_british_audio(self): audio_url = u'http://dict.youdao.com/dictvoice?audio={}&type=1'.format(self.quote_word) if youdao_download_mp3: @@ -102,7 +102,7 @@ class Youdao(WebService): return self.get_anki_label(filename, 'audio') return audio_url - @export(u'美式发音') + @export([u'美式发音', u'Americation pronounciation']) def fld_american_audio(self): audio_url = u'http://dict.youdao.com/dictvoice?audio={}&type=2'.format(self.quote_word) if youdao_download_mp3: @@ -111,54 +111,54 @@ class Youdao(WebService): return self.get_anki_label(filename, 'audio') return audio_url - @export(u'柯林斯英汉') + @export([u'柯林斯英汉', u'Collins']) def fld_collins(self): return self._get_singledict('collins') - @export(u'21世纪') + @export([u'21世纪', u'21st century']) def fld_ec21(self): return self._get_singledict('ec21') - @export(u'英英释义') + @export([u'英英释义', u'English-english dictionary']) def fld_ee(self): return self._get_singledict('ee') - @export(u'网络释义') + @export([u'网络释义', u'Web translation']) def fld_web_trans(self): return self._get_singledict('web_trans') - @export(u'同根词') + @export([u'同根词', u'Related words']) def fld_rel_word(self): return self._get_singledict('rel_word') - @export(u'同近义词') + @export([u'同近义词', u'Synonyms']) def fld_syno(self): return self._get_singledict('syno') - @export(u'双语例句') + @export([u'双语例句', u'Bilingual examples']) def fld_blng_sents_part(self): return self._get_singledict('blng_sents_part') - @export(u'原生例句') + @export([u'原生例句', u'']) def fld_media_sents_part(self): return self._get_singledict('media_sents_part') - @export(u'权威例句') + @export([u'权威例句', u'Authoritative examples']) def fld_auth_sents_part(self): return self._get_singledict('auth_sents_part') - @export(u'新英汉大辞典(中)') + @export([u'新英汉大辞典(中)', u'New english-chinese dictionary']) def fld_ce_new(self): return self._get_singledict('ce_new') - @export(u'百科') + @export([u'百科', u'baike']) def fld_baike(self): return self._get_singledict('baike') - @export(u'汉语词典(中)') + @export([u'汉语词典(中)', u'Chinese dictionary']) def fld_hh(self): return self._get_singledict('hh') - @export(u'专业释义(中)') + @export([u'专业释义(中)', u'Professional translation']) def fld_special(self): return self._get_singledict('special') diff --git a/addons21/fastwq/service/dict/youdaofr.py b/addons21/fastwq/service/dict/youdaofr.py index ca7996a..19b7f8c 100644 --- a/addons21/fastwq/service/dict/youdaofr.py +++ b/addons21/fastwq/service/dict/youdaofr.py @@ -33,7 +33,7 @@ class Youdaofr(WebService): pass return self.cache_this(result) - @export(u'基本释义') + @export([u'基本释义', 'Explanations']) def fld_explains(self): return self.cache_result('explains') if self.cached('explains') else \ self._get_from_api().get('explains', '') @@ -59,18 +59,18 @@ class Youdaofr(WebService): except: return '' - @export(u'网络释义') + @export([u'网络释义', 'Web translation']) def fld_web_trans(self): return self._get_singledict('web_trans') - @export(u'双语例句') + @export([u'双语例句', 'Bilingual examples']) def fld_blng_sents_part(self): return self._get_singledict('blng_sents_part') - @export(u'百科') + @export([u'百科', 'baike']) def fld_baike(self): return self._get_singledict('baike') - @export(u'汉语词典(中)') + @export([u'汉语词典(中)', 'Chinese dictionary']) def fld_hh(self): return self._get_singledict('hh') diff --git a/addons21/fastwq/service/dict/youdaoko.py b/addons21/fastwq/service/dict/youdaoko.py index 55fd91b..2d59c71 100644 --- a/addons21/fastwq/service/dict/youdaoko.py +++ b/addons21/fastwq/service/dict/youdaoko.py @@ -33,7 +33,7 @@ class Youdaoko(WebService): pass return self.cache_this(result) - @export(u'基本释义') + @export([u'基本释义', u'Explanations']) def fld_explains(self): return self.cache_result('explains') if self.cached('explains') else \ self._get_from_api().get('explains', '') @@ -59,18 +59,18 @@ class Youdaoko(WebService): except: return '' - @export(u'网络释义') + @export([u'网络释义', u'Web translation']) def fld_web_trans(self): return self._get_singledict('web_trans') - @export(u'双语例句') + @export([u'双语例句', u'Biligual example']) def fld_blng_sents_part(self): return self._get_singledict('blng_sents_part') - @export(u'百科') + @export([u'百科', u'baike']) def fld_baike(self): return self._get_singledict('baike') - @export(u'汉语词典(中)') + @export([u'汉语词典(中)', u'Chinese dictionary']) def fld_hh(self): return self._get_singledict('hh')