from deep_translator import GoogleTranslator def ndps(description,lang="ru"): detected_lang = "auto" translator = GoogleTranslator(source=lang, target=detected_lang) out=translator.translate(text=description) translator = GoogleTranslator(source=detected_lang, target=lang) if detected_lang == lang: if detected_lang != 'auto': response = "Sorry but I can't help you because I don't understand what you really need." else: translator = GoogleTranslator(source=f'{lang}', target=detected_lang) response = translator.translate(text="Sorry but I can't help you because I don't understand what you really need.") return response return translator.translate(text=out)