Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/224743
Change subject: Gallery: Adapt the image namespaces to canonical File namespace ...................................................................... Gallery: Adapt the image namespaces to canonical File namespace Bug: T105799 Change-Id: Id48116cca70444f7a6c6daf7c34d5e3acb8db814 --- M modules/tools/ext.cx.tools.gallery.js 1 file changed, 5 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/43/224743/1 diff --git a/modules/tools/ext.cx.tools.gallery.js b/modules/tools/ext.cx.tools.gallery.js index f44cee2..581bdb5 100644 --- a/modules/tools/ext.cx.tools.gallery.js +++ b/modules/tools/ext.cx.tools.gallery.js @@ -13,7 +13,7 @@ function adaptGallery( $section ) { var i, $sourceSection, galleryData, galleryWikiMarkup = '', - imageItems, caption, imageIndex = 0; + imageItems, caption, imageTitle, imageIndex = 0; if ( !$section.is( '[typeof*="mw:Extension/gallery"]' ) ) { return; @@ -29,8 +29,11 @@ // FIXME: Copying plain text of gallery text will definitely lose the html // mark up in translation. What we need is Wikitext of the translated HTML. // That require a restbase api call. + imageTitle = imageItems[ i ].split( '|' )[ 0 ]; + // Change the image namespace to canonical File: namespace. + imageTitle = imageTitle.replace( /(.+)(:)/g, 'File' + '$2' ); caption = $section.find( '.gallerytext' ).eq( imageIndex ).text().trim(); - imageItems[ i ] = [ imageItems[ i ].split( '|' )[ 0 ], caption ].join( '|' ); + imageItems[ i ] = [ imageTitle, caption ].join( '|' ); imageIndex++; } } -- To view, visit https://gerrit.wikimedia.org/r/224743 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id48116cca70444f7a6c6daf7c34d5e3acb8db814 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits