From 25858a7c001e4b26e69da1ac3f159dd58797e148 Mon Sep 17 00:00:00 2001 From: James Vega Date: Thu, 12 Aug 2004 14:15:27 +0000 Subject: [PATCH] Some slight adjustments brought about by investigating Bug #1002363 --- others/babelfish.py | 18 ++++++++++-------- plugins/Babelfish.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/others/babelfish.py b/others/babelfish.py index d3651d981..5a085784a 100644 --- a/others/babelfish.py +++ b/others/babelfish.py @@ -9,18 +9,18 @@ Summary: import babelizer - print ' '.join(babelizer.available_languages) + print ' '.join(babelizer.available_languages) print babelizer.translate( 'How much is that doggie in the window?', - 'English', 'French' ) + 'English', 'French' ) def babel_callback(phrase): - print phrase - sys.stdout.flush() + print phrase + sys.stdout.flush() - babelizer.babelize( 'I love a reigning knight.', - 'English', 'German', - callback = babel_callback ) + babelizer.babelize( 'I love a reigning knight.', + 'English', 'German', + callback = babel_callback ) available_languages A list of languages available for use with babelfish. @@ -151,7 +151,9 @@ def babelize(phrase, from_language, through_language, limit = 12, callback = Non else: results.append(phrase) next = flip[next] - if next != from_language: + # next is set to the language of the last entry. this should be the same + # as the language we are translating to + if next != through_language: phrase = translate(phrase, next, flip[next]) results.append(phrase) if not callback: diff --git a/plugins/Babelfish.py b/plugins/Babelfish.py index 0e1dd77a6..227aab3dc 100644 --- a/plugins/Babelfish.py +++ b/plugins/Babelfish.py @@ -151,7 +151,7 @@ class Babelfish(callbacks.Privmsg): And='or')) return translations = babelfish.babelize(text, fromLang, toLang) - irc.reply(translations[-1]) + irc.reply(utils.htmlToText(translations[-1])) except (KeyError, babelfish.LanguageNotAvailableError), e: irc.reply('%s is not a valid language. Valid languages ' 'include %s.' % (e,