[wp-trac] [WordPress Trac] #36617: String gendering functions

WordPress Trac noreply at wordpress.org
Thu Apr 21 10:48:12 UTC 2016


#36617: String gendering functions
-----------------------------+-----------------------------
 Reporter:  bastho           |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  I18N             |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 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
 <?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
 <?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

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36617>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list