RAN1 has uploaded a new change for review.
https://gerrit.wikimedia.org/r/69275
Change subject: Divide communitytwitter-access-error into sub-messages
......................................................................
Divide communitytwitter-access-error into sub-messages
The communitytwitter-access-error message is problematic. First of all, it
includes links encoded in
plain HTML, which is not desirable from a development standpoint since it mixes
raw code with messages.
It also makes the messages harder to translate. This is reflected in the fact
that only half of the 18
languages that CommunityTwitter has translations for have the
communitytwitter-access-error message
translated. The mixing of HTML code that should not be translated with messages
that should also obscures
the fact that the title of each link needs its own translation, a translation
that has been absent in
half of the remaining 9 languages that include the link for the link titles.
With a full translation
rate of 25%, the communitytwitter-access-error message has to be split up in a
way such that the HTML
does not obfuscate translation.
In this patchset, the message has been split into one large message and 4
smaller messages:
communitytwitter-access-error-loginlink,
communitytwitter-access-error-logintitle, communitytwitter-
access-error-rightslink, and communitytwitter-access-error-rightstitle. The two
messages for each link
are combined into a link in CommunityTwitter_body.php. The
communitytwitter-access-error takes the
two links, the loginLink and the rightsLink in that order, as parameters for
the message to be output
to the user. With the removal of HTML from the error message, this should make
for a much easier to
translate extension.
Notes regarding this patchset: I don’t like the idea of mixing up the messages
when we’ve got the
extension up on TranslateWiki already. It’s not good having to retranslate some
of this too. On the
other hand, it’s better than leaving the HTML in there and making translation
harder.
Change-Id: I4fc3f17879b30bd5bc36b64e317ec56c9ab24ec2
---
M CommunityTwitter.i18n.php
M CommunityTwitter_body.php
2 files changed, 27 insertions(+), 4 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CommunityTwitter
refs/changes/75/69275/1
diff --git a/CommunityTwitter.i18n.php b/CommunityTwitter.i18n.php
index 622c0ac..95fb308 100755
--- a/CommunityTwitter.i18n.php
+++ b/CommunityTwitter.i18n.php
@@ -62,9 +62,11 @@
'communitytwitter-no-last-tweets' => 'No tweets available',
'communitytwitter-description-template' => 'CommunityTwitter
description',
'communitytwitter-advice-template' => 'CommunityTwitter advice',
- 'communitytwitter-access-error' => "You have to be <span
class=\"plainlinks\"><a href=\"/wiki/Special:UserLogin\" class=\"external
text\" title=\"log in\" rel=\"nofollow\">logged in</a></span> and \n".
-
"<span class=\"plainlinks\"><a
href=\"/wiki/Special:ListGroupRights\" class=\"external text\" title=\"See
group rights\" \n".
-
"rel=\"nofollow\">allowed</a></span> to access
this page.",
+ 'communitytwitter-access-error' => 'You have to be $1 and $2 to access
this page.',
+ 'communitytwitter-access-error-loginlink' => 'logged in',
+ 'communitytwitter-access-error-logintitle' => 'Log in',
+ 'communitytwitter-access-error-rightslink' => 'allowed',
+ 'communitytwitter-access-error-rightstitle' => 'See group rights',
'communitytwitter-userlinks-name' => 'Twitter',
'right-twitter' => 'Use Twitter special page',
);
diff --git a/CommunityTwitter_body.php b/CommunityTwitter_body.php
index fbdb310..3346c61 100755
--- a/CommunityTwitter_body.php
+++ b/CommunityTwitter_body.php
@@ -236,7 +236,28 @@
}
} else {
// Not logged in or no adequate group status
-
$wgOut->addHTML(wfMsg("communitytwitter-access-error")."\n");
+
+ $loginLink = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'UserLogin' ),
+ $this->msg(
'communitytwitter-access-error-loginlink' )->escaped(),
+ array(
+ 'title' => $this->msg(
'communitytwitter-access-error-logintitle' )->escaped()
+ ),
+ // FIXME: If Special page name is localized,
the returnto query string will have to be set to the relevant MediaWiki message.
+ array(
+ 'returnto' => "Special:Community
Twitter"
+ )
+ );
+ $rightsLink = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'ListGroupRights' ),
+ $this->msg(
'communitytwitter-access-error-rightslink' )->escaped(),
+ array(
+ 'title' => $this->msg(
'communitytwitter-access-error-rightstitle' )->escaped()
+ ),
+ array()
+ );
+
+ $wgOut->addHTML( $this->msg(
'communitytwitter-access-error', $loginLink, $rightsLink )->plain() );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/69275
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4fc3f17879b30bd5bc36b64e317ec56c9ab24ec2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CommunityTwitter
Gerrit-Branch: master
Gerrit-Owner: RAN1 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits