[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: google-translate
From: |
Emanuel Berg |
Subject: |
Re: google-translate |
Date: |
Sat, 19 Sep 2015 02:09:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Another issue seems to be the display of Swedish chars
in the echo area, tho that isn't a general issue.
I don't know where it sneaked in, but the fixer defun
below appears to have the situation in
a rock-stead grip.
;; This file: http://user.it.uu.se/~embe8573/conf/emacs-init/translate.el
;; w3m-unisearch from
;; http://user.it.uu.se/~embe8573/conf/emacs-init/w3m/w3m-unisearch.el
(require 'w3m-unisearch)
(require 'google-translate-core-ui)
(defun fix-swedish-chars-in-string (str)
(loop for trans-pair in '(("\345" "å")
("\344" "ä")
("\366" "ö") ) do
(setq str (replace-regexp-in-string (car trans-pair)
(cadr trans-pair) str)) )
str)
(defun translate (src-lang dst-lang text)
(interactive)
(let ((killed kill-ring))
(google-translate-translate src-lang dst-lang text 'kill-ring)
(let ((translation (string-make-unibyte (current-kill 0))))
(setq kill-ring-yank-pointer killed)
(message "%s: %s" text (fix-swedish-chars-in-string translation)) )))
(defun swedish-to-english ()
(interactive)
(translate "sv" "en" (get-search-string "ord")) )
(defun english-to-swedish ()
(interactive)
(translate "en" "sv" (get-search-string "word(s)")) )
(defalias 'sv 'swedish-to-english)
(defalias 'en 'english-to-swedish)
--
underground experts united
http://user.it.uu.se/~embe8573
- Is it possible to transform text before feeding it to ispell?, Marcin Borkowski, 2015/09/08
- Re: Is it possible to transform text before feeding it to ispell?, Alexis, 2015/09/08
- Re: Is it possible to transform text before feeding it to ispell?, Tassilo Horn, 2015/09/08
- google-translate (was: Re: Is it possible to transform text before feeding it to ispell?), Emanuel Berg, 2015/09/08
- Re: google-translate (was: Re: Is it possible to transform text before feeding it to ispell?), Andrey Tykhonov, 2015/09/09
- Re: google-translate (was: Re: Is it possible to transform text before feeding it to ispell?), Emanuel Berg, 2015/09/09
- Re: google-translate, Emanuel Berg, 2015/09/15
- Re: google-translate, Alex Kost, 2015/09/16
- Re: google-translate, Emanuel Berg, 2015/09/16
- Re: google-translate, Emanuel Berg, 2015/09/17
- Re: google-translate,
Emanuel Berg <=
- Re: google-translate, Ian Zimmerman, 2015/09/19
- Re: google-translate, Emanuel Berg, 2015/09/19
- Re: google-translate, Emanuel Berg, 2015/09/19
Re: Is it possible to transform text before feeding it to ispell?, Michael Heerdegen, 2015/09/08
Re: Is it possible to transform text before feeding it to ispell?, Eli Zaretskii, 2015/09/08