translate-shell icon indicating copy to clipboard operation
translate-shell copied to clipboard

Translate many lines at once?

Open sjl opened this issue 10 years ago • 4 comments

I'd love to use this program to pipe emails from Mutt into and translate them. When I do this, it translates each individual line at a time, seemingly round-tripping each line to/from Google. I feel like this is going to get me blacklisted from Google if I do it too much. Is there a way to tell it to just translate all of stdin in one go, instead of doing it line by line?

sjl avatar Aug 25 '15 12:08 sjl

In order to translate some very long text, POST requests should be used instead of GET, because the maximum length that trans can handle has a limitation (see #30 for details). It's not implemented yet but on my future plan.

For now, you could pipe any text like (if you want to a complete translation of stdin) echo "good\nmorning" | xargs | trans :ja However, if stdin grows too large, this might not work as expected.

soimort avatar Aug 30 '15 20:08 soimort

Is this something you'd accept a PR for?

sjl avatar Aug 31 '15 11:08 sjl

Sure, PRs are always welcome, as long as it's useful and properly implemented.

soimort avatar Aug 31 '15 21:08 soimort

This is still not available? I found out the hard way piping some text to trans and then Google starting to reject my requests. Please please add this feature.

valankar avatar Jun 28 '19 08:06 valankar