Lucas Werkmeister (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/352563 )

Change subject: Update constraint violation messages
......................................................................

Update constraint violation messages

This changes “constraint violations” to “potential issues”, as suggested
by Lydia and Jan in T164360. It also makes the two strings localizable,
which accounts for the majority of changes – we have to add the messages
to the i18n files, register a ResourceLoader module to serve the
strings, and set up the script to load the messages.

Bug: T164360
Change-Id: I6907290908e754eef8eb9f92d90a9cb7d3eeb5fa
---
M docs/user.js
M extension.json
M i18n/en.json
M i18n/qqq.json
4 files changed, 29 insertions(+), 13 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/63/352563/1

diff --git a/docs/user.js b/docs/user.js
index 094e538..e73efe9 100644
--- a/docs/user.js
+++ b/docs/user.js
@@ -4,12 +4,13 @@
        'use strict';
 
        var entityJson,
-               entityId;
+               entityId,
+               api;
 
        function buildWidget( $reports ) {
                var widget = new OO.ui.PopupButtonWidget( {
                        icon: 'alert',
-                       iconTitle: 'This statement violates some constraints.',
+                       iconTitle: mw.message( 
'wbqc-gadget-potentialissues-long' ).text(),
                        label: $reports.children().length.toString(),
                        framed: false,
                        popup: {
@@ -17,7 +18,7 @@
                                width: 400,
                                padded: true,
                                head: true,
-                               label: $( '<h4>' ).text( 'Constraint report' )
+                               label: $( '<h4>' ).text( mw.message( 
'wbqc-gadget-potentialissues-short' ).text() )
                        }
                } );
 
@@ -101,16 +102,20 @@
 
        if ( entityJson !== null ) {
                entityId = JSON.parse( entityJson ).id;
-               mw.loader.using( [ 'oojs-ui-core', 'oojs-ui-widgets' ] ).done( 
function () {
-                       var api = new mw.Api();
-                       api.get( {
-                               action: 'wbcheckconstraints',
-                               format: 'json',
-                               id: entityId
-                       } ).done( function( data ) {
-                               $( '.wikibase-statementgroupview 
.wikibase-statementview-mainsnak .wikibase-snakview-value' )
-                                       .each( function () { 
addReportsToStatement( data.wbcheckconstraints[ entityId ], $( this ) ); } );
+               api = new mw.Api();
+               mw.loader.using( [ 'oojs-ui-core', 'oojs-ui-widgets', 
'mediawiki.api.messages', 'mediawiki.jqueryMsg', 'ConstraintReportGadget' ] )
+                       .then( function() {
+                               return api.loadMessagesIfMissing( [ 
'wbqc-potentialissues-short', 'wbqc-potentialissues-long' ] );
+                       } )
+                       .then( function () {
+                               api.get( {
+                                       action: 'wbcheckconstraints',
+                                       format: 'json',
+                                       id: entityId
+                               } ).done( function( data ) {
+                                       $( '.wikibase-statementgroupview 
.wikibase-statementview-mainsnak .wikibase-snakview-value' )
+                                               .each( function () { 
addReportsToStatement( data.wbcheckconstraints[ entityId ], $( this ) ); } );
+                               } );
                        } );
-               } );
        }
 } )( mw, $, OO );
diff --git a/extension.json b/extension.json
index 2602678..33f277e 100644
--- a/extension.json
+++ b/extension.json
@@ -41,6 +41,12 @@
                "SpecialConstraintReportPage": {
                        "styles": "modules/SpecialConstraintReportPage.css",
                        "scripts": "modules/SpecialConstraintReportPage.js"
+               },
+               "ConstraintReportGadget": {
+                       "messages": [
+                               "wbqc-gadget-potentialissues-short",
+                               "wbqc-gadget-potentialissues-long"
+                       ]
                }
        },
        "config": {
diff --git a/i18n/en.json b/i18n/en.json
index 306f224..e801b27 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -28,6 +28,9 @@
        "wbqc-constraintreport-result-link-to-constraint": "go to constraint",
        "wbqc-constraintreport-no-parameter": "none",
 
+       "wbqc-gadget-potentialissues-short": "Potential issues",
+       "wbqc-gadget-potentialissues-long": "This statement has some potential 
issues.",
+
        "apihelp-wbcheckconstraints-description": "Performs constraint checks 
on any entity you want and returns the result.",
        "apihelp-wbcheckconstraints-param-id": "ID list of the entities to get 
the data from. Separate values with '|' or alternative.",
        "apihelp-wbcheckconstraints-param-claimid": "GUID list identifying a 
claim to check a constraint report.  Separate values with '|'.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 4165c92..9b4850e 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -27,6 +27,8 @@
        "wbqc-constraintreport-result-link-to-claim": "Text for the link to a 
claim group on the entity page.",
        "wbqc-constraintreport-result-link-to-constraint": "Text for the link 
to a constraint on the property page.",
        "wbqc-constraintreport-no-parameter": "Text that is displayed when 
there was no value for a parameter given.\n{{Identical|None}}",
+       "wbqc-gadget-potentialissues-short": "Headline of the constraint report 
popup shown by the gadget on statements with constraint violations. Should be 
easy to understand for users, and convey that the reported violations are not 
always errors, but should be thought of as hints to the user that something 
might be wrong.{{Related|wbqc-constraintreport}",
+       "wbqc-gadget-potentialissues-long": "Title for the icon shown by the 
gadget on statements with constraint violations, usually displayed by the 
browser when the user hovers over the icon with the mouse 
cursor.{{Related|wbqc-gadget-potentialissues-short}}",
        "apihelp-wbcheckconstraints-description": 
"{{doc-apihelp-description|wbcheckconstraints}}",
        "apihelp-wbcheckconstraints-param-id": 
"{{doc-apihelp-param|wbcheckconstraints|id}}",
        "apihelp-wbcheckconstraints-param-claimid": 
"{{doc-apihelp-param|wbcheckconstraints|claimid}}",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6907290908e754eef8eb9f92d90a9cb7d3eeb5fa
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <lucas.werkmeis...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to