Skip to content

Commit 7c112a6

Browse files
committed
use chrome.surfingkeys.translateCurrentPage if available
1 parent 9ab50da commit 7c112a6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/content_scripts/common/default.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,13 @@ export default function(api, clipboard, insert, normal, hints, visual, front, br
216216
tabOpenLink("https://translate.google.com/translate?js=n&sl=auto&tl=zh-CN&u=" + window.location.href);
217217
}
218218
}
219-
mapkey(';t', 'Translate selected text with google', openGoogleTranslate);
219+
mapkey(';t', 'Translate selected text with google', () => {
220+
if (chrome.surfingkeys) {
221+
chrome.surfingkeys.translateCurrentPage();
222+
} else {
223+
openGoogleTranslate()
224+
}
225+
});
220226
vmapkey('t', '#9Translate selected text with google', openGoogleTranslate);
221227

222228
mapkey('O', '#1Open detected links from text', function() {

0 commit comments

Comments
 (0)