Closed LeisureLinux closed 7 months ago
If you already have set the HTTP_PROXY
env variable or specified a proxy in trans's config file, trans will always prioritize those when calling curl. Can you post your trans -V
?
thanks man for quick resp. here it is:
~ ᐅ cat .trans
proxy http://wpad:8888
~ ᐅ trans -V
Translate Shell 0.9.7.1-release
platform Linux
terminal type screen-256color
bi-di emulator [N/A]
gawk (GNU Awk) 5.2.1
fribidi (GNU FriBidi) [NOT INSTALLED]
audio player mpv --no-config
terminal pager less
web browser xdg-open
user locale zh_CN.UTF-8 (Chinese (Simplified))
host language zh-CN
source language auto
target language zh-CN
translation engine auto
proxy [NONE]
user-agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 Edg/104.0.1293.54
ip version [DEFAULT]
theme default
init file .trans
And which translation engine are you using? What type of proxy is running on port 8888?
Be aware that for Google Translate, trans does not invoke curl at all. Due to gawk's limited library support, there is currently no built-in support for SOCKS proxies in trans itself, so you'll have to use it with proxychains. For Bing, however, there shouldn't be a problem.
I am sure the proxy is on http. Not sure about the trans engine. This is a wonderful awk script that can do such a task I ever see. Brilliant art work. I may need time to digest the script.
the HTTP_PROXY env. work so far. Maybe as you said, because it is using Google as engine, and not using curl at all. I'll confirm later of my engine. Thx again for taking your time.
If the engine is auto, it will assume google. Looked like awk's inet/tcp network programming out of my understanding talking about the proxy setup in initHttpService function(line 3999). One way to improve maybe to do additional check of the curl env.(e.g. .curlrc) to see if any proxy set there and read it.
just my two cents.
If the engine is auto, it will assume google. Looked like awk's inet/tcp network programming out of my understanding talking about the proxy setup in initHttpService function(line 3999). One way to improve maybe to do additional check of the curl env.(e.g. .curlrc) to see if any proxy set there and read it.
just my two cents.
trans does not (and should not) read .curlrc
, because it is not curl. But whenever it calls curl, curl will use the proxy configured in .curlrc
automatically and trans does not intervene.
You can configure the variable proxy
in trans's own config file, but do follow the syntax. If you set a proxy in .trans
it will be passed on to curl and override the default setting you have in .curlrc
.
ops, my bad for not finding the correct syntax of .trans. so far so good for now, after following the syntax. :-)
I write a ~/.curlrc specify the proxy, which can be used for a normal shell script calling curl, which can work OK. But this trans awk script calling curl, but looked not looking .curlrc for my proxy settings there. Anybody had same issue like me? Thx.