Esanders has uploaded a new change for review.

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

Change subject: Use mw.Title to localise file: prefix on new images
......................................................................

Use mw.Title to localise file: prefix on new images

Bug: T110104
Change-Id: I25e28367bf4b00a0447c941b7359ebff5fe59147
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
1 file changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/36/233736/1

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
index 7ba89c2..db85393 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
@@ -359,7 +359,7 @@
        var i, newDimensions, field, isPortrait, $info, $section, windowWidth,
                contentDirection = this.getFragment().getDocument().getDir(),
                imageTitle = new OO.ui.LabelWidget( {
-                       label: new mw.Title( imageinfo.title ).getNameText()
+                       label: mw.Title.newFromText( imageinfo.title 
).getNameText()
                } ),
                metadata = imageinfo.extmetadata,
                // Field configuration (in order)
@@ -724,18 +724,21 @@
  * @param {ve.ui.MWMediaResultWidget|null} item Selected item
  */
 ve.ui.MWMediaDialog.prototype.confirmSelectedImage = function () {
-       var obj = {},
+       var title,
+               obj = {},
                info = this.selectedImageInfo;
 
        if ( info ) {
+               // Run title through mw.Title so the File: prefix is localised
+               title = mw.Title.newFromText( info.title ).getPrefixedText();
                if ( !this.imageModel ) {
                        // Create a new image model based on default attributes
                        this.imageModel = 
ve.dm.MWImageModel.static.newFromImageAttributes(
                                {
                                        // Per 
https://www.mediawiki.org/w/?diff=931265&oldid=prev
-                                       href: './' + info.title,
+                                       href: './' + title,
                                        src: info.url,
-                                       resource: './' + info.title,
+                                       resource: './' + title,
                                        width: info.thumbwidth,
                                        height: info.thumbheight,
                                        mediaType: info.mediatype,
@@ -753,9 +756,9 @@
                        this.imageModel.changeImageSource(
                                {
                                        mediaType: info.mediatype,
-                                       href: './' + info.title,
+                                       href: './' + title,
                                        src: info.url,
-                                       resource: './' + info.title
+                                       resource: './' + title
                                },
                                info
                        );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25e28367bf4b00a0447c941b7359ebff5fe59147
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>

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

Reply via email to