You can use the Google Translate API to do that - i.e. I mean specifically just detect/predict the source language not just the bit that does the translation
Detecting Languages | Google Cloud Translation API Documentation | Google Cloud Platform[
^]
There is a similar API here - beware there is a charging structure in place for more than 5000 requests per day or more than 1Mb per day (which can soon add up if there is a lot of text!) -
Language Detection API[
^]
Jochen Arndt @User-2223753 has come up with another potential (manual) solution and there are more suggestions here -
Language identification - Wikipedia[
^]
If you need more suggestions then try using "Natural Language Processing" as a search term.