jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/352568 )

Change subject: Make constraint report messages translatable
......................................................................


Make constraint report messages translatable

Instead of hard-coding the English strings in the user script, move them
to i18n/, register a ResourceLoader module to serve them, and set up the
script to load the messages.

Change-Id: I273eb3a1ae568e4adb6064453d26e21085d5634d
---
M docs/user.js
M extension.json
M i18n/en.json
M i18n/qqq.json
4 files changed, 14 insertions(+), 3 deletions(-)

Approvals:
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, approved



diff --git a/docs/user.js b/docs/user.js
index 8dfb743..409167c 100644
--- a/docs/user.js
+++ b/docs/user.js
@@ -9,7 +9,7 @@
        function buildWidget( reports ) {
                var widget = new OO.ui.PopupButtonWidget( {
                        icon: 'alert',
-                       iconTitle: 'This statement has some potential issues.',
+                       iconTitle: mw.message( 'wbqc-potentialissues-long' 
).text(),
                        label: reports.length > 1 ? reports.length.toString() : 
'',
                        framed: false,
                        popup: {
@@ -22,7 +22,7 @@
                                width: 400,
                                padded: true,
                                head: true,
-                               label: $( '<h4>' ).text( 'Potential issues' )
+                               label: $( '<h4>' ).text( mw.message( 
'wbqc-potentialissues-short' ).text() )
                        }
                } );
 
@@ -103,7 +103,7 @@
 
        if ( entityJson !== null ) {
                entityId = JSON.parse( entityJson ).id;
-               mw.loader.using( [ 'oojs-ui-core', 'oojs-ui-widgets' ] ).done( 
function () {
+               mw.loader.using( [ 'oojs-ui-core', 'oojs-ui-widgets', 
'wikibase.quality.constraints.ui' ] ).done( function () {
                        var api = new mw.Api();
                        api.get( {
                                action: 'wbcheckconstraints',
diff --git a/extension.json b/extension.json
index 2602678..b47be26 100644
--- a/extension.json
+++ b/extension.json
@@ -41,6 +41,12 @@
                "SpecialConstraintReportPage": {
                        "styles": "modules/SpecialConstraintReportPage.css",
                        "scripts": "modules/SpecialConstraintReportPage.js"
+               },
+               "wikibase.quality.constraints.ui": {
+                       "messages": [
+                               "wbqc-potentialissues-short",
+                               "wbqc-potentialissues-long"
+                       ]
                }
        },
        "config": {
diff --git a/i18n/en.json b/i18n/en.json
index 306f224..4fada66 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-potentialissues-short": "Potential issues",
+       "wbqc-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..bf0e8ac 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-potentialissues-short": "Headline of the constraint report popup 
shown 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-potentialissues-long": "Title for the icon shown on statements 
with constraint violations, usually displayed by the browser when the user 
hovers over the icon with the mouse 
cursor.{{Related|wbqc-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/352568
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I273eb3a1ae568e4adb6064453d26e21085d5634d
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Lucas Werkmeister (WMDE) <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to