Only support modern versions of PyCountry.

This commit is contained in:
Tobias Gruetzmacher 2017-11-26 19:26:44 +01:00
parent 4d6cbf0720
commit 90685d9b0c
3 changed files with 4 additions and 5 deletions

View file

@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function
Languages = { Languages = {
'de': 'German', 'de': 'German',
'en': 'English', 'en': 'English',
'es': 'Spanish; Castilian', 'es': 'Spanish',
'fi': 'Finnish', 'fi': 'Finnish',
'fr': 'French', 'fr': 'French',
'it': 'Italian', 'it': 'Italian',

View file

@ -343,11 +343,10 @@ class Scraper(object):
lang = languages.Languages[self.lang] lang = languages.Languages[self.lang]
else: else:
try: try:
lang = pycountry.languages.get(alpha2=self.lang).name lang = pycountry.languages.get(alpha_2=self.lang).name
except KeyError: except KeyError:
try: try:
lang = pycountry.languages.get( lang = pycountry.languages.get(alpha2=self.lang).name
iso639_1_code=self.lang).name
except KeyError: except KeyError:
pass pass
return lang return lang

View file

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam