fixed specs, all green. refactored detect_locale and replace_locale into set_locale