#281735 validlocale: Validity check and error handling could be improved