Code cleanup in locale setting