Localization

This code changes two things
* The locale selection mechanism.
* Checks to sanitize broken locale settings and to avoid them.

Fixes / benefits:
* With the previous (non `flask.ext.babel`-standard) mechanism to select locales:

This code changes the mechanism to update a selected translation. With the previous (non standard) mechanism, the flask application lacked of a default language. If notebook conig corruption occurred, the notebook hung and recovery was difficult.