WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 9 months ago

#42900 new enhancement

Add gender field to user profile for use in translations

Reported by: yoavf Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch has-unit-tests
Focuses: Cc:
PR Number:

Description

See #42725 for more background.

What this solves
To be able to properly translate numerous terms across the WP codebase, translators to some languages require knowledge of the gender of the user being referenced in the string.
Adding an optional field to the user profile will enable the extension of WP's translation functions to support gender variations (see #42725)

What's included

  • A new user profile field, and a matching get_user_gender()
  • Unit tests for get_user_gender()

Gender/Pronouns - How the field was named
The word gender has a lot of connotations - but it's used here in the grammatical sense - see Grammatical Gender on Wikipedia.
When presented to the user, we ask what their preferred pronoun is, since that's probably the easiest way to relate to it. The wording around the field was inspired by Wikipedia's gender user profile field.

Screenshot
https://cldup.com/LAj-feF0TI.png

Attachments (2)

gender-to-user-profile.diff (5.6 KB) - added by yoavf 22 months ago.
User profile gender field, and get_user_gender()
get_user_gender-unit-tests.diff (3.5 KB) - added by yoavf 22 months ago.
Unit tests for get_user_gender()

Download all attachments as: .zip

Change History (9)

@yoavf
22 months ago

User profile gender field, and get_user_gender()

@yoavf
22 months ago

Unit tests for get_user_gender()

#1 follow-up: @danieltj
22 months ago

Personally, I think it would be less confusing to have a Gender select box with he, she and other rather than radio button and explaining it as much as it currently is.

I do like the idea though, +1.

Perhaps it would be better to, instead of having get_user_gender as a function to return he, she or they, instead have a new translation function called _g where it accepts a placeholder to be returned as he, she or they, or even his, her, their. I think that'd be a much more elegant solution.

I'll see if I can whip up a patch to explain further.

#2 in reply to: ↑ 1 @yoavf
22 months ago

Replying to danieltj:

Perhaps it would be better to, instead of having get_user_gender as a function to return he, she or they, instead have a new translation function called _g where it accepts a placeholder to be returned as he, she or they, or even his, her, their. I think that'd be a much more elegant solution.

This is only a part of the soultion. Make sure you take a look at #42725 for the full plan

#3 @danieltj
22 months ago

Thanks - I think my patch would be better suited in the other ticket then.

#4 @casiepa
22 months ago

About Other/Unknown:
I'm okay with the 'Other', but the 'Unknown' seems a bit strange to me.
Can we in that same button (or choice) also add 'I prefer not to disclose' somehow?

#5 follow-up: @joostdevalk
22 months ago

I'm very opposed to having this in core by default and would suggest this could and should be plugin territory. Gender is not a necessary thing to know when creating an account. Given the privacy legislation like the GDPR I would urge us to go for privacy by design.

#6 in reply to: ↑ 5 @johnbillion
22 months ago

Replying to joostdevalk:
Thanks for the feedback, Joost. The proposal is to make this an optional field that allows users to specify their preferred pronoun in order to fix grammatically incorrect translations that exist currently for many gendered phrases. This is particularly important for female users in many languages which default to using the male form of phrases such as user role names, and basically any phrase which references the user. (Aside: There are significantly more gendered phrases than I thought there would be. At WCUS we identified at least eight on the dashboard screen alone.)

The gender field won't be required when creating or editing a user account.

Can you expand on your privacy concerns? Legislation such as the GDPR doesn't dictate what data should or shouldn't be collected, only how it's protected and made manageable by the user. These points apply regardless of whether or not a user gender field is introduced.

#7 @pento
9 months ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.