Whilst trying to validate or deploy a package, you may come across the Salesforce error Cannot specify a gender for a gender neutral language
. This error occurs when trying to deploy a custom object.
This article goes into detail as to why this error occurs and how you can resolve it.
What causes this error?
This validation error occurs when you are making a deployment between two Orgs which have different default languages. Specifically from a source Org which has a gendered language and a target Org that does not.
When creating a custom object within your Org which has English as the default language, one of the object settings is to specify whether the object starts with a vowel sound.
However, within an Org which has a gendered language, the same custom object creation has the setting to specify gender instead.
What this means is that when trying to deploy this object with an assigned gender, within the XML for the gendered TestObject, you find that either Masculine or Feminine is defined.
And trying to deploy this object to an English language Org creates this validation error because there is no equivalent gender
tag for custom objects.
How do I fix the error?
The way to fix this error is to ensure that both the source and target Orgs have their default languages set to either a gendered language or a genderless language. This setting can be changed by logging into your Org, going into Setup, then Company Information and editing the Default Language.
What if you deploy from a genderless language Org to a gendered language Org?
So when these deployments go the other way, from a genderless language Org to a gender based language, it depends on whether the custom object you are looking to deploy starts with a vowel sound.
If it doesn't, there is no tag within the XML to reflect this. However, if you check Starts with vowel sound
, this is highlighted within the XML for the object.
And when you try to deploy this object to an Org which has a gendered language, you'll hit a validation error Cannot specify a startsWith attribute for this language
.
Which settings are for which languages?
Please refer to the table below for the Custom Object settings for currently supported languages (please note that French and Italian have both Gender & Starts with Vowel settings):