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

Delta Between Two Patch Sets: packagerChrome.py

Issue 5702288324689920: Make sure that translations used in manifest.json exist in all languages (Closed)
Left Patch Set: Addressed comment Created March 13, 2014, 3:44 p.m.
Right Patch Set: Fixed malformed indentation Created March 13, 2014, 3:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus build tools, 3 # This file is part of the Adblock Plus build tools,
4 # Copyright (C) 2006-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 operaFile = '_locales/%s/messages.json' % operaLocale if operaLocale != No ne else None 281 operaFile = '_locales/%s/messages.json' % operaLocale if operaLocale != No ne else None
282 if chromeFile in files: 282 if chromeFile in files:
283 if operaFile != None: 283 if operaFile != None:
284 files[operaFile] = files[chromeFile] 284 files[operaFile] = files[chromeFile]
285 del files[chromeFile] 285 del files[chromeFile]
286 286
287 def fixMissingTranslations(files): 287 def fixMissingTranslations(files):
288 # Chrome requires messages used in manifest.json to be given in all languages 288 # Chrome requires messages used in manifest.json to be given in all languages
289 defaults = {} 289 defaults = {}
290 data = json.loads(files['_locales/%s/messages.json' % defaultLocale]) 290 data = json.loads(files['_locales/%s/messages.json' % defaultLocale])
291 for match in re.finditer('__MSG_(\S+)__', files['manifest.json']): 291 for match in re.finditer(r'__MSG_(\S+)__', files['manifest.json']):
292 » name = match.group(1) 292 name = match.group(1)
293 defaults[name] = data[name] 293 defaults[name] = data[name]
294 294
295 for filename in files: 295 for filename in files:
296 if not filename.startswith('_locales/') or not filename.endswith('/messages. json'): 296 if not filename.startswith('_locales/') or not filename.endswith('/messages. json'):
297 continue 297 continue
298 298
299 data = json.loads(files[filename]) 299 data = json.loads(files[filename])
300 for name, info in defaults.iteritems(): 300 for name, info in defaults.iteritems():
301 data.setdefault(name, info) 301 data.setdefault(name, info)
302 302
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 def shutdown_server(server): 409 def shutdown_server(server):
410 time.sleep(10) 410 time.sleep(10)
411 server.shutdown() 411 server.shutdown()
412 thread.start_new_thread(shutdown_server, (server,)) 412 thread.start_new_thread(shutdown_server, (server,))
413 server.serve_forever() 413 server.serve_forever()
414 414
415 if connections[0] == 0: 415 if connections[0] == 0:
416 print 'Warning: No incoming connections, extension probably not active in th e browser yet' 416 print 'Warning: No incoming connections, extension probably not active in th e browser yet'
417 else: 417 else:
418 print 'Handled %i connection(s)' % connections[0] 418 print 'Handled %i connection(s)' % connections[0]
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld