def local_trans(word, word_eol, userdata): destination = xchat.get_context() if word[1].lower() == 'translators': print "Available methods are:", color["blue"], str(translator.get_pairs()) else: threading.Thread(target=translate, args=(word[1], word[2], word_eol[3], destination)).start() return xchat.EAT_ALL
def local_trans(word, word_eol, userdata): destination = xchat.get_context() if word[1].lower() == 'translators': print "Available methods are:", color["blue"], str( translator.get_pairs()) else: threading.Thread(target=translate, args=(word[1], word[2], word_eol[3], destination)).start() return xchat.EAT_ALL
def autotranslate(word, word_eol, userdata): global autotranslator, option if word[1].lower() == 'del': if autotranslator.has_key(word[2].lower()): autotranslator.pop(word[2].lower()) print color["red"], "Autotranslator for", word[2], "deleted!" save_vars() else: print color["red"], "No Autotranslator for", word[2], "found" elif word[1].lower() == 'list': if len(autotranslator) == 0: print color["red"], "You have no auto translators!" else: print color["dgreen"], "Your auto translators are:" for key in autotranslator: print color["blue"], key, autotranslator[ key].source, autotranslator[key].destination elif word[1].lower() == 'on': option["autotranslate"] = True print color["dgreen"], "Autotranslate has been turned ON" save_vars() elif word[1].lower() == 'off': option["autotranslate"] = False print color["red"], "Autotranslate has been turned OFF" save_vars() elif word[1].lower() == 'translators': print "Available methods are:", color["blue"], str( translator.get_pairs()) else: try: autotranslator[word[1].lower()] = translator.Translator( word[2], word[3]) print color["dgreen"], "We will now auto translate", word[ 1], "from", word[2], "to", word[3] save_vars() except Exception, args: print color["red"], "Proper format is Nick FromLanguage ToLanguage" return
def autotranslate(word, word_eol, userdata): global autotranslator, option if word[1].lower() == 'del': if autotranslator.has_key(word[2].lower()): autotranslator.pop(word[2].lower()) print color["red"], "Autotranslator for", word[2], "deleted!" save_vars() else: print color["red"], "No Autotranslator for", word[2], "found" elif word[1].lower() == 'list': if len(autotranslator) == 0: print color["red"], "You have no auto translators!" else: print color["dgreen"], "Your auto translators are:" for key in autotranslator: print color["blue"], key, autotranslator[key].source, autotranslator[key].destination elif word[1].lower() == 'on': option["autotranslate"] = True print color["dgreen"], "Autotranslate has been turned ON" save_vars() elif word[1].lower() == 'off': option["autotranslate"] = False print color["red"], "Autotranslate has been turned OFF" save_vars() elif word[1].lower() == 'translators': print "Available methods are:", color["blue"], str(translator.get_pairs()) else: try: autotranslator[word[1].lower()] = translator.Translator(word[2],word[3]) print color["dgreen"], "We will now auto translate", word[1], "from", word[2], "to", word[3] save_vars() except Exception, args: print color["red"], "Proper format is Nick FromLanguage ToLanguage" return
def translators(destination): pairs = str(translator.get_pairs()) destination.command("say Available methods are " + pairs)