Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions demo-app/src/example/Example.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ export default class Example extends React.Component<Props, State> {
<option value={GenderConst.UNKNOWN_SINGULAR}>
<fbt desc="Gender Select label">Unknown (singular)</fbt>
</option>
<option value={GenderConst.MALE_SINGULAR}>
<fbt desc="Gender Select label">Male (singular)</fbt>
<option value={GenderConst.MALE}>
<fbt desc="Gender Select label">Male</fbt>
</option>
<option value={GenderConst.FEMALE_SINGULAR}>
<fbt desc="Gender Select label">Female (singular)</fbt>
<option value={GenderConst.FEMALE}>
<fbt desc="Gender Select label">Female</fbt>
</option>
</select>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ exports[`Example.react renders the example 1`] = `
onChange={[Function]}
>
<option
value={11}
value={2}
>
Gender:
</option>
Expand All @@ -220,24 +220,24 @@ exports[`Example.react renders the example 1`] = `
Not a person
</option>
<option
value={11}
value={2}
>
Unknown (Plural)
</option>
<option
value={7}
value={1}
>
Unknown (singular)
</option>
<option
value={2}
value={3}
>
Male (singular)
Male
</option>
<option
value={1}
value={4}
>
Female (singular)
Female
</option>
</select>
</span>
Expand Down
30 changes: 8 additions & 22 deletions docs/pronouns.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,10 @@ const PRONOUN_USAGE = {

const GenderConst = {
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
UNKNOWN_SINGULAR: 1
UNKNOWN_PLURAL: 2
FEMALE: 3
MALE: 4
}
```

Expand Down Expand Up @@ -85,14 +78,7 @@ Below is the table of possible values for their various types.
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
1 UNKNOWN_SINGULAR they their themself them
2 UNKNOWN_PLURAL they their themselves them
3 FEMALE she her herself her
4 MALE he his himself him
2 changes: 1 addition & 1 deletion packages/babel-plugin-fbt/FbtMethodCallVisitors.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const call = function(moduleName) {
// - enum string usage
// e.g. 'object', 'possessive', 'reflexive', 'subject'
// - enum int gender
// e.g. GenderConst.MALE_SINGULAR, FEMALE_SINGULAR, etc.
// e.g. GenderConst.MALE, FEMALE, etc.

this.hasTable = true;

Expand Down
145 changes: 16 additions & 129 deletions packages/babel-plugin-fbt/Gender.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,10 @@ export type GenderConstEnum = $GenderConstEnum;
// TODO(T70508769) Figure out a way to keep this in sync more transparently
const GENDER_CONST = Object.freeze({
NOT_A_PERSON: ((0 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
FEMALE_SINGULAR: ((1 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
MALE_SINGULAR: ((2 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
FEMALE_SINGULAR_GUESS: ((3 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
MALE_SINGULAR_GUESS: ((4 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
// 5 seems to indicate a group of people who may be of mixed gender
MIXED_UNKNOWN: ((5 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
NEUTER_SINGULAR: ((6 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
UNKNOWN_SINGULAR: ((7 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
FEMALE_PLURAL: ((8 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
MALE_PLURAL: ((9 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
NEUTER_PLURAL: ((10 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
UNKNOWN_PLURAL: ((11 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
UNKNOWN_SINGULAR: ((1 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
UNKNOWN_PLURAL: ((2 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
FEMALE: ((3 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
MALE: ((4 /*: $FlowExpectedError*/ ) /*: GenderConstEnum*/),
});

const data /*: {[GenderConstEnum]: GenderConfig} */ = {
Expand Down Expand Up @@ -78,28 +70,28 @@ const data /*: {[GenderConstEnum]: GenderConfig} */ = {
string: 'unknown singular',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.FEMALE_SINGULAR]: {
[GENDER_CONST.UNKNOWN_PLURAL]: {
is_male: false,
is_female: true,
is_female: false,
is_neuter: false,
is_plural: false,
is_plural: true,
is_mixed: false,
is_guess: false,
is_unknown: false,
subject: 'she',
possessive: 'her',
reflexive: 'herself',
object: 'her',
string: 'female singular',
is_unknown: true,
subject: 'they',
possessive: 'their',
reflexive: 'themselves',
object: 'them',
string: 'unknown plural',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.FEMALE_SINGULAR_GUESS]: {
[GENDER_CONST.FEMALE]: {
is_male: false,
is_female: true,
is_neuter: false,
is_plural: false,
is_mixed: false,
is_guess: true,
is_guess: false,
is_unknown: false,
subject: 'she',
possessive: 'her',
Expand All @@ -108,7 +100,7 @@ const data /*: {[GenderConstEnum]: GenderConfig} */ = {
string: 'female singular',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.MALE_SINGULAR]: {
[GENDER_CONST.MALE]: {
is_male: true,
is_female: false,
is_neuter: false,
Expand All @@ -122,111 +114,6 @@ const data /*: {[GenderConstEnum]: GenderConfig} */ = {
object: 'him',
string: 'male singular',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.MALE_SINGULAR_GUESS]: {
is_male: true,
is_female: false,
is_neuter: false,
is_plural: false,
is_mixed: false,
is_guess: true,
is_unknown: false,
subject: 'he',
possessive: 'his',
reflexive: 'himself',
object: 'him',
string: 'male singular',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.NEUTER_SINGULAR]: {
is_male: false,
is_female: false,
is_neuter: true,
is_plural: false,
is_mixed: false,
is_guess: false,
is_unknown: false,
subject: 'they',
possessive: 'their',
reflexive: 'themself',
object: 'them',
string: 'neuter singular',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.MIXED_UNKNOWN]: {
is_male: false,
is_female: false,
is_neuter: false,
is_plural: true,
is_mixed: true,
is_guess: false,
is_unknown: false,
subject: 'they',
possessive: 'their',
reflexive: 'themselves',
object: 'them',
string: 'mixed plural',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.FEMALE_PLURAL]: {
is_male: false,
is_female: true,
is_neuter: false,
is_plural: true,
is_mixed: false,
is_guess: false,
is_unknown: false,
subject: 'they',
possessive: 'their',
reflexive: 'themselves',
object: 'them',
string: 'female plural',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.MALE_PLURAL]: {
is_male: true,
is_female: false,
is_neuter: false,
is_plural: true,
is_mixed: false,
is_guess: false,
is_unknown: false,
subject: 'they',
possessive: 'their',
reflexive: 'themselves',
object: 'them',
string: 'male plural',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.NEUTER_PLURAL]: {
is_male: false,
is_female: false,
is_neuter: true,
is_plural: true,
is_mixed: false,
is_guess: false,
is_unknown: false,
subject: 'they',
possessive: 'their',
reflexive: 'themselves',
object: 'them',
string: 'neuter plural',
},
// $FlowExpectedError[invalid-computed-prop] Tolerate using an opaque type as an object key
[GENDER_CONST.UNKNOWN_PLURAL]: {
is_male: false,
is_female: false,
is_neuter: false,
is_plural: true,
is_mixed: false,
is_guess: false,
is_unknown: true,
subject: 'they',
possessive: 'their',
reflexive: 'themselves',
object: 'them',
string: 'unknown plural',
},
};

function getData(
Expand Down
15 changes: 4 additions & 11 deletions packages/babel-plugin-fbt/JSFbtBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,15 @@ class JSFbtBuilder {
? GENDER_CONST.NOT_A_PERSON
: GENDER_CONST.UNKNOWN_PLURAL;

case GENDER_CONST.FEMALE_SINGULAR:
case GENDER_CONST.FEMALE_SINGULAR_GUESS:
return GENDER_CONST.FEMALE_SINGULAR;
case GENDER_CONST.FEMALE:
return GENDER_CONST.FEMALE;

case GENDER_CONST.MALE_SINGULAR:
case GENDER_CONST.MALE_SINGULAR_GUESS:
return GENDER_CONST.MALE_SINGULAR;
case GENDER_CONST.MALE:
return GENDER_CONST.MALE;

case GENDER_CONST.MIXED_UNKNOWN:
case GENDER_CONST.FEMALE_PLURAL:
case GENDER_CONST.MALE_PLURAL:
case GENDER_CONST.NEUTER_PLURAL:
case GENDER_CONST.UNKNOWN_PLURAL:
return GENDER_CONST.UNKNOWN_PLURAL;

case GENDER_CONST.NEUTER_SINGULAR:
case GENDER_CONST.UNKNOWN_SINGULAR:
return usage === 'reflexive'
? GENDER_CONST.NOT_A_PERSON
Expand Down
Loading