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

Side by Side Diff: packagerChrome.py

Issue 5181140172275712: Issue 2665 - Removed outdated locale mapping for Opera, fixing Spanish translation (Closed)
Patch Set: Created June 8, 2015, 8:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This Source Code Form is subject to the terms of the Mozilla Public 3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this 4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 6
7 import sys 7 import sys
8 import os 8 import os
9 import re 9 import re
10 import json 10 import json
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 else: 237 else:
238 index = value.find("&") 238 index = value.find("&")
239 if index >= 0: 239 if index >= 0:
240 value = value[0:index] + value[index + 1:] 240 value = value[0:index] + value[index + 1:]
241 data[key] = {'message': value} 241 data[key] = {'message': value}
242 except Exception, e: 242 except Exception, e:
243 print 'Warning: error importing locale data from %s: %s' % (sourceFile, e) 243 print 'Warning: error importing locale data from %s: %s' % (sourceFile, e)
244 244
245 files[targetFile] = toJson(data) 245 files[targetFile] = toJson(data)
246 246
247 if params['type'] == 'opera':
248 # Opera has a slightly different locale mapping
249 operaMapping = {
250 'es': 'es_ES',
251 'es_419': None,
252 'pt': 'pt_PT',
253 }
254 for chromeLocale, operaLocale in operaMapping.iteritems():
255 chromeFile = '_locales/%s/messages.json' % chromeLocale
256 operaFile = '_locales/%s/messages.json' % operaLocale if operaLocale != No ne else None
257 if chromeFile in files:
258 if operaFile != None:
259 files[operaFile] = files[chromeFile]
260 del files[chromeFile]
261
262 def truncate(text, length_limit): 247 def truncate(text, length_limit):
263 if len(text) <= length_limit: 248 if len(text) <= length_limit:
264 return text 249 return text
265 return text[:length_limit - 1].rstrip() + u"\u2026" 250 return text[:length_limit - 1].rstrip() + u"\u2026"
266 251
267 def fixTranslationsForCWS(files): 252 def fixTranslationsForCWS(files):
268 # Chrome Web Store requires messages used in manifest.json to be present in 253 # Chrome Web Store requires messages used in manifest.json to be present in
269 # all languages. It also enforces length limits for extension names and 254 # all languages. It also enforces length limits for extension names and
270 # descriptions. 255 # descriptions.
271 defaults = {} 256 defaults = {}
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 'lib/info.js' not in files): 357 'lib/info.js' not in files):
373 files['lib/info.js'] = createInfoModule(params) 358 files['lib/info.js'] = createInfoModule(params)
374 359
375 zipdata = files.zipToString() 360 zipdata = files.zipToString()
376 signature = None 361 signature = None
377 pubkey = None 362 pubkey = None
378 if keyFile != None: 363 if keyFile != None:
379 signature = signBinary(zipdata, keyFile) 364 signature = signBinary(zipdata, keyFile)
380 pubkey = getPublicKey(keyFile) 365 pubkey = getPublicKey(keyFile)
381 writePackage(outFile, pubkey, signature, zipdata) 366 writePackage(outFile, pubkey, signature, zipdata)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld