We only need to set the language when we are using a login; otherwise it will always be English.
Also, improve detection (Addresses #3662)
The javascript code contains assignments of empty dicts with the same variable name
Work in progress
See issue #3753
Description changed