Gergő Tisza has uploaded a new change for review.

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

Change subject: Make "and X more" message more flexible for translators
......................................................................

Make "and X more" message more flexible for translators

Also make sure part of it is not a link to avoid two links
ending up next to each other + fix a small documentation bug.

Bug: T76465
Change-Id: I128ec7034b0bb9784fb78d1a5ce90d195555848e
---
M MultimediaViewer.php
M i18n/en.json
M i18n/qqq.json
M resources/mmv/mmv.HtmlUtils.js
M resources/mmv/ui/mmv.ui.metadataPanel.js
5 files changed, 12 insertions(+), 7 deletions(-)


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

diff --git a/MultimediaViewer.php b/MultimediaViewer.php
index f69e4ae..f15ca8e 100644
--- a/MultimediaViewer.php
+++ b/MultimediaViewer.php
@@ -585,6 +585,7 @@
                        'multimediaviewer-credit',
                        'multimediaviewer-credit-fallback',
                        'multimediaviewer-multiple-authors',
+                       'multimediaviewer-multiple-authors-combine',
 
                        'multimediaviewer-userpage-link',
 
diff --git a/i18n/en.json b/i18n/en.json
index 74d3c4e..9dfd345 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -15,7 +15,8 @@
        "multimediaviewer-userpage-link": "{{GENDER:$2|Uploaded}} by $1",
        "multimediaviewer-credit": "$1 - $2",
        "multimediaviewer-credit-fallback": "View author information",
-       "multimediaviewer-multiple-authors": "and {{PLURAL:$1|one more 
author|$1 more authors}}",
+       "multimediaviewer-multiple-authors": "{{PLURAL:$1|one more author|$1 
more authors}}",
+       "multimediaviewer-multiple-authors-combine": "$1 and $2",
        "multimediaviewer-metadata-error": "Error: Could not load image data. 
$1",
        "multimediaviewer-thumbnail-error": "Error: Could not load thumbnail 
data. $1",
        "multimediaviewer-license-cc-by-1.0": "CC BY 1.0",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 172e8cf..3bc72e2 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -22,6 +22,7 @@
        "multimediaviewer-credit": "Credit line for images. Parameters:\n* $1 - 
HTML describing the author\n* $2 - HTML describing the source\n\nNeither 
parameters are usernames, so GENDER is useless. Both come directly from the 
API, the extended metadata imageinfo prop in particular.\n\nThey will usually 
be derived from the HTML output from wikitext on a file description page - 
however, no complicated HTML, only links, will be allowed.\n\nSee also 
{{msg-mw|multimediaviewer-credit-fallback}}",
        "multimediaviewer-credit-fallback": "Text shown in place of the credit 
line ({{msg-mw|multimediaviewer-credit}}) when neither author nor source 
information is available.",
        "multimediaviewer-multiple-authors": "Text shown after the author name 
when there are multiple authors. The text will link to the file description 
page.\n* $1 - number of additional authors.",
+       "multimediaviewer-multiple-authors-combine": "Combines the author name 
and the message about other authors.\n* $1 - author name, parsed from the file 
page\n* $2 - {{msg-mw|multimediaviewer-multiple-authors}} wrapped in a link.",
        "multimediaviewer-metadata-error": "Text shown when the information on 
the metadata panel could not be loaded.\n\nParameters:\n* $1 - the error 
message (not localized)\nSee also:\n* 
{{msg-mw|Multimediaviewer-thumbnail-error}}",
        "multimediaviewer-thumbnail-error": "Text shown when the image could 
not be loaded. Parameters:\n* $1 - the error message (not localized)\nSee 
also:\n* {{msg-mw|Multimediaviewer-metadata-error}}",
        "multimediaviewer-license-cc-by-1.0": "Very short label for the 
Creative Commons Attribution license, version 1.0, used in a link to the file 
information page that has more licensing information.\n{{Identical|CC BY}}",
diff --git a/resources/mmv/mmv.HtmlUtils.js b/resources/mmv/mmv.HtmlUtils.js
index d656a23..efb4465 100644
--- a/resources/mmv/mmv.HtmlUtils.js
+++ b/resources/mmv/mmv.HtmlUtils.js
@@ -164,7 +164,7 @@
                // There are two possible implementations for this:
                // 1) load innto a wrapper element and get its innerHTML;
                // 2) use outerHTML.
-               // We go with 2) because it handles the case when a jQuery 
object contains something
+               // We go with 1) because it handles the case when a jQuery 
object contains something
                // that is not an element (this can happen with e.g. 
$x.children() which returns text
                // nodes as well).
                return $( '<div>' ).append( $el ).html();
diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js 
b/resources/mmv/ui/mmv.ui.metadataPanel.js
index be6b403..1876566 100644
--- a/resources/mmv/ui/mmv.ui.metadataPanel.js
+++ b/resources/mmv/ui/mmv.ui.metadataPanel.js
@@ -505,19 +505,21 @@
         * @return {string} unsafe HTML
         */
        MPP.wrapAuthor = function ( author, authorCount, filepageUrl ) {
-               var $wrapper = $( '<span>' );
+               var moreText,
+                       $wrapper = $( '<span>' );
 
-               $wrapper
-                       .addClass( 'mw-mmv-author' )
-                       .append( $.parseHTML( author ) );
+               $wrapper.addClass( 'mw-mmv-author' );
 
                if ( authorCount > 1 ) {
-                       $wrapper.append( ' ',
+                       moreText = this.htmlUtils.jqueryToHtml(
                                $( '<a>' )
                                        .addClass( 'mw-mmv-more-authors' )
                                        .text( mw.message( 
'multimediaviewer-multiple-authors', authorCount - 1 ).text() )
                                        .attr( 'href', filepageUrl )
                        );
+                       $wrapper.append( mw.message( 
'multimediaviewer-multiple-authors-combine', author, moreText ).text() );
+               } else {
+                       $wrapper.append( author );
                }
 
                return $wrapper.get( 0 ).outerHTML;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I128ec7034b0bb9784fb78d1a5ce90d195555848e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

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

Reply via email to