Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -277,8 +277,15 @@ |
278 | 278 | */ |
279 | 279 | static function gender( $parser, $username ) { |
280 | 280 | wfProfileIn( __METHOD__ ); |
281 | | - $forms = array_slice( func_get_args(), 2); |
| 281 | + $forms = array_slice( func_get_args(), 2 ); |
282 | 282 | |
| 283 | + // Some shortcuts to avoid loading user data unnecessarily |
| 284 | + if ( count( $forms ) === 0 ) { |
| 285 | + return ''; |
| 286 | + } elseif ( count( $forms ) === 1 ) { |
| 287 | + return $forms[0]; |
| 288 | + } |
| 289 | + |
283 | 290 | $username = trim( $username ); |
284 | 291 | |
285 | 292 | // default |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -3169,9 +3169,15 @@ |
3170 | 3170 | * Usage {{gender:username|masculine|feminine|neutral}}. |
3171 | 3171 | * username is optional, in which case the gender of current user is used, |
3172 | 3172 | * but only in (some) interface messages; otherwise default gender is used. |
3173 | | - * If second or third parameter are not specified, masculine is used. |
3174 | | - * These details may be overriden per language. |
3175 | 3173 | * |
| 3174 | + * If no forms are given, an empty string is returned. If only one form is |
| 3175 | + * given, it will be returned unconditionally. These details are implied by |
| 3176 | + * the caller and cannot be overridden in subclasses. |
| 3177 | + * |
| 3178 | + * If more than one form is given, the default is to use the neutral one |
| 3179 | + * if it is specified, and to use the masculine one otherwise. These |
| 3180 | + * details can be overridden in subclasses. |
| 3181 | + * |
3176 | 3182 | * @param $gender string |
3177 | 3183 | * @param $forms array |
3178 | 3184 | * |