Hi All,
I’m trying to use the LibreTranslate docker container to translate some text. However, I am unable to actually get it to detect the language correctly.
Here is an example query:
curl -X POST "http://libretranslate:5000/translate" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "q=El%20respeto%20que%20se%20le%20brinda%20al%20personal%20y%20a%20los%20clientes&source=auto&target=en&format=text"
I get the following output:
{"translatedText":"El respeto que se le brinda al personal y a los clientes"}
When I would expect to get:
{"translatedText": "the respect given to staff and customers"}
If I run the text through the detect API, I also see this similar issue:
Example Query:
curl -X POST "http://libretranslate:5000/detect" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "q=El%20respeto%20que%20se%20le%20brinda%20al%20personal%20y%20a%20los%20clientes"
I get:
[{"confidence":0.0,"language":"en"}]
When I would expect to get:
[{"confidence": 98,"language": "es"}]
If I specify the language, es
instead of using auto
I get the correct result:
Example Query:
curl -X POST "http://libretranslate:5000/translate" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "q=El%20respeto%20que%20se%20le%20brinda%20al%20personal%20y%20a%20los%20clientes&source=es&target=en&format=text"
Output:
{"translatedText":"the respect given to staff and customers"}
Would anyone happen to know what would be causing this issue?
I’m using libretranslate/libretranslate:latest
with the default settings which is LibreTranslate 1.2.4
If I put the text in https://libretranslate.com/ and use Auto Detect (Experimental) it is able to correctly detect the language.