Esanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/111179
Change subject: Always show 'File:' in content language for gallery placeholder ...................................................................... Always show 'File:' in content language for gallery placeholder Requires extending placeholder text to use a getter, rather than a simple message name. Change-Id: I712aae40bf89fc14fb03530b2a1c2bdf183ab19d --- M modules/ve-mw/i18n/en.json M modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js M modules/ve-mw/ui/inspectors/ve.ui.MWGalleryInspector.js 3 files changed, 23 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/79/111179/1 diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 21675f7..f1e9da9 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -119,7 +119,7 @@ "visualeditor-mwalienextensioninspector-title": "MediaWiki extension", "visualeditor-mweditmodesource-title": "Switch to source editing", "visualeditor-mweditmodesource-warning": "You are about to switch to source editing.\nAny changes you've made to this document will be kept, but you will not be able switch back to VisualEditor without saving or reloading the page.\nDo you want to continue?", - "visualeditor-mwgalleryinspector-placeholder": "File:Example.jpg|Caption for image", + "visualeditor-mwgalleryinspector-placeholder": "Example.jpg|Caption for image", "visualeditor-mwgalleryinspector-title": "Gallery", "visualeditor-mwhieroinspector-title": "Hieroglyphics", "visualeditor-mwmathinspector-title": "Formula", diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js index 4380a8a..9b4740f 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js @@ -60,6 +60,15 @@ }; /** + * Get the placeholder text for the content input area. + * + * @returns {string} Placeholder text + */ +ve.ui.MWExtensionInspector.prototype.getInputPlaceholder = function () { + return ''; +}; + +/** * @inheritdoc */ ve.ui.MWExtensionInspector.prototype.setup = function ( data ) { @@ -77,9 +86,7 @@ } this.input.setValue( this.node ? this.node.getModel().getAttribute( 'mw' ).body.extsrc : '' ); - if ( this.constructor.static.placeholder ) { - this.input.$input.attr( 'placeholder', ve.msg( this.constructor.static.placeholder ) ); - } + this.input.$input.attr( 'placeholder', this.getInputPlaceholder() ); // By default, the direction of the input element should be the same // as the direction of the content it applies to diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWGalleryInspector.js b/modules/ve-mw/ui/inspectors/ve.ui.MWGalleryInspector.js index f5ef2b3..c816dd1 100644 --- a/modules/ve-mw/ui/inspectors/ve.ui.MWGalleryInspector.js +++ b/modules/ve-mw/ui/inspectors/ve.ui.MWGalleryInspector.js @@ -5,6 +5,8 @@ * @license The MIT License (MIT); see LICENSE.txt */ +/*global mw */ + /** * MediaWiki gallery inspector. * @@ -32,12 +34,20 @@ ve.ui.MWGalleryInspector.static.titleMessage = 'visualeditor-mwgalleryinspector-title'; -ve.ui.MWGalleryInspector.static.placeholder = 'visualeditor-mwgalleryinspector-placeholder'; - ve.ui.MWGalleryInspector.static.nodeView = ve.ce.MWGalleryNode; ve.ui.MWGalleryInspector.static.nodeModel = ve.dm.MWGalleryNode; +/* Methods */ + +/** */ +ve.ui.MWGalleryInspector.prototype.getInputPlaceholder = function () { + // 'File:' is always in content language + return mw.config.get( 'wgFormattedNamespaces' )['6'] + ':' + + ve.msg( 'visualeditor-mwgalleryinspector-placeholder' ); +}; + + /* Registration */ ve.ui.inspectorFactory.register( ve.ui.MWGalleryInspector ); -- To view, visit https://gerrit.wikimedia.org/r/111179 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I712aae40bf89fc14fb03530b2a1c2bdf183ab19d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits