Amire80 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/248852

Change subject: Add a link to the experimental recommend tool
......................................................................

Add a link to the experimental recommend tool

Bug: T112720
Change-Id: I41a92b8decf8f47a2c0dd074c493c3674ee5080c
---
M ContentTranslation.hooks.php
M extension.json
M i18n/en.json
M modules/dashboard/ext.cx.suggestionlist.js
M modules/dashboard/styles/ext.cx.lists.common.less
5 files changed, 47 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/52/248852/1

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index c910ef2..979cdf2 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -166,6 +166,7 @@
                        $wgContentTranslationDomainCodeMapping,
                        $wgContentTranslationEnableSuggestions,
                        $wgContentTranslationExperimentalFeatures,
+                       $wgContentTranslationUseRecommendWmflabs,
                        $wgContentTranslationDatabase,
                        $wgContentTranslationSiteTemplates,
                        $wgContentTranslationCampaigns,
@@ -177,6 +178,7 @@
                $vars['wgContentTranslationDomainCodeMapping'] = 
$wgContentTranslationDomainCodeMapping;
                $vars['wgContentTranslationEnableSuggestions'] = 
$wgContentTranslationEnableSuggestions;
                $vars['wgContentTranslationExperimentalFeatures'] = 
$wgContentTranslationExperimentalFeatures;
+               $vars['wgContentTranslationUseRecommendWmflabs'] = 
$wgContentTranslationUseRecommendWmflabs;
                $vars['wgContentTranslationDatabase'] = 
$wgContentTranslationDatabase;
                $vars['wgContentTranslationSiteTemplates'] = 
$wgContentTranslationSiteTemplates;
                $vars['wgContentTranslationCampaigns'] = 
$wgContentTranslationCampaigns;
diff --git a/extension.json b/extension.json
index fd8a700..1396954 100644
--- a/extension.json
+++ b/extension.json
@@ -130,8 +130,10 @@
                        "cxstats": true,
                        "newarticle": true
                },
-               "@ContentTranslationUseMagnusTool":"Whether the Magnus tool to 
find missing articles to be enabled or not. This is initially made to 
experiment with an article comparison tool at 
http://tools.wmflabs.org/not-in-the-other-language/ See 
https://phabricator.wikimedia.org/T76843";,
+               "@ContentTranslationUseMagnusTool":"Whether to enable the 
Magnus tool to find missing articles or not. This is initially made to 
experiment with an article comparison tool at 
http://tools.wmflabs.org/not-in-the-other-language/ See 
https://phabricator.wikimedia.org/T76843";,
                "ContentTranslationUseMagnusTool": true,
+               "@ContentTranslationUseRecommendWmflabs":"Whether to enable the 
Articles Recommended for Translation tool to find suggested articles. This is 
initially made to experiment with an article comparison tool at 
http://recommend.wmflabs.org/#Recommend See 
https://phabricator.wikimedia.org/T112720";,
+               "ContentTranslationUseRecommendWmflabs": true,
                "ContentTranslationBrowserBlacklist": {
                        "msie": [ [ "<", 10 ] ]
                },
@@ -831,6 +833,8 @@
                                "cx-suggestionlist-title",
                                "cx-suggestionlist-empty-title",
                                "cx-suggestionlist-empty-desc",
+                               "cx-suggestionlist-empty-desc-with-recommend",
+                               
"cx-suggestionlist-empty-desc-recommend-link-text",
                                "cx-suggestionlist-view-source-page",
                                "cx-suggestionlist-featured"
                        ]
diff --git a/i18n/en.json b/i18n/en.json
index 9c68356..ffd4ad3 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -110,8 +110,10 @@
        "cx-translation-filter-suggested-translations": "Suggestions",
        "cx-suggestionlist-favorite": "For later",
        "cx-suggestionlist-title": "More suggestions",
-       "cx-suggestionlist-empty-title": "Sorry, no pages to suggest",
+       "cx-suggestionlist-empty-title": "No suggestions for now",
        "cx-suggestionlist-empty-desc": "You can pick any topic of your choice 
when starting a new translation",
+       "cx-suggestionlist-empty-desc-with-recommend": "We found no 
suggestions. You can check later or find relevant pages using our experimental 
tool.",
+       "cx-suggestionlist-empty-desc-recommend-link-text": "View experimental 
suggestions",
        "cx-suggestionlist-featured": "Featured",
        "cx-suggestionlist-view-source-page": "View source page",
        "cx-translation-filter-from-any-language": "From any language",
diff --git a/modules/dashboard/ext.cx.suggestionlist.js 
b/modules/dashboard/ext.cx.suggestionlist.js
index 0e56f88..eee9340 100644
--- a/modules/dashboard/ext.cx.suggestionlist.js
+++ b/modules/dashboard/ext.cx.suggestionlist.js
@@ -544,31 +544,53 @@
        };
 
        CXSuggestionList.prototype.showEmptySuggestionList = function () {
-               var $img, $title, $desc, listId = emptyListName;
+               var $img, $title, $desc, descMsg,
+                       listId = emptyListName;
 
                if ( !this.lists[ listId ] ) {
                        this.lists[ listId ] = {
                                name: listId
                        };
+
                        $img = $( '<div>' )
                                .addClass( 'cx-suggestionlist-empty__img' );
+
                        $title = $( '<div>' )
                                .addClass( 'cx-suggestionlist-empty__title' )
                                .text( mw.msg( 'cx-suggestionlist-empty-title' 
) );
+
                        $desc = $( '<div>' )
-                               .addClass( 'cx-suggestionlist-empty__desc' )
-                               .text( mw.msg( 'cx-suggestionlist-empty-desc' ) 
);
+                               .addClass( 'cx-suggestionlist-empty__desc' );
+
                        this.lists[ listId ].$list = $( '<div>' )
                                .addClass( 'cx-suggestionlist-empty' )
                                .append( $img, $title, $desc );
+
+                       if ( mw.config.get( 
'wgContentTranslationUseRecommendWmflabs' ) ) {
+                               descMsg = 
'cx-suggestionlist-empty-desc-with-recommend';
+                               $desc.after( $( '<div>' )
+                                       .addClass( 
'cx-suggestionlist-empty__recommend' )
+                                       .append( $( '<a>' )
+                                               .text( mw.msg( 
'cx-suggestionlist-empty-desc-recommend-link-text' ) )
+                                               .prop( 'href', 
'http://recommend.wmflabs.org' )
+                                       )
+                               );
+                       } else {
+                               descMsg = 'cx-suggestionlist-empty-desc';
+                       }
+
+                       $desc.text( mw.msg( descMsg ) );
+
                        this.$container.append( this.lists[ listId ].$list );
                }
+
                // Hide all other lists, if any.
                $.each( this.lists, function ( index, list ) {
                        if ( list.$list ) {
                                list.$list.hide();
                        }
                } );
+
                this.lists[ listId ].$list.show();
        };
 
diff --git a/modules/dashboard/styles/ext.cx.lists.common.less 
b/modules/dashboard/styles/ext.cx.lists.common.less
index 1256373..bf48812 100644
--- a/modules/dashboard/styles/ext.cx.lists.common.less
+++ b/modules/dashboard/styles/ext.cx.lists.common.less
@@ -48,6 +48,18 @@
                margin-top: 20px;
                font-size: normal;
        }
+
+       &__recommend {
+               margin-top: 20px;
+               font-size: normal;
+               font-weight: bold;
+
+               a,
+               a:visited {
+                       text-decoration: none;
+                       color: inherit;
+               }
+       }
 }
 
 .cx-tlitem__languages,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41a92b8decf8f47a2c0dd074c493c3674ee5080c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>

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

Reply via email to