Check if the user is logged in before setting his locale.

This is a belt & braces approach just in case something goes really wrong somewhere and the anonymous user ends up with a locale_lang set and set to something valid.