Skip to main content
Version: 5.x

Pronouns

fbt:pronoun and fbt::pronoun both take a required usage (FbtConstants::VALID_PRONOUN_USAGES) and a Gender::GENDER_CONST enum:

class FbtConstants
{
const VALID_PRONOUN_USAGES = [
"object" => 0,
"possessive" => 1,
"reflexive" => 2,
"subject" => 3,
];
}

class Gender
{
const GENDER_CONST = [
'NOT_A_PERSON' => 0,
'FEMALE_SINGULAR' => 1,
'MALE_SINGULAR' => 2,
'FEMALE_SINGULAR_GUESS' => 3,
'MALE_SINGULAR_GUESS' => 4,
'MIXED_UNKNOWN' => 5,
'NEUTER_SINGULAR' => 6,
'UNKNOWN_SINGULAR' => 7,
'FEMALE_PLURAL' => 8,
'MALE_PLURAL' => 9,
'NEUTER_PLURAL' => 10,
'UNKNOWN_PLURAL' => 11,
];
}

⚠️ NOTE: This is not the same gender as used in fbt:param, fbt:name, or subject! The IntlVariations used in those cases only has GENDER_MALE, GENDER_FEMALE, and GENDER_UNKNOWN.

Pronoun example:​

<fbt desc="pronoun example">
<fbt:param name="name">{{ $ent->getName() }}</fbt:param>
shared
<fbt:pronoun type="possessive" gender="{{ $ent->getPronounGender() }}" />
photo with you.
</fbt>

Optional attributes​

  • capitalize bool: Whether to capitalize the pronoun in the source string.
  • human bool: Whether to elide the NOT_A_PERSON option in the text variations generated.
  • key string: Pronouns with the same key share the same gender, so that only the consistent combinations of their variations are generated for translation (Facebook's fbt detects that the same variable is used).

The example above generates:

{
"hashToLeaf": {
"JYTtgHGMpBOM2Vrc9JLeUw==": {"text": "{name} shared their photo with you.", "desc": "pronoun example"},
"I/p+TWpGhrtv9gnABybPMw==": {"text": "{name} shared her photo with you.", "desc": "pronoun example"},
"3Yb/zNhF8nZ8aR+NSPaeJQ==": {"text": "{name} shared his photo with you.", "desc": "pronoun example"}
},
"project": "website app",
"jsfbt": {
"t": {
"1": {"desc": "pronoun example", "text": "{name} shared her photo with you."},
"2": {"desc": "pronoun example", "text": "{name} shared his photo with you."},
"*": {"desc": "pronoun example", "text": "{name} shared their photo with you."}
},
"m": [null]
}
}

Combinations​

Conceptually, pronouns work as though there was an enum supplied for the given type. Below is the table of possible values for their various types. Note how reflexive and object have 4 types

subject: he/she/they
possessive: his/her/their
reflexive: himself/herself/themselves/themself
object: him/her/them/this

V Name Subject Possessive Reflexive Object
=============================================================
0 NOT_A_PERSON they their themself this
1 FEMALE_SINGULAR she her herself her
2 MALE_SINGULAR he his himself him
3 FEMALE_SINGULAR_GUESS she her herself her
4 MALE_SINGULAR_GUESS he his himself him
5 MIXED_UNKNOWN they their themselves them
6 NEUTER_SINGULAR they their themself them
7 UNKNOWN_SINGULAR they their themself them
8 FEMALE_PLURAL they their themselves them
9 MALE_PLURAL they their themselves them
10 NEUTER_PLURAL they their themselves them
11 UNKNOWN_PLURAL they their themselves them