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

Unified Diff: localeTools.py

Issue 5709087064981504: Issue 1321 - Truncate extension name and description at build time instead of only truncating descr… (Closed)
Patch Set: Created Sept. 3, 2014, 6:42 p.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
« no previous file with comments | « no previous file | packagerChrome.py » ('j') | packagerChrome.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: localeTools.py
===================================================================
--- a/localeTools.py
+++ b/localeTools.py
@@ -263,36 +263,26 @@ def preprocessChromeLocale(path, metadat
value["description"] = key
else:
# Delete description from translations
if "description" in value:
del value["description"]
return json.dumps(data, ensure_ascii=False, sort_keys=True, indent=2)
-def truncate(text, length_limit):
- if len(text) <= length_limit:
- return text
- return text[:length_limit - 1].rstrip() + u"\u2026"
-
def postprocessChromeLocale(path, data):
parsed = json.loads(data)
if isinstance(parsed, list):
return
# Delete description from translations
for key, value in parsed.iteritems():
if "description" in value:
del value["description"]
- # Crop Chrome description, we need to enforce the length limit
- if "description_chrome" in parsed:
- description_chrome = parsed["description_chrome"]
- description_chrome["message"] = truncate(description_chrome["message"], 132)
-
file = codecs.open(path, 'wb', encoding='utf-8')
json.dump(parsed, file, ensure_ascii=False, sort_keys=True, indent=2, separators=(',', ': '))
file.close()
def setupTranslations(type, locales, projectName, key):
# Copy locales list, we don't want to change the parameter
locales = set(locales)
« no previous file with comments | « no previous file | packagerChrome.py » ('j') | packagerChrome.py » ('J')

Powered by Google App Engine
This is Rietveld