Raise an exception if a malformed locale is given