def lookup_forvo(field_list): "Look up pronunciation on forvo." if field_list: text = get_text_from_fields(field_list) else: text = get_selection() if len(text) == 0: raise ValueError(u"No text to look up.") new_text = urllib.quote(text.encode("utf-8")) url = ("http://de.forvo.com/search/" + new_text) qurl = QUrl() qurl.setEncodedUrl(url) QDesktopServices.openUrl(qurl)
def lookup_wadoku(field_list): "Look up text with Wadoku (German-Japanese)." if field_list: text = get_text_from_fields(field_list) else: text = get_selection() if len(text) == 0: raise ValueError(u"Kein Text zum nachschlagen.") base_url = "http://www.wadoku.de/wadoku/search/" url = base_url + urllib.quote(text.encode("utf-8")) qurl = QUrl() qurl.setEncodedUrl(url) QDesktopServices.openUrl(qurl)
def lookup_kanjilexikon(field_list): """Look up the kanji in text on Kanji-Lexikon.""" if field_list: kanji = get_text_from_fields(field_list) else: kanji = get_selection() kanji = get_han_characters(kanji) if len(kanji) == 0: raise ValueError("No kanji found.") new_text = urllib.quote(kanji.encode("utf-8")) url = ("http://lingweb.eva.mpg.de/kanji/index.html?kanji=" + new_text) qurl = QUrl() qurl.setEncodedUrl(url) QDesktopServices.openUrl(qurl)
def lookup_saiga(field_list): """Look up the first kanji in text on Saiga.""" # I don’t really use this dictionary any more. Feel free to # add it to your menu again. if field_list: kanji = get_text_from_fields(field_list) else: kanji = get_selection() kanji = get_first_han_character(kanji) if len(kanji) == 0: raise ValueError("No kanji found.") new_text = urllib.quote(kanji.encode("utf-8")) url = ("http://www.saiga-jp.com/cgi-bin/dic.cgi?m=search&sc=0&f=0&j=" + new_text + "&g=&e=&s=&rt=0&start=1") qurl = QUrl() qurl.setEncodedUrl(url) QDesktopServices.openUrl(qurl)