Improve boolean checking.
Merge LANGUAGES and LANG_INDEX in tools/constants.py