Browse Source

add ms translater, not works

pull/1/head
10sr 10 years ago
parent
commit
2a6b19e59d
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      emacs.el

+ 18
- 1
emacs.el View File

@@ -2430,8 +2430,25 @@ result for that word.")
(shell-command-to-string (shell-command-to-string
(format "dict_app '%s'" (format "dict_app '%s'"
word)))) word))))
("ms" .
(lambda (word)
(let ((url (concat "http://api.microsofttranslator.com/V2/Ajax.svc/"
"Translate?appId=%s&text=%s&to=%s"))
(apikey "3C9778666C5BA4B406FFCBEE64EF478963039C51")
(target "ja")
(eword (url-hexify-string word)))
(with-current-buffer (url-retrieve-synchronously
(format url
apikey
eword
target))
;; (search-forward-regexp "^$")
(buffer-substring-no-properties (point)
(point-max))))))
)) ))


;; (switch-to-buffer (url-retrieve-synchronously "http://google.com"))

(setq ilookup-default "ja") (setq ilookup-default "ja")


(defun ilookup--timer-add () (defun ilookup--timer-add ()
@@ -2500,10 +2517,10 @@ This function insert newline if required."
inputl) inputl)
(car inputl)))) (car inputl))))
(save-excursion (save-excursion
(setq ilookup--last-input input)
(goto-char outpoint) (goto-char outpoint)
(delete-region (point) (delete-region (point)
(point-max)) (point-max))
(setq ilookup--last-input input)
(insert (if func (insert (if func
(funcall func (funcall func
word) word)


Loading…
Cancel
Save