#from transliteration_resources import language_detector import os from google.cloud import translate_v2 as Translate os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = '/home/user/mnf/project/MNF/MNF/json_keys/authentication.json' translate_client = Translate.Client() text = "KARINA is casually turning the pages of a magazine. With a bored expression she puts the Magazine on the table, takes a short lazy walk around, stops near the table, picks up her phone, thinks for a while and dials a number" result = translate_client.translate(str(text), target_language='hi') det_lang = result["detectedSourceLanguage"] print(result) # if det_lang == "hi-Latn": # return 'hi' # else: # return det_lang