[Pkg-mozext-commits] [adblock-plus] 319/464: Added Web Store description to the Adblock Plus for Chrome locales
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:29 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 3001a0c4c62d5cc640265d7d7bf8327aee746dfd
Author: Wladimir Palant <trev at adblockplus.org>
Date: Tue Oct 30 17:21:24 2012 +0100
Added Web Store description to the Adblock Plus for Chrome locales
---
localeTools.py | 30 +++++++++++++++++++++++-------
packagerChrome.py | 1 +
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/localeTools.py b/localeTools.py
index c2a45e5..f28ddcd 100644
--- a/localeTools.py
+++ b/localeTools.py
@@ -317,7 +317,7 @@ def postFiles(files, url):
body += 'Content-Type: application/octet-stream\r\n'
body += 'Content-Transfer-Encoding: binary\r\n'
body += '\r\n' + data + '\r\n'
- body += '--%s--\r\n' % boundary
+ body += '--%s--\r\n' % boundary
body = body.encode('utf-8')
request = urllib2.Request(url, StringIO(body))
@@ -336,9 +336,14 @@ def updateTranslationMaster(type, metadata, dir, projectName, key):
for file in os.listdir(dir):
path = os.path.join(dir, file)
if os.path.isfile(path):
- if type == 'chrome':
+ if type == 'chrome' and file.endswith('.json'):
data = preprocessChromeLocale(path, metadata, True)
newName = file
+ elif type == 'chrome':
+ fileHandle = codecs.open(path, 'rb', encoding='utf-8')
+ data = json.dumps({file: {'message': fileHandle.read()}})
+ fileHandle.close()
+ newName = file + '.json'
else:
data = toJSON(path)
newName = file + '.json'
@@ -365,9 +370,14 @@ def uploadTranslations(type, metadata, dir, locale, projectName, key):
for file in os.listdir(dir):
path = os.path.join(dir, file)
if os.path.isfile(path):
- if type == 'chrome':
+ if type == 'chrome' and file.endswith('.json'):
data = preprocessChromeLocale(path, metadata, False)
newName = file
+ elif type == 'chrome':
+ fileHandle = codecs.open(path, 'rb', encoding='utf-8')
+ data = json.dumps({file: {'message': fileHandle.read()}})
+ fileHandle.close()
+ newName = file + '.json'
else:
data = toJSON(path)
newName = file + '.json'
@@ -392,12 +402,12 @@ def getTranslations(type, localesDir, defaultLocale, projectName, key):
dir, file = os.path.split(info.filename)
if not re.match(r'^[\w\-]+$', dir) or dir == defaultLocale:
continue
- if type == 'chrome':
+ if type == 'chrome' and file.count('.') == 1:
origFile = file
else:
origFile = re.sub(r'\.json$', '', file)
- if not origFile.endswith('.dtd') and not origFile.endswith('.properties'):
- continue
+ if type == 'gecko' and not origFile.endswith('.dtd') and not origFile.endswith('.properties'):
+ continue
mapping = langMappingChrome if type == 'chrome' else langMappingGecko
for key, value in mapping.iteritems():
@@ -417,8 +427,14 @@ def getTranslations(type, localesDir, defaultLocale, projectName, key):
path = os.path.join(localesDir, dir, origFile)
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
- if type == 'chrome':
+ if type == 'chrome' and origFile.endswith('.json'):
postprocessChromeLocale(path, data)
+ elif type == 'chrome':
+ data = json.loads(data)
+ if origFile in data:
+ fileHandle = codecs.open(path, 'wb', encoding='utf-8')
+ fileHandle.write(data[origFile])
+ fileHandle.close()
else:
fromJSON(path, data)
diff --git a/packagerChrome.py b/packagerChrome.py
index ab8f4fe..6bf5491 100644
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -88,6 +88,7 @@ def addToZip(zip, filters, dir, baseName):
filelc = file.lower()
if (file.startswith('.') or
file == 'buildtools' or file == 'qunit' or file == 'metadata' or
+ file == 'store.description' or
filelc.endswith('.py') or filelc.endswith('.pyc') or
filelc.endswith('.crx') or filelc.endswith('.zip') or
filelc.endswith('.sh') or filelc.endswith('.bat') or
--
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