Potential fix for #1758: make sure that gettext (and other functions/variables) are always defined.
Fixing js bug, cleaning up html