Hi,
I am trying to run this code for translating, but i am getting error
Traceback (most recent call last):
File "trans.py", line 2, in <module>
from google.cloud import translate
ModuleNotFoundError: No module named 'google.cloud'
I know that this error is because of google.cloud librabrary missing,
my question is that how can i install google.cloud library in my erpnext?
What i am trying to achieve is i’ve two fields for example one is “Name in English” and another one is “Name is Chinese”, i want whenever user enter Name in English it automatically translate it to Chinese.
Code :
# Imports the Google Cloud client library
from google.cloud import translate
# Instantiates a client
translate_client = translate.Client()
# The text to translate
text = u'Hello, world!'
# The target language
target = 'ru'
# Translates some text into Russian
translation = translate_client.translate(
text,
target_language=target)
print(u'Text: {}'.format(text))
print(u'Translation: {}'.format(translation['translatedText']))
Thanks.