Closed Prasanta-Hembram closed 1 year ago
Hi @Prasanta-Hembram,
Deep Translator rely on a static dictionary which does not contain the target language you are trying to use:
We do not see it directly, but here the MyMemoryTranslator
is defaulting to the languages available on the Google translator:
https://github.com/nidhaloff/deep-translator/blob/4328b37c0a03bc29ba6ed61ff5b1e8082373c0a8/deep_translator/mymemory.py#L39-L44
You can add a new dictionary with the language and its corresponding code:
languages = MY_MEMORY_LANGUAGES_TO_CODES
It is possible to create a new dictionary to extend the language support, but you must know the languages available (you can probably contact My Memory to obtain the available languages and the codes).
Thank you, @Vincent-Stragier, for guiding me. I will soon open a pull request.
Reference to a list of all the languages: https://www.matecat.com/api/docs#languages
Closed after PR merge
Description
I was trying to translate a sentence from English to Santali, but I'm not getting the translated text. Instead a message is thrown as: No support for the provided language. Instead it should have translated in Santali langauge. Mymemory supports Santali language which can be accessed using this api: https://api.mymemory.translated.net/get?q=What+is+your+name+?&langpair=en|sat
What I Did
== Contents of deep.py == from deep_translator import MyMemoryTranslator
text = 'What is your name ?' translated = MyMemoryTranslator(source='en', target='sat').translate(text)
print(translated)
== Output == I ran: "python deep.py" and got the following output.