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

Unified Diff: packagerChrome.py

Issue 29562599: Issue 5751 - Removing legacy gecko support (Closed)
Patch Set: Rebasing, addressing comments Created Oct. 5, 2017, 10:05 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
« build.py ('K') | « packager.py ('k') | packagerGecko.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packagerChrome.py
diff --git a/packagerChrome.py b/packagerChrome.py
index e93d9b2fb4bdbd5637df3c4abd16628122eff311..3f7ab4346565192101277f396c00a9f3d9a573ab 100644
--- a/packagerChrome.py
+++ b/packagerChrome.py
@@ -190,28 +190,6 @@ def toJson(data):
).encode('utf-8') + '\n'
-def import_string_webext(data, key, source):
- """Import a single translation from the source dictionary into data"""
- data[key] = source
-
-
-def import_string_gecko(data, key, value):
- """Import Gecko-style locales into data.
-
- Only sets {'message': value} in the data-dictionary, after stripping
- undesired Gecko-style access keys.
- """
- match = re.search(r'^(.*?)\s*\(&.\)$', value)
- if match:
- value = match.group(1)
- else:
- index = value.find('&')
- if index >= 0:
- value = value[0:index] + value[index + 1:]
-
- data[key] = {'message': value}
-
-
def import_locales(params, files):
import localeTools
@@ -249,17 +227,8 @@ def import_locales(params, files):
data = json.loads(files[targetFile].decode('utf-8'))
try:
- # The WebExtensions (.json) and Gecko format provide
- # translations differently and/or provide additional
- # information like e.g. "placeholders". We want to adhere to
- # that and preserve the addtional info.
- if sourceFile.endswith('.json'):
- with io.open(sourceFile, 'r', encoding='utf-8') as handle:
- sourceData = json.load(handle)
- import_string = import_string_webext
- else:
- sourceData = localeTools.readFile(sourceFile)
- import_string = import_string_gecko
+ with io.open(sourceFile, 'r', encoding='utf-8') as handle:
+ sourceData = json.load(handle)
# Resolve wildcard imports
if keys == '*' or keys == '=*':
@@ -283,7 +252,7 @@ def import_locales(params, files):
if key in data:
print 'Warning: locale string %s defined multiple times' % key
- import_string(data, key, sourceData[stringID])
+ data[key] = sourceData[stringID]
except Exception as e:
print 'Warning: error importing locale data from %s: %s' % (sourceFile, e)
« build.py ('K') | « packager.py ('k') | packagerGecko.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld