[r21450]Addons: Check for two-letter lang as well as 5-char locale
E.g, check fr as well as fr_FR svn: r21455
This commit is contained in:
parent
b99e2e29df
commit
7d7cc6f789
@ -377,12 +377,18 @@ class ViewManager(CLIManager):
|
||||
# now we have a list of languages to try:
|
||||
fp = None
|
||||
for lang in langs:
|
||||
URL = "%s/listings/addons-%s.txt" % (config.get("behavior.addons-url"), lang)
|
||||
URL = ("%s/listings/addons-%s.txt" %
|
||||
(config.get("behavior.addons-url"), lang))
|
||||
LOG.debug(" trying: %s" % URL)
|
||||
try:
|
||||
fp = urlopen(URL, timeout=10) # abort after 10 seconds
|
||||
except: # some error
|
||||
LOG.debug(" IOError!")
|
||||
except:
|
||||
try:
|
||||
URL = ("%s/listings/addons-%s.txt" %
|
||||
(config.get("behavior.addons-url"), lang[:2]))
|
||||
fp = urlopen(URL, timeout=10)
|
||||
except Exception as err: # some error
|
||||
LOG.warn("Failed to open %s: %s" (lang, str(err)))
|
||||
fp = None
|
||||
if fp and fp.getcode() == 200: # ok
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user