soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
6.94k stars 391 forks source link

Trans doesn't do anything #416

Closed sk8nfool closed 3 years ago

sk8nfool commented 3 years ago

I have a file of directory names that are most likely in Chinese (Google translate of the first claims Simplified Chinese). I have tried both Simplified and Traditional and there is no translation. I've attached both the input and output files. One of the commands I used is

trans -show-original y -e bing -s zh-CN -verbose -o eng.txt < dirs.txt

The output file contains no translations.

The input file: dirs.txt The output file: eng.txt

I am running trans on Ubuntu 18.04 after loading it from Ubuntu's repository with

sudo apt install translate-shell

What's wrong?

salkin-mada commented 3 years ago

I have a similar experience. Was working on a lua script using curl and trans. And the translation was working flawless one minute. The next it returns nothing.

❯ trans -b :dk "hello world"

... hmm. I wonder if my IP is now blocked somehow? At some point I was issuing bad cmd's like:

function T.translate()
    local command = "trans -brief :da \\\""..result.."\\\""
    local handle = io.popen(command)
    translated = handle:read("*a")
    handle:close()
end

Should have used string.format .. or of-course just local command = "trans -brief :da '"..result.."'" Nevertheless trans was working and then I escaped some chars wrongly. The cli was hanging. Ctrl-c After that I have not been able to get trans working again.

Even the "try it!" example does not work anymore.

❯ gawk -f <(curl -Ls --compressed https://git.io/translate) -- -shell
Translate Shell
(:q to quit)
> hej verden

> hvad sker der?

> nothing

> :q

~ took 19s
❯
salkin-mada commented 3 years ago

Aha. Something iffy had happened. I left the system on for an hour. Came back and reran the following command in the same terminal.

❯ trans -b :fr "hello world"

~
❯ trans -b :fr "hello world"
Bonjour le monde

So not sure if this issue/experience is related to @sk8nfool's

Apolsus commented 3 years ago

This tool fail to work sometimes. I have post a similar issue 418 However it was closed.

soimort commented 3 years ago

The OP is about an issue with Bing, whose support is known to be broken at the moment (as observed in #406).

As for the second issue, the empty output is because Google temporarily blocks IP addresses from time to time. In that case you'll need to wait for a few hours until Google unblocks you, or simply change to a different IP address.