atykhonov / google-translate

Emacs interface to Google Translate
369 stars 47 forks source link

Add proxy support for google-translate service in Emacs #70

Closed stardiviner closed 7 years ago

stardiviner commented 7 years ago

In some countries, we need to access Google services through proxy or other tools, can google-translate support proxy in Emacs?

JianleiZhang commented 7 years ago

(setq url-proxy-services '("http" . "127.0.0.1:8123"))) Be careful of DNS contamination if you live in China!

mgcyung commented 5 years ago

The http and https proxy should be both set (setq url-proxy-services '(("http" . "127.0.0.1:8123") ("https" . "127.0.0.1:8123")))

stardiviner commented 5 years ago

I'm curious is it possible only let google-translate through the url-proxy-services? Or google-translate.el can pass proxy as argument to url-request function?

mgcyung commented 5 years ago

Try

(setq url-proxy-services '(("http" . "127.0.0.1:8123")
                           ("https" . "127.0.0.1:8123")
                           ("no_proxy" . "^.*(?!translate\\.google\\.com).*$")))
stardiviner commented 5 years ago

Hmm, I want is reverse, not gloabl through proxy. I want to translate.google.com through proxy only. How to set that wil url-proxy-services ? Just like add rules for web browser proxy extension.

mgcyung commented 5 years ago

The regex expression excludes "translate.google.com" so that proxy goes only for "translate.google.com".

stardiviner commented 5 years ago

Aha, I see. Thanks, @mgcyung . I got it.