import sys from translate import translate from package_mangement.downlaod_languages import install_language from package_mangement.check_packages import check_languages_installed from create_response import create_respone def main(): message = sys.argv[1] from_lang = sys.argv[2] to_lang = sys.argv[3] # Check if languages are installed is_installed = check_languages_installed(from_lang, to_lang) if not is_installed: # Attempt to install the languages installed = install_language(from_lang, to_lang) if installed != 0: # Installation failed error = f"No available package for translating from {from_lang} to {to_lang}" create_respone("None", from_lang, to_lang, error) return # Exit the function early # Languages are installed or installation succeeded translated = translate(message, from_lang, to_lang) if translated: create_respone(translated, from_lang, to_lang, error = "None") else: create_respone("None", from_lang, to_lang, error = "Could not translate it.") if __name__ == "__main__": main()