Translate from English To Arabic
7 views (last 30 days)
Show older comments
I tried to translate text from English to Arabic using following code:
url = 'http://ajax.googleapis.com/ajax/services/language/translate';
page = urlread(url, 'get', {'v', '1.0','q', 'Hello', ... 'langpair', ['en' '|' 'ar']});
but the result will be
page =
{"responseData": {"translatedText":""}, "responseDetails": null, "responseStatus": 200}
Please help me to solve this problem.
0 Comments
Answers (1)
Benjamin
on 25 Mar 2025
Edited: Walter Roberson
on 28 Mar 2025
The issue is that Google's old Translation API (v1.0) is deprecated and no longer works. Instead, use the Google Cloud Translation API or an alternative like DeepL.
For Google Cloud Translation API, you can use this approach in Python:
python
from googletrans import Translator
translator = Translator()
translated_text = translator.translate("Hello", src="en", dest="ar")
print(translated_text.text)
If you need a MATLAB solution, consider calling an API using webread(), but you’ll need an Translation API key.
2 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!