Have you considered using Azure Cognitive Services? The Azure Text Analytics REST API has a Language Detection feature.
There are also a lot of free api’s like https://languagelayer.com/ (up to 5000 calls a month) , but I don’t know what the quality is.