From c4ee35a09dde469c870f5105463ef8d0f7695a4d Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 21 Sep 2014 22:55:17 -0500 Subject: [PATCH] Support case-insensitive language lookups. --- earwigbot/commands/dictionary.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/earwigbot/commands/dictionary.py b/earwigbot/commands/dictionary.py index 9c136b4..a6855c7 100644 --- a/earwigbot/commands/dictionary.py +++ b/earwigbot/commands/dictionary.py @@ -67,10 +67,11 @@ class Dictionary(Command): if "#" in term: # Requesting a specific language lang = term.rsplit("#", 1)[1] - if lang not in languages: + langs = {key.lower(): val for (key, val) in languages.iteritems()} + if lang.lower() not in langs: resp = u"Language {0} not found in definition." return resp.format(lang) - definition = self.get_definition(languages[lang], level) + definition = self.get_definition(langs[lang.lower()], level) return u"({0}) {1}".format(lang, definition) result = []