nidhaloff / deep-translator

A flexible free and unlimited python tool to translate between different languages in a simple way using multiple translators.
https://deep-translator.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
1.44k stars 169 forks source link

Get the source language when translating with "auto" on Google Translate #261

Open PlugNPush opened 2 months ago

PlugNPush commented 2 months ago

I need to know what the original language was for the text that got translated over Google Translate, could this be added to this library?

Something like .translate_with_metadata() returning both the text and source language, and maybe even some extra data if the Google Translate API gives them to you.

My previous library for translation used to do this and got abandoned (googletrans), I would appreciate having it here.

tomekrzymyszkiewicz commented 1 month ago

It looks like the website used to provide Google Translate translation does not display information about what language has been automatically detected. It's displayed on the main Google Translate website but there this information is obfuscated in the webpage source, so it'll be way more complicated to scrape that information.

I've tried to implement that, but I felt like I had to create the new translator scraper from scratch.