Lesson 3.3: Gender, Context & Select Syntax
Understand ICU select syntax and how to combine gender mechanics with plural logic.
1. Human Impact & Context
In English, most adjectives, verbs, and pronouns remain invariant regardless of who is speaking or who is being addressed:
"Alex sent you a message."
"You are online."
In many global languages, however, grammar demands strict gender agreement and contextual inflection:
French: "Alex vous a envoyé un message" (masculine) vs. "Alex vous a envoyée un message" (feminine).
Spanish: "Bienvenido" (welcome to a male user), "Bienvenida" (to a female user), or "Bienvenid@s" / "Bienvenides" (inclusive/neutral forms).
Hebrew / Arabic: Every verb and adjective shifts form based on both the speaker's gender and the recipient's gender.
When developers hardcode gender-blind strings or attempt to concatenate gender suffixes with string checks (e.g., welcomeMsg + (isFemale ? "a" : "o")), they break target grammar, create awkward UI glitches, and produce untranslatable code traps.
Localization engineers solve this using ICU select Syntax—allowing a single key to handle dynamic gender states, grammatical roles, and UI contexts cleanly across all target languages.
2. Core Mechanics & Technical Concepts
ICU select Syntax Structure
Similar to ICU plural blocks, ICU select matches discrete text choices against a runtime string variable (such as gender or user role):
{ variable_name, select,
value_1 { localized_text_1 }
value_2 { localized_text_2 }
other { default_fallback_text }
}English ICU Select Example
JSON
json{ "user_status": "{gender, select, female {She updated her profile.} male {He updated his profile.} other {They updated their profile.}}" }
Spanish ICU Select Example
JSON
json{ "welcome_user": "{gender, select, female {¡Bienvenida a la aplicación!} male {¡Bienvenido a la aplicación!} other {¡Te damos la bienvenida a la aplicación!}}" }
Crucial Rule: Just like ICU plurals, the
othercategory is strictly mandatory in every ICUselectblock as a fallback.
Combining select and plural (Nesting ICU Messages)
In complex application UIs or game dialogue, strings often depend on both a dynamic count and a dynamic gender/role. ICU MessageFormat allows you to nest select and plural blocks inside one another:
JSON
json{ "badge_notification": "{gender, select, female {{count, plural, =0 {Elle n'a aucun badge.} one {Elle a gagné # badge.} other {Elle a gagné # badges.}}} male {{count, plural, =0 {Il n'a aucun badge.} one {Il a gagné # badge.} other {Il a gagné # badges.}}} other {{count, plural, =0 {Personne n'a de badge.} one {1 badge a été gagné.} other {# badges ont été gagnés.}}}}" }
While nesting allows total grammatical precision, keeping nested structures clean requires strict brace balancing and visual formatting.
3. Real-World Industry Application
┌─────────────────────────────────────────┐
│ ICU Select Across L10n Pipelines │
└────────────────────┬────────────────────┘
│
┌─────────────────────────────────┼─────────────────────────────────┐
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Software UI │ │ Game UI │ │ Linear Media │
└───────┬───────┘ └───────┬───────┘ └───────┬───────┘
│ │ │
▼ ▼ ▼
User Profiles & Roles Character Class & Pronouns Dynamic Subtitle Overlays
Renders custom greetings and Adapts dialogue bubbles based Adjusts dynamic voiceover
role badges (Admin, Editor, on player character gender and and subtitle overlays for
Guest) per user settings. class selection. speaker identities.
Software UI: Social platforms use ICU
selectto handle user gender settings ("She shared a post") and account permissions ("Admin level access") without writing separate code branches for each language.Game Localization: RPG character creation screens use
selectblocks so NPC dialogue adapts dynamically to the player's chosen gender and class ("Greetings, brave hero / heroine!").Linear Media (Subtitling): Interactive video applications use
selectblocks inside WebVTT metadata to adjust subtitled honorifics and gendered forms during live branching narratives.
4. Cross-Platform Execution (Validating ICU Select in VS Code)
When authoring or inspecting ICU select messages in Visual Studio Code:
Verify State Values: Ensure the runtime keys used in the string (
female,male,nonbinary,admin) match backend code variables verbatim.Check Mandatory Fallback: Always ensure an
otherblock is present to prevent runtime rendering crashes if a gender/role value is missing or null.Audit Nested Layers: Use VS Code bracket pair colorization (
"editor.bracketPairColorization.enabled": true) to track nested{select ... {plural ... }}blocks.
5. Next Steps & Lab Practice
Now that you understand ICU select syntax and how to combine gender mechanics with plural logic, you are ready to put these concepts into practice.
Proceed to 🛠️ Hands-On Lab 3.3: Gender Logic & Nested ICU Patterns, or create a quick knowledge check!
Ready to move on?
Mark this lesson complete when you’re ready.