Bsitu has uploaded a new change for review.
https://gerrit.wikimedia.org/r/80162
Change subject: Add gender support to two i18n messages
......................................................................
Add gender support to two i18n messages
* thanks-thank-tooltip
* logentry-thanks-thank
Change-Id: Ib5e17695dda7db5b07db51bb20579d23f88666e5
---
M Thanks.hooks.php
M Thanks.i18n.php
M ThanksLogFormatter.php
3 files changed, 14 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks
refs/changes/62/80162/1
diff --git a/Thanks.hooks.php b/Thanks.hooks.php
index 055acfa..0733cbc 100644
--- a/Thanks.hooks.php
+++ b/Thanks.hooks.php
@@ -34,7 +34,7 @@
$recipientAllowed = !in_array( 'bot',
$recipient->getGroups() );
}
if ( $recipientAllowed && !$recipient->isAnon() ) {
- $links[] = self::generateThankElement( $rev );
+ $links[] = self::generateThankElement( $rev,
$recipient );
}
}
return true;
@@ -44,8 +44,9 @@
* Helper for self::insertThankLink
* Creates either a thank link or thanked span based on users session
* @param $rev Revision object to generate the thank element for
+ * @param $recipient User the user who receives thanks notification
*/
- protected static function generateThankElement( $rev ) {
+ protected static function generateThankElement( $rev, $recipient ) {
global $wgUser;
// User has already thanked for revision
if ( $wgUser->getRequest()->getSessionData(
"thanks-thanked-{$rev->getId()}" ) ) {
@@ -57,7 +58,9 @@
}
// Add 'thank' link
- $tooltip = wfMessage( 'thanks-thank-tooltip' )->text();
+ $tooltip = wfMessage( 'thanks-thank-tooltip' )
+ ->params( $wgUser->getName(),
$recipient->getName() )
+ ->text();
return Html::element(
'a',
diff --git a/Thanks.i18n.php b/Thanks.i18n.php
index 5e17890..5690118 100644
--- a/Thanks.i18n.php
+++ b/Thanks.i18n.php
@@ -17,7 +17,7 @@
'thanks-error-undefined' => 'Thank action failed. Please try again.',
'thanks-error-invalidrevision' => 'Revision ID is not valid.',
'thanks-error-ratelimited' => "You've exceeded your rate limit. Please
wait some time and try again.",
- 'thanks-thank-tooltip' => 'Send a thank you notification to this user',
+ 'thanks-thank-tooltip' => '{{GENDER:$1|Send}} a thank you notification
to this {{GENDER:$2|user}}',
'thanks-confirmation' => 'Are you sure you want to {{GENDER:$1|thank}}
$2 for this edit?',
'echo-pref-subscription-edit-thank' => 'Thanks me for my edit',
'echo-pref-tooltip-edit-thank' => 'Notify me when someone thanks me for
an edit I made.',
@@ -30,7 +30,7 @@
'notification-link-text-respond-to-user' => 'Respond to user',
'log-name-thanks' => 'Thanks log',
'log-description-thanks' => 'Below is a list of users thanked by other
users.',
- 'logentry-thanks-thank' => '$1 {{GENDER:$2|thanked}} $3',
+ 'logentry-thanks-thank' => '$1 {{GENDER:$2|thanked}} {{GENDER:$4|$3}}',
);
/** Message documentation (Message documentation)
@@ -51,7 +51,9 @@
{{Identical|Please try again}}',
'thanks-error-invalidrevision' => 'Error message that is displayed when
the revision ID is not valid',
'thanks-error-ratelimited' => 'Error message that is displayed when
user exceeds rate limit',
- 'thanks-thank-tooltip' => 'Tooltip that appears when a user hovers over
the "thank" link',
+ 'thanks-thank-tooltip' => 'Tooltip that appears when a user hovers over
the "thank" link. Parameters
+* $1 - The user sending the thanks. Can be used for GENDER support.
+* $2 - The user receiving the thanks. Can be used for GENDER support',
'thanks-confirmation' => 'A confirmation message to make sure the user
actually wants to send thanks to another user.
Parameters:
@@ -85,7 +87,8 @@
'logentry-thanks-thank' => 'Log entry that is created when a user
thanks another user for an edit. Parameters:
* $1 is a user link, for example "Jane Doe (Talk | contribs)"
* $2 is a username. Can be used for GENDER.
-* $3 is a user link, for example "John Doe (Talk | contribs)',
+* $3 is a user link, for example "John Doe (Talk | contribs)
+* $4 is the username of the recipient. Can be used for GENDER.',
);
/** Arabic (العربية)
diff --git a/ThanksLogFormatter.php b/ThanksLogFormatter.php
index b55c2b2..17d6b12 100644
--- a/ThanksLogFormatter.php
+++ b/ThanksLogFormatter.php
@@ -9,6 +9,7 @@
// actually a user, not a page.
$recipient = User::newFromName(
$this->entry->getTarget()->getText(), false );
$params[2] = Message::rawParam( $this->makeUserLink( $recipient
) );
+ $params[3] = $recipient->getName();
return $params;
}
--
To view, visit https://gerrit.wikimedia.org/r/80162
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5e17695dda7db5b07db51bb20579d23f88666e5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits