简体   繁体   中英

How can I use google translation API in Django with python

I am using Django to create a project where I can change the language of website where user can use the page in any language they are comfortable with. But I am not sure how to implement google translate API in Django can anyone help me. I know that we can install google translation API using

"$ pip install googletrans"

but how can we implement this in Django framework. I am new to python. Thank you in advance.

there is a pip package which you can import in your templates and there will be google translate button. django-google-translate visit this and you will find more information.

you can use googletrans library. Here I include the library. https://pypi.org/project/googletrans/ Here the documentation also availabe. It is easy to use.

pip install googletran s

    from googletrans import Translator

    translator = Translator()
    data = await translator.translate('යුනිකෝඩ් ', dest='ec', src='si').text()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM