Added another fix where if we cannot get the language from the spring security then we can use the referer.