Skip to content

Commit

Permalink
Make language codes lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Jun 20, 2019
1 parent 53b23df commit 8abc634
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions translate/provider/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class GoogleTranslate:
supported_languages = {
"af": "Afrikaans", "sq": "Albanian", "am": "Amharic", "ar": "Arabic", "hy": "Armenian",
"az": "Azerbaijani", "eu": "Basque", "be": "Belarusian", "bn": "Bengali", "bs": "Bosnian",
"bg": "Bulgarian", "ca": "Catalan", "ceb": "Cebuano", "zh-CN": "Chinese (Simplified)",
"zh": "Chinese (Simplified)", "zh-TW": "Chinese (Traditional)", "co": "Corsican",
"bg": "Bulgarian", "ca": "Catalan", "ceb": "Cebuano", "zh-cn": "Chinese (Simplified)",
"zh": "Chinese (Simplified)", "zh-tw": "Chinese (Traditional)", "co": "Corsican",
"hr": "Croatian", "cs": "Czech", "da": "Danish", "nl": "Dutch", "en": "English",
"eo": "Esperanto", "et": "Estonian", "fi": "Finnish", "fr": "French", "fy": "Frisian",
"gl": "Galician", "ka": "Georgian", "de": "German", "el": "Greek", "gu": "Gujarati",
Expand Down Expand Up @@ -64,7 +64,7 @@ async def translate(self, text: str, to_lang: str, from_lang: str = "auto") -> s
return "".join(item[0] for item in data[0] if len(item) > 0 and item[0])

def is_supported_language(self, code: str) -> bool:
return code in self.supported_languages
return code.lower() in self.supported_languages


make_translation_provider = GoogleTranslate

0 comments on commit 8abc634

Please sign in to comment.