WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 2 years ago

#36617 closed feature request (duplicate)

String gendering functions

Reported by: bastho Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: I18N Keywords:
Focuses: Cc:

Description

It's maybe nonsense in English, but many languages do have different strings for male or female subjects/objects.

So it would be very nice to implement core helper functions that give a common pipe for "gendering": norm, hooks...

Here is my dream:

<?php
_g('Are you happy?', 'Are you happy?', $gender, 'textdomain');

which will return in French:
$gender='male'

Êtes vous heureux ?

$gender='female'

Êtes vous heureuse ?

The most important difficulty is the behavior in polyglot or poedit, the function should then call native functions, especially _x because strings will be almost identical in English.

Here is an example of what it could look like:

<?php
_g(_x('Are you happy?', 'male', 'textdomain'),  _x('Are you happy?', 'female', 'textdomain'), $gender);

Some points has to be also defined:

  • A norm has to be defined for $gender values
  • Plural has to be managed to
  • echo functions has to be implemented to

Change History (12)

#1 @swissspidy
4 years ago

  • Version trunk deleted

To know the user's gender we would need to have a profile field for that. Since there's more to gender than just male and female, discussions would begin about how to do this.

Citing Helen's comment on #18003:

Whatever your own take is on gender labels and identification, I don't think that it's a good idea for WP to do something like add this to your .org profile, and the minefield this would put us in far outweighs whatever small benefit might be derived from having gendered labels. Also, assuming that people would be able to opt-out since that would be a proper option to have, languages would still have to come up with some kind of neutral term.

For WordPress, sticking to neutral language is probably easiest.

#2 follow-up: @grapplerulrich
4 years ago

If the language is English then it does not make sense to define a string a masculine or feminine. If you are thinking about the translations we could have a separate translation for masculine or feminine like we do for formale and informale forms.

It would be interesting to see how other software and programming languages handle this.

The next question for me would be how would you decide when to display the masculine or feminine form of the translation. This information would need to be defined in the user data and a solution would need to be thought for anonymous visitors to the site.

WordPress has in the past solved this by removing the gendered pronouns e.g. He or she with they [26368]

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

#3 follow-up: @bastho
4 years ago

I agree, the beauty of fully gendered sentences is very subjective

Neutral language vs Gendered language question is larger than just user's gender.

Abstract objects also have a gender (at least in Latin languages), so it would be useful for custom post types or custom taxonomies.
The problem of this point of view is: do all gendered languages use the same gender for words?
ex: is a page "female" in all gendered languages ?

@swissspidy easiest is not always the best ;) anyway, my grandma used to say "better is enemy of well"

@grapplerulrich l20n's approach seems too much complicated but we can pick some parts http://l20n.org/learn/making-translations-depend-on-external-variables/

#4 follow-up: @grapplerulrich
4 years ago

@bastho Do you have a real life example where you need this?

#6 in reply to: ↑ 4 @bastho
4 years ago

Replying to grapplerulrich:

@bastho Do you have a real life example where you need this?

Actually not so much, because translators adapt their strings, but with this feature, translated strings could be more "natural" and finally improve the user's experience.

#7 in reply to: ↑ 3 ; follow-up: @thomaswm
4 years ago

Replying to bastho:

Abstract objects also have a gender (at least in Latin languages), so it would be useful for custom post types or custom taxonomies.
The problem of this point of view is: do all gendered languages use the same gender for words?

No, they don't. For instance, the word "cat" is female in German (eine Katze), but male in French (un chat).

Also, German has three genders instead of two. Abstract objects can be either male, female or neutral.

#8 in reply to: ↑ 7 @bastho
4 years ago

Regarding thomaswm's comment:

No, they don't. For instance, the word "cat" is female in German (eine Katze), but male in French (un chat).
Also, German has three genders instead of two. Abstract objects can be either male, female or neutral.

It is more rational to focus on user's gender since objects can have there specific strings.

Contrary to #18003 which concerns contributors (which only interests developers), user's gender concerns the large population of WordPress end users. As accessibility and localization, this is an important vector for a better user experience.

Should we first try in a plugin ?

#9 @dd32
4 years ago

  • Keywords close added

Although I fully understand that in some languages, genderised strings are a required part of their historical language, this just isn't something WordPress is going to natively support, and I would strongly encourage anyone who needs such a function to look at the language is used today and find a common neutral wording which is acceptable to all that speak the language, regardless of how they (or how they don't) identify their own gender.

A plugin is free to add such functionality into their plugin if they deem it necessary, as on a technical level it's already possible without any core change.

This ticket was mentioned in Slack in #core-i18n by swissspidy. View the logs.


4 years ago

#11 @swissspidy
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

#12 @swissspidy
2 years ago

  • Keywords close removed
  • Resolution changed from wontfix to duplicate

Duplicate of #42725.

Note: See TracTickets for help on using tickets.