Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: localeTools.py

Issue 29372826: Issue 4836 - Have the setuptrans command use the current Crowdin API (Closed)
Patch Set: Receive and parse locales as JSON Created Jan. 25, 2017, 3:42 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: localeTools.py
diff --git a/localeTools.py b/localeTools.py
index e97147d48f6b980636ce0a69096a0c92f01b2877..05a1d8e4620574e0290606ad24f524a31fde284b 100644
--- a/localeTools.py
+++ b/localeTools.py
@@ -318,9 +318,11 @@ 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):
- allowed.add(match.group(1))
+ allowedLocales = json.load(urllib2.urlopen(
+ 'https://crowdin.com/languages/languages_list?callback='
+ ))
+ for locale in allowedLocales:
+ allowed.add(locale["code"])
if not allowed.issuperset(locales):
print "Warning, following locales aren't allowed by server: " + ', '.join(locales - allowed)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld