Add debugging to locale setting code