learningequality/ka-lite — pull request #1184 by bcipolli (2013-12-01 20:30:12+00:00)
Title: Do basic validation of subtitles and po files before packaging them up for customers.

Currently, this is just a command for secondary validation; with some help, this can be put into our `cache_subtitles` and `update_language_packs` scripts.

Right now, we download and pack up all subtitles and translations to ship to our users, with no validation. This can cause problems:
* Subtitles are sometimes empty, malformed, or can contain garbage (even vulgar) content. This would still let videos run, but might confuse or upset users who expect good content, not empty/garbage/vulgar content.
* Translations *must* be done properly. If, for example, format strings are not done properly, this will cause Django to throw, and a 500 server error to be returned. ***Sometimes those server errors can be unrecoverable.*** (e.g. #1119)

This change partially solves these problems by:
* Identifying SRT files that are empty or malformed
* Identifying some translations that are broken and need a-fixin'. (well, this was done before... I'm just wrapping the function into a validation function).

Then this code either:
* Auto-fix (for example, by deleting rogue SRTs), or
* Halts language pack creation for languages with errors