Google 翻訳を使用して Web ページを翻訳する拡張機能を作成しようとしています。次のようなURLを作成しますurl google translate + current tab + &sl=auto&tl=it&hl=&ie=UTF-8
が、機能しません。どうしたの?
ありがとうございました
<script>
safari.application.addEventListener("command", performCommand, false);
function performCommand(event) {
if (event.command == "translate") {
var currentTab.url = safari.application.activeBrowserWindow.currentTab.url;
var rUrl = "http://translate.google.it/translate?u=" + encodeURIComponent(currentTab.url) + "&sl=auto&tl=it&hl=&ie=UTF-8";
safari.application.activeBrowserWindow.activeTab.url(rUrl);
}
}
</script>