I wanted the following order to set language:
1) Use users preferences if language is set there
2) Use the browsers language settings
3) Use the default language from config.php
The problem is that it just doesn't work with SM 1.4.0.
The attached patch fixes this for me. Obviously it's
not the correct way but it works fine.