Index: localeTools.py |
diff --git a/localeTools.py b/localeTools.py |
index e97147d48f6b980636ce0a69096a0c92f01b2877..f9e8d830a927cb7b932f5851298c9f28462069ef 100644 |
--- a/localeTools.py |
+++ b/localeTools.py |
@@ -318,8 +318,10 @@ def setupTranslations(localeConfig, projectName, key): |
locales.add(mapLocale('BCP-47', match2.group(1))) |
allowed = set() |
- allowedLocales = urllib2.urlopen('http://crowdin.net/page/language-codes').read() |
- for match in re.finditer(r'<tr>\s*<td\b[^<>]*>([\w\-]+)</td>', allowedLocales, re.S): |
+ allowedLocales = urllib2.urlopen( |
+ 'https://crowdin.com/languages/languages_list?callback=foo' |
Wladimir Palant
2017/01/24 11:36:23
Please use https://crowdin.com/languages/languages
kzar
2017/01/25 03:45:04
Ah cool, didn't think to try that. Done.
|
+ ).read() |
+ for match in re.finditer(r'"code"\s*:\s*"([\w\-]+)"', allowedLocales, re.S): |
Wladimir Palant
2017/01/24 11:36:23
Please don't use regular expressions to parse JSON
kzar
2017/01/25 03:45:04
(I would have already if I had figured out the way
|
allowed.add(match.group(1)) |
if not allowed.issuperset(locales): |
print "Warning, following locales aren't allowed by server: " + ', '.join(locales - allowed) |