Add locale-aware check to identifier_is_valid