Unicornisaurous has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/308421

Change subject: Shorten clickable link text in HTML credit lines
......................................................................

Shorten clickable link text in HTML credit lines

Previously, the clickable text in the generated HTML credit lines
was the entire link to the article. This is shortened to a localized
version of "Link".

Bug: T119686
Change-Id: I708f65a85bfa26c264cdd06a265096027266240c
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M resources/mmv/mmv.EmbedFileFormatter.js
M tests/qunit/mmv/mmv.EmbedFileFormatter.test.js
5 files changed, 9 insertions(+), 6 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/21/308421/1

diff --git a/extension.json b/extension.json
index f4b1b20..0beefd2 100644
--- a/extension.json
+++ b/extension.json
@@ -232,7 +232,8 @@
                                "multimediaviewer-text-embed-credit-text-l",
                                "multimediaviewer-html-embed-credit-text-bl",
                                "multimediaviewer-html-embed-credit-text-b",
-                               "multimediaviewer-html-embed-credit-text-l"
+                               "multimediaviewer-html-embed-credit-text-l",
+                               "multimediaviewer-html-embed-credit-link-text"
                        ]
                },
                "mmv.ui.download.pane": {
diff --git a/i18n/en.json b/i18n/en.json
index 17fc6f2..e7d7ac5 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -96,6 +96,7 @@
        "multimediaviewer-html-embed-credit-text-bl": "By $1, $2, $3",
        "multimediaviewer-html-embed-credit-text-b": "By $1, $2",
        "multimediaviewer-html-embed-credit-text-l": "$1, $2",
+       "multimediaviewer-html-embed-credit-link-text": "Link",
        "multimediaviewer-embed-byline": "By $1",
        "multimediaviewer-embed-license": "Licensed under $1.",
        "multimediaviewer-embed-license-nonfree": "$1.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index dda5c8e..dc563f1 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -105,6 +105,7 @@
        "multimediaviewer-html-embed-credit-text-bl": "Credit text, used when 
generating HTML to reuse an image - used as a caption, not in the middle of a 
sentence.\n\nWhich one of the multimediaviewer-html-embed-credit-text-* 
messages is used will depend on what information about the image is 
available.\n\nParameters:\n* $1 - name of the author\n* $2 - copyright tag 
(usually a license)\n* $3 - URL to the image source\nEach of the parameters 
could be either plain text or a 
link.\n{{Related|Multimediaviewer-embed-credit-text}}",
        "multimediaviewer-html-embed-credit-text-b": "Credit text, used when 
generating HTML to reuse an image - used as a caption, not in the middle of a 
sentence.\n\nWhich one of the multimediaviewer-html-embed-credit-text-* 
messages is used will depend on what information about the image is 
available.\n\nParameters:\n* $1 - name of the author\n* $2 - URL to the image 
source\nEach of the parameters could be either plain text or a 
link.\n{{Related|Multimediaviewer-embed-credit-text}}",
        "multimediaviewer-html-embed-credit-text-l": "{{optional}}\nCredit 
text, used when generating HTML to reuse an image - used as a caption, not in 
the middle of a sentence.\n\nWhich one of the 
multimediaviewer-html-embed-credit-text-* messages is used will depend on what 
information about the image is available.\n\nParameters:\n* $1 - copyright tag 
(usually a license)\n* $2 - URL to the image source\nEach of the parameters 
could be either plain text or a 
link.\n{{Related|Multimediaviewer-embed-credit-text}}",
+  "multimediaviewer-html-embed-credit-link-text": "The clickable text of a 
link in a credit line, used when generating HTML to reuse an 
image.\n{{Related|Multimediaviewer-embed-credit-text}}",
        "multimediaviewer-embed-byline": "Byline (author credit) text, used 
when generating wikitext/HTML to reuse the image. $1 is author 
name.\n{{Identical|By}}",
        "multimediaviewer-embed-license": "License information, used when 
generating wikitext/HTML to reuse the image. $1 is the license name.",
        "multimediaviewer-embed-license-nonfree": "Like 
{{msg-mw|multimediaviewer-embed-license}}, but for non-free images (where $1 is 
typically not a license name but something like \"Fair use\").",
diff --git a/resources/mmv/mmv.EmbedFileFormatter.js 
b/resources/mmv/mmv.EmbedFileFormatter.js
index 0756238..e0cdc06 100644
--- a/resources/mmv/mmv.EmbedFileFormatter.js
+++ b/resources/mmv/mmv.EmbedFileFormatter.js
@@ -163,7 +163,7 @@
        EFFP.getCreditHtml = function ( info ) {
                var creditText, creditParams,
                        shortURL = info.imageInfo.descriptionShortUrl,
-                       shortLink = this.htmlUtils.makeLinkText( shortURL, { 
href: shortURL } ),
+                       shortLink = this.htmlUtils.makeLinkText( mw.message( 
'multimediaviewer-html-embed-credit-link-text' ), { href: shortURL } ),
                        license = info.imageInfo.license,
                        byline = this.getByline( info.imageInfo.author, 
info.imageInfo.source, info.imageInfo.attribution );
 
diff --git a/tests/qunit/mmv/mmv.EmbedFileFormatter.test.js 
b/tests/qunit/mmv/mmv.EmbedFileFormatter.test.js
index 6773312..0d78502 100644
--- a/tests/qunit/mmv/mmv.EmbedFileFormatter.test.js
+++ b/tests/qunit/mmv/mmv.EmbedFileFormatter.test.js
@@ -258,14 +258,14 @@
                        imageInfo: {
                                author: 'Author',
                                source: 'Source',
-                               descriptionShortUrl: 'link',
+                               descriptionShortUrl: 'some link',
                                title: {
                                        getNameText: function () { return 
'Image Title'; }
                                }
                        }
                } );
 
-               assert.strictEqual( html, 'By Author - Source, <a 
href="link">link</a>', 'Sanity check' );
+               assert.strictEqual( html, 'By Author - Source, <a href="some 
link">Link</a>', 'Sanity check' );
 
                html = formatter.getCreditHtml( {
                        repoInfo: {
@@ -276,7 +276,7 @@
                        imageInfo: {
                                author: 'Author',
                                source: 'Source',
-                               descriptionShortUrl: 'link',
+                               descriptionShortUrl: 'some link',
                                title: {
                                        getNameText: function () { return 
'Image Title'; }
                                },
@@ -288,6 +288,6 @@
                        }
                } );
 
-               assert.strictEqual( html, 'By Author - Source, <a 
href="http://www.wtfpl.net/";>WTFPL v2</a>, <a href="link">link</a>', 'Sanity 
check' );
+               assert.strictEqual( html, 'By Author - Source, <a 
href="http://www.wtfpl.net/";>WTFPL v2</a>, <a href="some link">Link</a>', 
'Sanity check' );
        } );
 }( mediaWiki ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/308421
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I708f65a85bfa26c264cdd06a265096027266240c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Unicornisaurous <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to