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.88k stars 389 forks source link

Support for recently added 110 new languages on Google Translate #517

Open khlsvr opened 1 month ago

khlsvr commented 1 month ago

Google has added a lot of new languages. Translating to/from some of them doesn't seem to work out of the box. [WARNING] Unknown target language code: jam

https://blog.google/products/translate/google-translate-new-languages-2024/

$ trans -U Current version: 0.9.7.1 Already up-to-date.

soimort commented 1 month ago

I'm aware that these new language codes will raise a 400 error from Google's side. In fact, all of them won't work out of the box, and some of them do work because they're supported alternatively by Bing.

trans uses the same legacy API that Google Chrome/Chromium in-browser translation uses. The newly added 110 languages have not landed in this API yet, as you can see from Chrome's "translate to" function that none of these 110 languages has appeared (e.g., Abkhaz)

I'll wait a while and see if Google will support them in-browser, otherwise it may take some time to do the hack.