offline translator for sublime
unknown
python
2 years ago
690 B
36
Indexable
import sublime import sublime_plugin import time import os import sys dict_path = os.path.dirname(os.path.abspath(__file__)) + '\\full-eng-rus' sys.path.insert(1, os.path.dirname(os.path.abspath(__file__))) from pystardict import Dictionary class OfflineTranslate(sublime_plugin.TextCommand): def run(self, edit): v = self.view word = v.substr(v.sel()[0]) dict1 = Dictionary(dict_path) try: translate = dict1.dict[word.lower()] except: self.view.show_popup('I can\'t find this word', location=-1, on_navigate=print) raise ValueError('I can\'t find this word') self.view.show_popup(translate, location=-1, max_width=700, on_navigate=print)
Editor is loading...