Open renatofdds opened 8 years ago
Hi @renatofdds,
which version do you use? M-x google-translate-version RET
.
I'm also having this problem. Using most recent version 0.11.11
I'm also on 0.11.11
Facing the same issue on 0.11.11. Any help is highly appreciated, BTW, I am behind a http proxy.
Hi all!
I have no idea what exactly could be the root cause of the issue. But with your help I believe the reason could be discovered and the issue fixed.
I've just pushed the code (0.11.12
version) which should help us to debug the issues which relate to retrieving of TKK.
With these changes, please, execute M-: (setq google-translate--tkk-debug t) RET
(or M-x eval-expression RET (setq google-translate--tkk-debug t) RET
). Then try to translate a word/sentence as usually you do. As the result, two buffers should appear. First one usual one (*Google Translate*
) with the translation, and the second one (*Google Translate Debug*
) with the debug info, i.e. HTML which is used for retrieving of TKK. Then please paste the contents of *Google Translate Debug*
buffer here.
If you'll see that someone already posted the similar output as you get, please feel free to post it again, or just notify that you get the same output. I just believe that additional information would be helpful.
Actually any help is highly appreciated!
Thank you in advance!
Thank you for the efforts and further steps. I will report the test results soon.
After upgrading to 0.11.12 and setting the debug to true as you suggested I did a google-translate-smooth-translate.
I don't see two windows open and I receive the same error. This is what happens
Translate : "The text to be translated appears here correctly (Japanese)" RET Translate from : Japanese RET Translate to : English RET connecting to proxy.xxx.xxx.xx Failed to Search TKK
But version 0.11.10 works perfectly at my home computer (11.11 and 11.12 not tested yet). The above test was from my office computer and the only difference is that, the office computer is behind a http proxy. So I strongly doubt it has something to do with proxy.
Further testing for connection through proxy
Since google translate has to establish a connection to https://translate.google.com, i strongly suspect it has something to do with my proxy setting. Sorry if I wasted your time.
But I would sincerely appreciate if you can point out some ways I can make it to work in my work-computer behind proxy. I also hope many people need google translate in their office computer which is normally behind a proxy.
Thank you for your time and efforts
Interesting. My case is opposite. While it works on my office computer, doesn't work on my home computer. Both uses same emacs settings including google-translate's versions(0.11.13).
EDITED:
SOLVED The issue was Emacs-25.0 was using the "GET method" to connect to HTTPS sites, which my company's firewall (proxy) didn't like. The solution is to make Emacs use the "CONNECT method" to request connection to HTTPS sites (which the proxy allows). The following page correctly directed me towards the solution.
Either modify that one particular .el file and rebuild you emacs OR update to 'emacs-snapshot' version-26. I took the easier step and updated to Emacs-26.0.50.2. Now google-translate works like a charm within emacs. Thank you all for the pointers and support
@jack836 Good news. Thank you for sharing. BTW, I've edited my comment since it was wrong. My home network doesn't use a proxy AFAIK, but it seems worthwhile to try that. Again, thanks!
When I updated Emacs 25.1 to Emacs 25.2, I found the issue.
The issue is solved on my PC when google-translate
package turns to request through HTTPS but not HTTP by setting google-translate-base-url
and google-translate--tkk-url
as follows
(when (and (= emacs-major-version 25) (<= emacs-minor-version 2))
(setq google-translate-base-url
"https://translate.google.com/translate_a/single"
google-translate--tkk-url
"https://translate.google.com/"))
I am uncertain about the issue at Emacs 25.1 @jack836 mentions above that the problem is solved at Emacs 26 https://github.com/atykhonov/google-translate/issues/52#issuecomment-265949189
Wish it will be helpful.
Info:
Emacs version "25.2.1" which is built with GnuTLS library
(google-translate-version) says "Google Translate (version): 0.11.14"
google-translate package is installed via MELPA version 20170713.119; not MELPA stable
I met the same problem. After configuring a socks5 proxy for emacs, the problem got addressed. Maybe it's concerning to the ISP, who blocks the network traffic to google services. However, I found something weired. With network proxy set globally in gnome 3, the google services can be visited by firefox browser, but they are not available in eww web browser in emacs. The socks5 proxy settings in gnome 3 seems to be ignored.
example socks5 proxy for emacs:
(setq url-gateway-method 'socks)
(setq socks-server '("Default server" "127.0.0.1" 1080 5))
This just started happening to me after months without a problem. But, it went away after a few minutes. I am not using a proxy.
UPDATE: Now using a different computer that also worked without a problem. It's now failing with the same message. ๐ป๐จ
Same problem here. It has been working for months without a problem, but now i get google-translate--search-tkk: Failed to search TKK
all the time. I tried to set google-translate--tkk-debug
to true, but no second buffer with debug info appears.
Same problem here. It has been working for months without a problem, but now i get
google-translate--search-tkk: Failed to search TKK
all the time. I tried to setgoogle-translate--tkk-debug
to true, but no second buffer with debug info appears.
same issue here /'' (;;Emacs version 25.3; google-translate version 0.11.14
)
same here
GNU Emacs 26.1
Google Translate (version): 0.11.14
The problem seems to be that the google-translate--tkk-regex
definition in google-translate-tk.el
,
does not match the appropriate string in the retrieved HTML document, which in my case was
TKK='427110.1469889687'
.
I'm also running Emacs 26.1 and version 0.11.14.
same here, I'm investigating and looking for a solution
does not match the appropriate string in the retrieved HTML document
yes, previously HTML had something like the following:
TKK=eval('((function(){var a\x3d3470396290;var b\x3d183821724;return 426874+\x27.\x27+(a+b)})())');
now we have this representation: TKK='427116.3269864724';
.
@atykhonov @rantonse
I found a quick fix. Try it:
(when (and (string-match "0.11.14"
(google-translate-version))
(>= (time-to-seconds)
(time-to-seconds
(encode-time 0 0 0 23 9 2018))))
(defun google-translate--get-b-d1 ()
;; TKK='427110.1469889687'
(list 427110 1469889687)))
You can use TKK='427110.1469889687'
, TKK='427116.3269864724'
or other value.
Same problem here. It has been working for months without a problem, but now i get
google-translate--search-tkk: Failed to search TKK
all the time. I tried to setgoogle-translate--tkk-debug
to true, but no second buffer with debug info appears.
Emacs 25.1.1; Google Translate (version): 0.11.14
A stubborn error in the Messages buffer:
google-translate--search-tkk: Failed to search TKK
even if I change:
(setq google-translate-base-url
"https://translate.google.com/translate_a/single"
google-translate--tkk-url
"https://translate.google.com/")
Same here.
I had the same problems two days ago. My emacs version is 26.1
@SunDawning your fix work for me. Thanks you
(use-package google-translate
:ensure t
:config
(when (and (string-match "0.11.14"
(google-translate-version))
(>= (time-to-seconds)
(time-to-seconds
(encode-time 0 0 0 23 9 2018))))
(defun google-translate--get-b-d1 ()
;; TKK='427110.1469889687'
(list 427110 1469889687))))
@edurante Thanks for your workaround!
I also use use-package
, and the below patch works for me. ๐
-:config
+:init
I'm very sorry! The above patch in https://github.com/atykhonov/google-translate/issues/52#issuecomment-424796072 is my misunderstanding. ๐
(:config
is correct, NOT :init
)
Also, I need this workaround using bind-keys*
instead of :bind
:
(use-package google-translate
:config
;; ...
;; Workaround in https://github.com/atykhonov/google-translate/issues/52#issuecomment-424302439
;; ...
;; BEGIN: Workaround which I need
(bind-keys*
("C-c t" . google-translate-at-point)
("C-c T" . google-translate-at-point-reverse))
;; :bind (("C-c t" . google-translate-at-point)
;; ("C-c T" . google-translate-at-point-reverse))
;; END
)
@SunDawning it works very well! Thanks a lot! I'm preparing a patch based on the workaround.
The v0.11.15
have been released with the fix. Please update. It works well. In a case of any issue please report here (the issue is not going to be closed while we have tkk).
All credit to @SunDawning.
Thank you all!
The latest version works fine (no TKK error any more). I needed to restart emacs after re-installing google-translate.
Looks like the error is up again Search failed: ";TKK='", could someone, please, confirm? All worked just about a week ago.
Version: 0.11.15.
I am glad to say that everything got back to normal a couple of days ago. Only makes me wonder what could've have been the issue for more than a week, considering I didn't change anything systemwise on my computer.
@grigorievich it happens sometimes (quite rare) to me. I just translate again and get successful translation immediately after the issue.
@atykhonov I see what you mean. I did give it multiple consequtive tries on different days. Well, I sure am glad to see it working again!
@grigorievich me too. Thanks for the report nevertheless, this might be not so harmless as it looks like, so I'm keeping watch over it.
I got same error.
diff --git a/google-translate-tk.el b/google-translate-tk.el
index 4af9b87..2bac471 100644
--- a/google-translate-tk.el
+++ b/google-translate-tk.el
@@ -137,6 +137,8 @@ D is an integer."
(let* ((url-request-extra-headers '(("Connection" . "close")))
(buf (url-retrieve-synchronously google-translate--tkk-url)))
(with-current-buffer buf
+ (message "%S" (buffer-substring-no-properties (point-min)
+ (point-max)))
(google-translate--search-tkk))))
(defun google-translate--gen-rl (a b)
with above debug code, I got following output. (extract tkk
related)
var mobileWebapp={display_language: // snip...
campaign_tracker_id:'1h',tkk:'428741.3398103640', // snip...
false,enable_auto_update_result:false};var messages // snip...
TKK = mobileWebapp.tkk;
fix google-translate--search-tkk
like below, then the error seems fixed.
diff --git a/google-translate-tk.el b/google-translate-tk.el
index 4af9b87..e7a7c2f 100644
--- a/google-translate-tk.el
+++ b/google-translate-tk.el
@@ -124,8 +124,8 @@ D is an integer."
(let ((start nil)
(tkk nil)
(nums '()))
- (setq start (search-forward ";TKK='"))
- (search-forward "';")
+ (setq start (search-forward ",tkk:'"))
+ (search-forward "',")
(backward-char 2)
(setq tkk (buffer-substring start (point)))
(setq nums (split-string tkk "\\."))
@yuya373 Your patch works fine. Thanks a lot! ๐
Yes! @yuya373 patch works great! Emacs 25.1, newest version of google-translate from melpa.
It looks like that an issue that happens quite rare, turned into a permanent issue. It is fixed in 0.11.16
version. google-translate
doesn't work for me without the mentioned patch. @yuya373 thanks a lot!
I am having this issue, using version 0.11.17 and emacs 26.1.
Looks like the error is up again, :disappointed:
The output I got reads: Search failed: ",tkk:'"
I'm using google-translate, version 0.11.17 and emacs 26.1
(url-retrieve-synchronously google-translate--tkk-url)
this one sometimes returns an empty string, so searching TKK will fail
@touxstone, as a temporary solution you can try to replace 'google-translate--search-tkk' by:
(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
But I guess there should be some kind of cache... @atykhonov what do you think?
Hi, @a7f4 thanks though (replaced as suggested and restarted Emacs) it doesn't work for me (same output).
@touxstone I guess you have at least one more version of this package.
try this one:
find ~/.emacs.d -name "google-translate-tk.el"
I suppose that you'll get more than one )
I guess you have at least one more version of this package.
try this one:
find ~/.emacs.d -name "google-translate-tk.el"
I suppose that you'll get more than one )
so, the output I got is:
.emacs.d/elpa/google-translate-20190206.1229/google-translate-tk.el
@touxstone
It's quite strange if you've replaced the original google-translate--search-tkk
you should not be able to get the same output: Search failed: ",tkk:'"
maybe you have emacs --daemon
running on your machine?
anyway, make sure that:
1) google-translate-tk.el contains only one definition of google-translate--search-tkk
and this definition exactly :
(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
2) and you have only one fresh running instance of emacs
I am also puzzled. I've tried all the checkings I've been able to. replaced the above-given function, Mx-kill-emacs, restated the PC (even) included
and same output...
emacs 26.1 on debian buster.
google-translate--search-tkk: Search failed: ",tkk:'"
google-translate-buffer is an interactive autoloaded compiled Lisp function in โ.emacs.d/elpa/google-translate-20190206.1229/google-translate-default-ui.elโ.
(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
works for me and stops the error
google-translate--search-tkk: Search failed: ",tkk:'"
(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
This works, but for only one translation. If I translate something, then close the window with the translation, and then try to translate again, I get the same error:
"Search failed: ",tkk" I need to restart emacs to be able to translate again.
So I temporarily solved it with translate-shell. It's working like this: I open "shell-command" and type "e word-to-translate", and have a result. For this to work:
alias ั='trans -b ru:en'
alias e='trans en:ru -brief'
alias eng='trans en:ru'
(setq shell-command-switch "-ic")
to my .spacemacs dotspacemacs/user-config
to support loading .bashrc for "shell-command".@Liverm0r :
(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))
This works, but for only one translation. If I translate something, then close the window with the translation, and then try to translate again, I get the same error:"Search failed: ",tkk" I need to restart emacs to be able to translate again.
It causes because you didn't override the original function, but defined a function with the same name so, at first execution, it works but then original function overrides your definition.
try to find google-translate-tk.el
and replace google-translate--search-tkk
within it
But pls note! this is also a temporary solution
you can find my trying for resolve this issue here: #85
Any translation attempt is failing with the error: google-translate--search-tkk: Failed to search TKK