mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-08 18:44:06 +01:00
Some slight adjustments brought about by investigating Bug #1002363
This commit is contained in:
parent
a1a703df32
commit
25858a7c00
@ -9,18 +9,18 @@ Summary:
|
|||||||
|
|
||||||
import babelizer
|
import babelizer
|
||||||
|
|
||||||
print ' '.join(babelizer.available_languages)
|
print ' '.join(babelizer.available_languages)
|
||||||
|
|
||||||
print babelizer.translate( 'How much is that doggie in the window?',
|
print babelizer.translate( 'How much is that doggie in the window?',
|
||||||
'English', 'French' )
|
'English', 'French' )
|
||||||
|
|
||||||
def babel_callback(phrase):
|
def babel_callback(phrase):
|
||||||
print phrase
|
print phrase
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
babelizer.babelize( 'I love a reigning knight.',
|
babelizer.babelize( 'I love a reigning knight.',
|
||||||
'English', 'German',
|
'English', 'German',
|
||||||
callback = babel_callback )
|
callback = babel_callback )
|
||||||
|
|
||||||
available_languages
|
available_languages
|
||||||
A list of languages available for use with babelfish.
|
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:
|
else:
|
||||||
results.append(phrase)
|
results.append(phrase)
|
||||||
next = flip[next]
|
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])
|
phrase = translate(phrase, next, flip[next])
|
||||||
results.append(phrase)
|
results.append(phrase)
|
||||||
if not callback:
|
if not callback:
|
||||||
|
@ -151,7 +151,7 @@ class Babelfish(callbacks.Privmsg):
|
|||||||
And='or'))
|
And='or'))
|
||||||
return
|
return
|
||||||
translations = babelfish.babelize(text, fromLang, toLang)
|
translations = babelfish.babelize(text, fromLang, toLang)
|
||||||
irc.reply(translations[-1])
|
irc.reply(utils.htmlToText(translations[-1]))
|
||||||
except (KeyError, babelfish.LanguageNotAvailableError), e:
|
except (KeyError, babelfish.LanguageNotAvailableError), e:
|
||||||
irc.reply('%s is not a valid language. Valid languages '
|
irc.reply('%s is not a valid language. Valid languages '
|
||||||
'include %s.' % (e,
|
'include %s.' % (e,
|
||||||
|
Loading…
Reference in New Issue
Block a user