deepl-php icon indicating copy to clipboard operation
deepl-php copied to clipboard

Is it possible just to detect the source language without translating?

Open rvalitov opened this issue 8 months ago • 2 comments

I like the accuracy of language detection of DeepL. Is it possible to use just this functionality without translating?

rvalitov avatar May 10 '25 17:05 rvalitov

We don't have a separate endpoint in the API/method in the library for this, but you can just use translateText() and just look at the detected source language (and ignore the text).

Out of interest, is the reason behind you asking this that you would expect a language detection endpoint to be faster or cheaper?

JanEbbing avatar May 12 '25 09:05 JanEbbing

Thank you! Yes, exactly, I was thinking that if the text is already in the desired language, then why translate it? Language detection should use less resources, tokens, etc. Or if I will call the API to translate from English to English, it will not translate or alter the source text, because the detected source language matches the destination language?

rvalitov avatar May 12 '25 13:05 rvalitov