Refactor localize.py

• Split l10n parser in a separate method.
• Only parse l10n files if needed to generate other files.
• Reduce memory footprint of the working dictionary by removing the module
  prefix from the key names.
• Use str.format() to avoid messy-looking multiple string concatenations.
• Switch to EAFP approach for most file checks.
• Skip generating a few characters in the JS files (size reduction).
• Improve comments and variable names.