From 00474e5962b48a4ffa115790ee3bdea856293085 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 21 Sep 2014 22:44:59 -0500 Subject: [PATCH] Fix multilingual dict bug. --- earwigbot/commands/dictionary.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/earwigbot/commands/dictionary.py b/earwigbot/commands/dictionary.py index d22c5c9..acc74b4 100644 --- a/earwigbot/commands/dictionary.py +++ b/earwigbot/commands/dictionary.py @@ -53,7 +53,7 @@ class Dictionary(Command): multilingual = "#" in term if multilingual: - lang_requested = term[term.find("#")+1:] + lang_requested = term.rsplit("#", 1)[1] page = site.get_page(term, follow_redirects=True) try: entry = page.get() @@ -70,10 +70,9 @@ class Dictionary(Command): result = [] for lang, section in sorted(languages.items()): - if multilingual: - if lang == lang_requested: - return u"({0}) {1}".format(lang, definition) definition = self.get_definition(section, level) + if multilingual and lang == lang_requested: + return u"({0}) {1}".format(lang, definition) result.append(u"({0}) {1}".format(lang, definition)) return u"; ".join(result)