Kaldari has uploaded a new change for review.
https://gerrit.wikimedia.org/r/182994
Change subject: Add capability for a neutral gender option in preferences
......................................................................
Add capability for a neutral gender option in preferences
If a wiki wants to offer a neutral gender option, they can set
$wgNeutralGenderOption to true. This will add a fourth option to
the gender preference (unknown, male, female, and neutral). It will
also enable a fourth gender grammar for the {{GENDER}} magic word.
This may be useful for languages such as Swedish which accomodate
gender-neutral identification, as well as specialized 3rd party
wikis such as Gender Wiki (http://gender.wikia.com) where a
strcitly binary choice may not be appropriate.
Bug: T61643
Change-Id: I80208d4c0ec209ab0edc8d5e45cccdfebd73bb49
---
M RELEASE-NOTES-1.25
M includes/DefaultSettings.php
M includes/Preferences.php
M languages/Language.php
M languages/i18n/en.json
M languages/i18n/qqq.json
6 files changed, 21 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/94/182994/1
diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 8ca6ebf..bcfabd2 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -33,6 +33,8 @@
* (T46740) The temporary option $wgIncludejQueryMigrate was removed, along
with the jQuery Migrate library, as indicated when this option was provided
in
MediaWiki 1.24.
+* $wgNeutralGenderOption was added, allowing a neutral gender option in the
+ preferences. Default is false (option not available).
=== New features in 1.25 ===
* (T64861) Updated plural rules to CLDR 26. Includes incompatible changes
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 1884b5f..15b7511 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -4284,6 +4284,12 @@
);
/**
+ * Whether to provide a neutral gender option in the user preferences (in
addition to
+ * male, female, and unknown).
+ */
+$wgNeutralGenderOption = false;
+
+/**
* Settings added to this array will override the default globals for the user
* preferences used by anonymous visitors and newly created accounts.
* For instance, to disable editing on double clicks:
diff --git a/includes/Preferences.php b/includes/Preferences.php
index aca6dcb..35100ce 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -205,7 +205,7 @@
* @return void
*/
static function profilePreferences( $user, IContextSource $context,
&$defaultPreferences ) {
- global $wgAuth, $wgContLang, $wgParser;
+ global $wgAuth, $wgContLang, $wgParser, $wgNeutralGenderOption;
$config = $context->getConfig();
// retrieving user name for GENDER and misc.
@@ -347,6 +347,10 @@
'label-message' => 'yourgender',
'help-message' => 'prefs-help-gender',
);
+ if ( $wgNeutralGenderOption ) {
+ $genderNeutralLabel = $context->msg( 'gender-neutral'
)->text();
+
$defaultPreferences['gender']['options'][$genderNeutralLabel] = 'neutral';
+ }
// see if there are multiple language variants to choose from
if ( !$config->get( 'DisableLangConversion' ) ) {
diff --git a/languages/Language.php b/languages/Language.php
index d46845f..8c36363 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -3776,7 +3776,7 @@
}
/**
* Provides an alternative text depending on specified gender.
- * Usage {{gender:username|masculine|feminine|unknown}}.
+ * Usage {{gender:username|masculine|feminine|unknown|neutral}}.
* username is optional, in which case the gender of current user is
used,
* but only in (some) interface messages; otherwise default gender is
used.
*
@@ -3794,6 +3794,8 @@
* @return string
*/
function gender( $gender, $forms ) {
+ global $wgNeutralGenderOption;
+
if ( !count( $forms ) ) {
return '';
}
@@ -3804,6 +3806,9 @@
if ( $gender === 'female' ) {
return $forms[1];
}
+ if ( $wgNeutralGenderOption && $gender === 'neutral' && isset(
$forms[3] ) ) {
+ return $forms[3];
+ }
return isset( $forms[2] ) ? $forms[2] : $forms[0];
}
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 8712f44..1acb75c 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1001,6 +1001,7 @@
"gender-unknown": "I prefer not to say",
"gender-male": "He edits wiki pages",
"gender-female": "She edits wiki pages",
+ "gender-neutral": "They edit wiki pages",
"prefs-help-gender": "Setting this preference is optional.\nThe
software uses its value to address you and to mention you to others using the
appropriate grammatical gender.\nThis information will be public.",
"email": "Email",
"prefs-help-realname": "Real name is optional.\nIf provided, it may be
used to give you attribution for your work.",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 2b383ec..6dd933e 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -1165,6 +1165,7 @@
"gender-unknown": "Used in [[Special:Preferences]], first tab, as one
of the selectable options of the {{msg-mw|Yourgender}} prompt. Choosing it
indicates that the grammatical gender of the user name is not to be made
public, cannot be determined, or matches none of the other choices preset in
the select.\n\nThis may appropriately customized for your language. It should
sound like a reply to {{msg-mw|yourgender}}.",
"gender-male": "Used in [[Special:Preferences]], first tab, as one of
the selectable options of the {{msg-mw|Yourgender}} prompt.\nChoosing it
indicates that the grammatical gender of the user name should be \"male\" for
those languages having a \"normal\" male grammatical gender.\n\nYou have to
customize this example for your language if needed to have a sentence which
varies depending on the grammatical gender.\nThe wording must demonstrate the
actual usage of the option. It should sound like a reply to
{{msg-mw|Yourgender}}.\n\nFor example, if the verb \"I edit\" in your language
is different in masculine and feminine, translate \"I edit\" in masculine
here.\nIf your language does not make a distinction at all, use sentences like
\"he is male/a man\".",
"gender-female": "Used in [[Special:Preferences]], first tab, as one of
the selectable options of the {{msg-mw|Yourgender}} prompt.\nChoosing it
indicates that the grammatical gender of the user name should be \"female\" for
those languages having a \"normal\" female grammatical gender.\n\nYou have to
customize this example for your language if needed to have a sentence which
varies depending on the grammatical gender.\nThe wording must demonstrate the
actual usage of the option. It should sound like a reply to
{{msg-mw|Yourgender}}.\n\nFor example, if the verb \"I edit\" in your language
is different in masculine and feminine, translate \"I edit\" in feminine
here.\nIf your language does not make a distinction at all, use sentences like
\"she is female/woman\".",
+ "gender-neutral": "Used in [[Special:Preferences]], first tab, as one
of the selectable options of the {{msg-mw|Yourgender}} prompt.\nChoosing it
indicates that the grammatical gender of the user name should be \"neutral\" or
\"neuter\" for those languages having a neutral grammatical gender for
referring to a human.\n\nYou have to customize this example for your language
if needed to have a sentence which varies depending on the grammatical
gender.\nThe wording must demonstrate the actual usage of the option. It should
sound like a reply to {{msg-mw|Yourgender}}.\n\nFor example, if the phrase \"I
edit\" in your language has a unique form for a gender-neutral subject
(different than the masculine and feminine forms), translate \"I edit\" in
gender-neutral form here.\nIf your language does not make a distinction at all,
use sentences like \"They are gender-neutral\".",
"prefs-help-gender": "Used as additional description for
{{msg-mw|yourgender}} field in [[Special:Preferences]], section
{{msg-mw|prefs-i18n}}.",
"email": "{{Identical|E-mail}}",
"prefs-help-realname": "In user preferences.\n{{Identical|Real name
attribution}}",
--
To view, visit https://gerrit.wikimedia.org/r/182994
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I80208d4c0ec209ab0edc8d5e45cccdfebd73bb49
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits