Commit be608279 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5_administration: add tool to clean up Localizer messages

parent 9b026068
......@@ -117,6 +117,21 @@ def MessageCatalog_deleteNotTranslatedMessageDict(self):
del(self._messages[k])
return len(not_translated_message_dict.keys())
def MessageCatalog_cleanUpMessageDict(self):
"""
Cleans up translation dictionnaries by removing empty values
and deleting entries without any translation from the Localizer's
MessageCatalog instance messages.
"""
count = 0
for k,v in self._messages.items():
for lang, translation in v.items():
if len(translation) == 0 or translation == k:
del self._messages[k][lang]
if len(v) == 0:
del self._messages[k]
count += 1
return count
def checkConversionToolAvailability(self):
"""
......
......@@ -46,7 +46,8 @@
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 88, 29: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:106, 29: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
<string>W:156, 2: No exception type(s) specified (bare-except)</string>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>MessageCatalog_cleanUpMessageDict</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5Administration</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>MessageCatalog_cleanUpMessageDict</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Cleans up translation dictionnaries by removing empty values and deleting entries without any translation from the Localizer\'s MessageCatalog instance messages.</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment