diff --git a/view/resources.php b/view/resources.php index 3ee4936cd1a..7f264a8cf09 100644 --- a/view/resources.php +++ b/view/resources.php @@ -330,6 +330,8 @@ 'wikibase-description-edit-placeholder', 'wikibase-description-edit-placeholder-language-aware', 'wikibase-description-empty', + 'wikibase-description-not-applicable', + 'wikibase-description-not-applicable-title', 'wikibase-statementgrouplistview-add', 'wikibase-description-empty', 'wikibase-entitytermsview-entitytermsforlanguagelistview-configure-link-label', diff --git a/view/resources/jquery/wikibase/jquery.wikibase.descriptionview.js b/view/resources/jquery/wikibase/jquery.wikibase.descriptionview.js index df98f22c6b9..7342f33685e 100644 --- a/view/resources/jquery/wikibase/jquery.wikibase.descriptionview.js +++ b/view/resources/jquery/wikibase/jquery.wikibase.descriptionview.js @@ -108,7 +108,13 @@ this.element[ descriptionText ? 'removeClass' : 'addClass' ]( 'wb-empty' ); if ( !this.isInEditMode() && !descriptionText ) { - this.$text.text( mw.msg( 'wikibase-description-empty' ) ); + if ( languageCode === 'mul' ) { + this.$text.empty().append( + this._createDescriptionNotApplicableElements() + ); + } else { + this.$text.text( mw.msg( 'wikibase-description-empty' ) ); + } // Apply lang and dir of UI language // instead language of that row var userLanguage = mw.config.get( 'wgUserLanguage' ); @@ -189,6 +195,15 @@ return response; }, + _createDescriptionNotApplicableElements: function () { + var $abbr = $( '' ).attr( 'title', mw.msg( 'wikibase-description-not-applicable-title' ) ); + var $abbrText = $( '' ) + .text( mw.msg( 'wikibase-description-not-applicable' ) ) + .attr( 'aria-hidden', 'true' ); + $abbr.append( $abbrText ); + return $abbr; + }, + /** * Gets/Sets the widget's value. * diff --git a/view/tests/qunit/jquery/wikibase/jquery.wikibase.descriptionview.tests.js b/view/tests/qunit/jquery/wikibase/jquery.wikibase.descriptionview.tests.js index 558d8eb316b..248649bfdb2 100644 --- a/view/tests/qunit/jquery/wikibase/jquery.wikibase.descriptionview.tests.js +++ b/view/tests/qunit/jquery/wikibase/jquery.wikibase.descriptionview.tests.js @@ -151,4 +151,17 @@ ); } ); + QUnit.test( 'shows N/A placeholder for mul', function ( assert ) { + var $descriptionview = createDescriptionview( { + value: new datamodel.Term( 'mul', '' ) + } ), + descriptionview = $descriptionview.data( 'descriptionview' ); + + assert.strictEqual( + descriptionview.$text.text(), + '(wikibase-description-not-applicable)', + 'Shows "not applicable" placeholder.' + ); + } ); + }() );