Gender — Gender-Aware Translations and Grammar Rules
In this tutorial, you will learn about Gender. We cover key concepts, practical examples, and best practices to help you master this topic.
Gender-aware translations handle grammatical gender in pronouns, adjectives, and verb forms across languages with different gender systems.
What You'll Learn
By the end of this tutorial, you'll understand how grammatical gender affects translations, how to use ICU select format for gender-dependent text, how to handle gender-neutral language, and how to implement user pronoun preferences.
Why It Matters
Languages with grammatical gender (French, Spanish, German, Arabic, Russian) change adjectives, articles, and verb forms based on the subject's gender. A notification like "Alice added her photo" becomes "Alice added his photo" if the user is male in Spanish ("Alice anadio su foto" is gender-ambiguous but "Alice esta feliz" changes to "feliz" or "feliz" depending). Ignoring gender creates grammatically incorrect and potentially offensive translations.
Real-World Use
A social platform represents user gender as a preference stored in the user profile. Notifications use ICU select format to choose between "he/him", "she/her", and "they/them" in English, and the appropriate gendered forms in Spanish, French, and German. Adding a new pronoun option requires only translation file changes.
Gender Systems by Language
graph LR
A[Gender in Language] --> B[No gender
Japanese, Chinese,
Korean, Finnish]
A --> C[Two genders
French, Spanish,
Italian — masc/fem]
A --> D[Three genders
German, Russian,
Polish — masc/fem/neut]
A --> E[Gender in pronouns only
English — he/she/they]
--user preference-->
F[ICU select format
{gender, select, male {his} female {her} other {their}}]
style A fill:#4a90d9,color:#fff
style E fill:#27ae60,color:#fff
style F fill:#f39c12,color:#fff
ICU Select for Gender
// i18n/gender-icu.js — ICU MessageFormat gender handling
const { MessageFormat } = require('@messageformat/core');
// English — gender affects possessive pronoun only
const en = new MessageFormat('en');
const enNotification = en.compile(
'{name} {gender, select, ' +
'male {updated his} ' +
'female {updated her} ' +
'other {updated their}} profile picture.'
);
console.log(enNotification({ name: 'Alice', gender: 'female' }));
// Output: Alice updated her profile picture.
console.log(enNotification({ name: 'Bob', gender: 'male' }));
// Output: Bob updated his profile picture.
console.log(enNotification({ name: 'Alex', gender: 'non-binary' }));
// Output: Alex updated their profile picture.
// Spanish — gender affects verb conjugation (updated = actualizado/actualizada) and possessive
const es = new MessageFormat('es');
const esNotification = es.compile(
'{name} {gender, select, ' +
'male {actualizó su foto de perfil} ' +
'female {actualizó su foto de perfil} ' +
'other {actualizó su foto de perfil}}.'
);
// Note: "actualizó su" works for both, but adjectives would change:
// "contento" (male happy) vs "contenta" (female happy)
// French — gender affects past participle
const fr = new MessageFormat('fr');
const frNotification = fr.compile(
'{name} {gender, select, ' +
'male {a mis a jour sa photo de profil} ' +
'female {a mise a jour sa photo de profil} ' +
'other {a mis a jour sa photo de profil}}.'
);
console.log(frNotification({ name: 'Alice', gender: 'female' }));
// Output: Alice a mise a jour sa photo de profil.
console.log(frNotification({ name: 'Bob', gender: 'male' }));
// Output: Bob a mis a jour sa photo de profil.
// Arabic — gender affects verb conjugation for both subject and object
const ar = new MessageFormat('ar');
const arNotification = ar.compile(
'{gender, select, ' +
'male {{name} حدث} ' +
'female {{name} حدثت} ' +
'other {قام {name} بتحديث}} صورة ملفه الشخصي.'
);
console.log(arNotification({ name: 'Alice', gender: 'female' }));
// Output: أليس حدثت صورة ملفه الشخصي.
console.log(arNotification({ name: 'محمد', gender: 'male' }));
// Output: محمد حدث صورة ملفه الشخصي.
User Pronoun Preferences
// i18n/pronouns.js — User pronoun management
class PronounManager {
constructor() {
this.pronouns = new Map();
}
// Define pronoun sets per locale
static PRONOUN_SETS = {
'en': {
'he/him': {
subject: 'he',
object: 'him',
possessive: 'his',
possessive_adj: 'his',
reflexive: 'himself'
},
'she/her': {
subject: 'she',
object: 'her',
possessive: 'hers',
possessive_adj: 'her',
reflexive: 'herself'
},
'they/them': {
subject: 'they',
object: 'them',
possessive: 'theirs',
possessive_adj: 'their',
reflexive: 'themselves'
}
},
'es': {
'he/him': {
subject: 'él',
object: 'le',
possessive: 'suyo',
possessive_adj: 'su',
adjective_end: 'o'
},
'she/her': {
subject: 'ella',
object: 'le',
possessive: 'suya',
possessive_adj: 'su',
adjective_end: 'a'
},
'they/them': {
subject: 'elle',
object: 'le',
possessive: 'suye',
possessive_adj: 'su',
adjective_end: 'e'
}
},
'de': {
'he/him': {
subject: 'er',
object: 'ihn',
possessive: 'seins',
possessive_adj: 'sein',
article: 'der'
},
'she/her': {
subject: 'sie',
object: 'ihr',
possessive: 'ihres',
possessive_adj: 'ihr',
article: 'die'
},
'they/them': {
subject: 'sie',
object: 'ihnen',
possessive: 'ihres',
possessive_adj: 'ihr',
article: 'die'
}
}
};
setPronouns(userId, pronounSet, locale = 'en') {
const sets = PronounManager.PRONOUN_SETS[locale];
if (!sets || !sets[pronounSet]) {
throw new Error(`Unknown pronoun set: ${pronounSet} for ${locale}`);
}
this.pronouns.set(`${userId}:${locale}`, {
setId: pronounSet,
forms: sets[pronounSet]
});
}
getPronouns(userId, locale = 'en') {
// Try specific locale, fall back to en
return this.pronouns.get(`${userId}:${locale}`)
|| this.pronouns.get(`${userId}:en`)
|| PronounManager.PRONOUN_SETS[locale]?.['they/them']
|| PronounManager.PRONOUN_SETS['en']['they/them'];
}
// Format a message with pronouns
formatMessage(template, user, locale = 'en') {
const pronounData = this.getPronouns(user.id, locale);
const forms = pronounData.forms;
return template
.replace(/\{name\}/g, user.displayName)
.replace(/\{subject\}/g, forms.subject)
.replace(/\{object\}/g, forms.object)
.replace(/\{possessive\}/g, forms.possessive)
.replace(/\{possessive_adj\}/g, forms.possessive_adj)
.replace(/\{reflexive\}/g, forms.reflexive);
}
}
// Usage
const pronouns = new PronounManager();
pronouns.setPronouns('user1', 'she/her', 'en');
pronouns.setPronouns('user2', 'he/him', 'es');
const template = '{name} updated {possessive_adj} profile picture.';
console.log(pronouns.formatMessage(template, { id: 'user1', displayName: 'Alice' }, 'en'));
// Output: Alice updated her profile picture.
console.log(pronouns.formatMessage(template, { id: 'user2', displayName: 'Bob' }, 'es'));
// Output: Bob actualizó su foto de perfil.
Gender-Neutral Language Patterns
// i18n/gender-neutral.js — Gender-neutral translation patterns
// Pattern 1: Use plural forms (they/them)
const neutralEn = new MessageFormat('en');
const msg1 = neutralEn.compile(
'{name} updated their profile picture.'
);
// Works for any gender — "their" is neutral
// Pattern 2: Rewrite to avoid pronouns
const msg2 = 'Profile picture updated by {name}.';
// No pronoun needed — passive voice
// Pattern 3: Use the user's name instead of pronoun
const msg3 = '{name} updated {name}\'s profile picture.';
// Repetitive but grammatically neutral
// Pattern 4: ICU select with a "neutral" option
const msg4 = neutralEn.compile(
'{name} {gender, select, ' +
'male {updated his} ' +
'female {updated her} ' +
'neutral {updated their} ' +
'other {updated their}} profile picture.'
);
console.log(msg4({ name: 'Alex', gender: 'neutral' }));
// Output: Alex updated their profile picture.
// Pattern 5: Formulation without gender reference
const msg5 = 'Profile picture update by {name}.';
// Nominal style — common in German and Japanese
Translation File Examples
// locales/en/common.json — English gender handling
{
"notification_like": "{name} {gender, select, male {liked his} female {liked her} other {liked their}} own post.",
"notification_follow": "{name} started following you!",
"notification_comment": "{name} commented on {target, select, male {his} female {her} other {their}} photo.",
"profile_title": "{name}'s Profile",
"profile_joined": "{name} {gender, select, male {joined} female {joined} other {joined}} in {year}"
}
// locales/de/common.json — German has 3 genders
{
"notification_like": "{name} gefallt {gender, select, male {sein} female {ihr} other {sein}} eigener Beitrag.",
"notification_follow": "{name} folgt Ihnen jetzt!",
"notification_comment": "{name} hat {target, select, male {sein} female {ihr} other {sein}} Foto kommentiert."
}
// locales/ja/common.json — Japanese has no grammatical gender
{
"notification_like": "{name}が自分の投稿にいいねしました。",
"notification_follow": "{name}があなたをフォローしました。",
"notification_comment": "{name}が写真にコメントしました。"
}
Common Mistakes
- Assuming English's simple he/she/they works for all languages. Spanish adjectives change endings (contento/contenta/contente). French past participles agree with gender (mis/mise). German articles change (der/die/das). Your ICU messages must account for these.
- Hardcoding binary gender options. Many users prefer non-binary or gender-neutral pronouns. Always provide a "neutral" or "other" option in ICU select patterns. Respect user pronoun preferences stored in their profile.
- Forgetting about verb conjugation. Gender affects more than just pronouns. In French, "il est alle" (he went) vs "elle est allee" (she went). The entire verb phrase may change.
- Using gender in translations where it's unnecessary. Rewrite sentences to avoid gender when possible. "Users who liked this" instead of "He/she liked this." This reduces translation complexity.
- Not testing with all pronoun options. If you support she/her, he/him, and they/them, test each one in every supported language. A bug in gender handling for "they/them" in Spanish can alienate users.
Practice Questions
- How does grammatical gender differ between English, Spanish, and Japanese?
- How does ICU MessageFormat's select handle gender-dependent translations?
- Why should you always include an "other" option in gender select patterns?
- How can you rewrite sentences to avoid gender references?
- How do you store and use user pronoun preferences in an application?
Challenge: Build a notification system that handles gender in English (he/she/they), Spanish (masculine/feminine/neutral adjective endings), and Japanese (no gender). Include 3 notification types (like, follow, comment), each with gender-dependent pronoun and verb forms. Store gender preference in user profile. Add a new pronoun option and show that only translation files need to change.
FAQ
Mini Project
Build a gender-aware notification system with 5 notification types, 3 supported locales (English, Spanish, German), ICU select patterns for gender, user pronoun preferences stored in a profile object, a configuration UI for users to select their pronouns, and a preview feature showing how each notification would appear with different pronoun options.
What's Next
You've mastered gender in translations. Next, learn about Date Formatting for locale-aware date and time display.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro