[Pkg-mozext-commits] [adblock-plus] 266/464: Don't attempt to set up translation languages that Crowdin doesn't yet support
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 60b57a92767283ab62c4213281eecae92bf2c5ab
Author: Wladimir Palant <trev at adblockplus.org>
Date: Thu Jul 5 12:27:50 2012 +0200
Don't attempt to set up translation languages that Crowdin doesn't yet support
---
localeTools.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/localeTools.py b/localeTools.py
index 6b1d98e..220b304 100644
--- a/localeTools.py
+++ b/localeTools.py
@@ -153,7 +153,14 @@ def setupTranslations(locales, projectName, key):
if match2:
locales.add(match2.group(1))
- locales = list(locales)
+ allowed = set()
+ allowedLocales = urllib2.urlopen('http://crowdin.net/page/language-codes').read()
+ for match in re.finditer(r'<tr>\s*<td>([\w\-]+)</td>', allowedLocales, re.S):
+ allowed.add(match.group(1))
+ if not allowed.issuperset(locales):
+ print 'Warning, following locales aren\'t allowed by server: ' + ', '.join(locales - allowed)
+
+ locales = list(locales & allowed)
locales.sort()
params = urllib.urlencode([('languages[]', locale) for locale in locales])
result = urllib2.urlopen('http://api.crowdin.net/api/project/%s/edit-project?key=%s&%s' % (projectName, key, params)).read()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list