Improve locale related logic