Simple translation frontend, forked from https://git.sr.ht/~yerinalexey/gtranslate.
Go to file
Kyle Anthony Williams bf49f94426 Use <select> for language selection 2021-02-04 17:27:11 +03:00
static Refactor CSS, small style updates 2021-01-18 21:59:14 +03:00
templates Use <select> for language selection 2021-02-04 17:27:11 +03:00
.gitignore Initial 2021-01-17 23:19:52 +03:00
LICENSE Initial 2021-01-17 23:19:52 +03:00
README.md Rename template-dir to templates-dir 2021-01-23 00:16:07 +03:00
api.go Move request handlers out of main.go 2021-01-22 23:44:50 +03:00
go.mod Initial 2021-01-17 23:19:52 +03:00
go.sum Initial 2021-01-17 23:19:52 +03:00
languages.go Use <select> for language selection 2021-02-04 17:27:11 +03:00
main.go Use <select> for language selection 2021-02-04 17:27:11 +03:00
translate.go Move request logic to a different function 2021-01-18 23:25:21 +03:00
utils.go Move request handlers out of main.go 2021-01-22 23:44:50 +03:00
web.go Use <select> for language selection 2021-02-04 17:27:11 +03:00

README.md

gtranslate

Better front-end for Google Translate that doesn't track you and works without JavaScript.

Installation

git clone https://git.sr.ht/~yerinalexey/gtranslate
cd gtranslate

go build

Then run the server with

./gtranslate

If you want to use a different port:

./gtranslate -b :3000 # will run on port 3000

Note: if you're running it outside of development environment, you should pass --templates-dir and --static-dir arguments pointing to templates and static directories:

./gtranslate \
  --templates-dir /usr/share/webapps/gtranslate/templates \
  --static-dir    /usr/share/webapps/gtranslate/static

Other settings (available with ./gtranslate --help):

Usage of ./gtranslate:
  -b, --bind string            Address to bind the server to, [addr]:port (default ":5000")
      --proxy string           Proxy URL, with no scheme http is assumed
      --static-dir string      Static files directory (default "./static")
      --templates-dir string   Templates directory (default "./templates")
      --user-agent string      User-Agent header to use

Using Tor

Routing requests through Tor has its benefits:

  • Google will have a hard time tracking gtranslate servers as they act like normal Tor users
  • You probably won't get banned as requests are made from different IPs

Despite that, it has some drawbacks:

  • Much slower response time
  • Might get capcha or some other junk that will block requests
  • If doing the wrong thing, you might get your server compromised (in terms of anonymity)
  • This feature is not tested in development

First of, you need to set up Tor daemon on the server. Here's a guide on ArchWiki: Tor.

With default settings, it should start a SOCKS5 proxy on localhost, port 9050.

Also, to minimize fingerprint, you need to use a very common user agent on Tor network. And, you guessed it, get it straight from Tor Browser. If you have one, you can just open https://httpbin.org/headers and copy it from there. If not, the latest available is provided here: Tor Browser's User-Agent

Full setup:

./gtranslate \
  --user-agent "Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0" \
  --proxy "socks5://localhost:9050" \
  ...

If you have managed to set it up or experienced issues with this guide, feel free to shoot an email to my public inbox.

TODO

  • Proper language selector
  • Dark theme