Skip to content

Commit

Permalink
Fix error in Sublime Text 2
Browse files Browse the repository at this point in the history
- Fixed bug with incorrect hotkeys by default.
- Added the README file in the plugin menu.
- Fixed bug occuring in Sublime Text 2
(#2 (comment))
  • Loading branch information
pafnuty committed Jan 3, 2014
1 parent 41ede32 commit c6146bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"2013.09.16.00.00.00": "messages/2013.09.16.txt"
"2013.10.18.00.00.00": "messages/2013.10.18.txt"
"2013.10.19.00.00.00": "messages/2013.10.19.txt"
"2014.01.03.18.00.00": "messages/2013.01.03.txt"
"2014.01.03.21.00.00": "messages/2013.01.03.txt"
}
2 changes: 2 additions & 0 deletions messages/2014.01.03.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ What's new in this version:
--------------------------
- Fixed bug with incorrect hotkeys by default.
- Added the README file in the plugin menu.
- Fixed bug occuring in Sublime Text 2 (https://github.com/pafnuty/sublime-yandex-translate/issues/2#issuecomment-31220150)


--- По русски ---
Expand All @@ -14,3 +15,4 @@ What's new in this version:
--------------------------
- Исправлен баг с неправильным назначением горячих клавиш по умолчанию.
- Добавлен пункт README в меню плагина.
- Исправлена ошибка возникающая в Sublime Text 2 (https://github.com/pafnuty/sublime-yandex-translate/issues/2#issuecomment-31220150)
8 changes: 1 addition & 7 deletions yaTranslate.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ def run(self, edit, output_language = settings.get("output_language")):

if key:
v = self.view
selection = v.substr(region)

selection = v.substr(region).encode('utf-8')
translate = YandexTranslate(key, ui_lang)

detected = translate.detect(selection)
Expand All @@ -41,7 +40,6 @@ def run(self, edit, output_language = settings.get("output_language")):

text = (json.dumps(result['text'][0], ensure_ascii = False)).strip('"').replace('\\n', "\n").replace('\\t', "\t").replace('\\"', '"')

# print (text)
v.replace(edit, region, text)
if (result['code'] == 200):
sublime.status_message(u'Done! (translate '+detected+' --> '+output_language+')')
Expand Down Expand Up @@ -104,12 +102,8 @@ def run(self, edit):

def on_done(index):
if index >= 0:
# print(lkey[index])
self.view.run_command("ya_translate", {"output_language": lkey[index]})


# v.replace(edit, v.sel()[0], text)

self.view.window().show_quick_panel(ltrasl, on_done)

else:
Expand Down

0 comments on commit c6146bc

Please sign in to comment.