learningequality/ka-lite — pull request #1140 by bcipolli (2013-11-26 17:05:21+00:00)
Title: Cleanup of i18n command code to make use of lang_code consistent

#1120 pointed out that amara, crowdin, and django all use different versions of the language code en-gb vs en-GB vs en_GB, respectively. Our code wasn't quite tracking those properly.

Triggered by #1120, I saw that the i18n code could use some cleanup, so in tracking things down, I did so. Some general things that changed:
* Indenting
* make variable names consistent (`lang_code` vs `language_code` vs `code` vs `lang`)
* sharing code, including filenames, in `shared/i18n.py`
* Closing file pointers as soon as they're unneeded
* Outputting to logging.debug for debug-only info, making sure the non-debug info makes a nice interface
* Moved internal json files (for tracking download progress) out of the (publicly-accessible) `kalite/static/data` directory, and into a private `data` dir

To address #1120, I:
* Set a standard in the code to use the IETF standard format (e.g. en-GB)
* Added comments into the code, so it's clear what language code format is expected
* Added explicit conversion where I felt it was helpful
* Added variables for different formats within the same function, when they were used side-by-side.
* Tracked down the places that were giving us trouble (there were 2) and updated the code.

Testing:
* Clean away existing language pack data
* Create a language pack for `en-GB` (and others)
* Download and install from the distributed server
* Verify that the interface language change be changed, and that subtitles can be used.