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) |