jenkins-bot has submitted this change and it was merged.

Change subject: Configure the entry point as a beta feature
......................................................................


Configure the entry point as a beta feature

Mingle:
https://wikimedia.mingle.thoughtworks.com/projects/language_engineering/cards/3932

Change-Id: I43158b857a035dc2977c6479ab2e04e80fcb0170
---
M ContentTranslation.hooks.php
M ContentTranslation.php
M i18n/en.json
M i18n/qqq.json
M modules/entrypoint/images/close.svg
A modules/entrypoint/images/translate-redlink-ltr.svg
A modules/entrypoint/images/translate-redlink-rtl.svg
7 files changed, 37 insertions(+), 1 deletion(-)

Approvals:
  KartikMistry: Looks good to me, approved
  Amire80: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index b47e359..54b4fda 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -21,8 +21,12 @@
                $title = $out->getTitle();
                $user = $out->getUser();
 
+               $redlinkFeatureEnabled = class_exists( 'BetaFeatures' ) &&
+                       BetaFeatures::isFeatureEnabled( $user, 
'red-interlanguage-link' );
+
                if ( $user->isLoggedIn() &&
-                       $title->getNamespace() === NS_MAIN &&
+                       $redlinkFeatureEnabled &&
+                       $title->inNamespace( NS_MAIN ) &&
                        $out->getLanguage()->getCode() !== 
$title->getPageLanguage()->getCode()
                ) {
                        $out->addModules( 'ext.cx.redlink' );
@@ -41,6 +45,31 @@
        }
 
        /**
+        * Hook: GetBetaFeaturePreferences
+        * @param User $user
+        * @param array $prefs
+        * @return bool
+        */
+       public static function getPreferences( $user, &$prefs ) {
+               global $wgExtensionAssetsPath;
+
+               $imageDir = 
"$wgExtensionAssetsPath/ContentTranslation/modules/entrypoint/images";
+
+               $prefs['red-interlanguage-link'] = array(
+                       'label-message' => 
'cx-red-interlanguage-link-preference',
+                       'desc-message' => 
'cx-red-interlanguage-link-preference-beta-desc',
+                       'screenshot' => array(
+                               'ltr' => "$imageDir/translate-redlink-ltr.svg",
+                               'rtl' => "$imageDir/translate-redlink-rtl.svg",
+                       ),
+                       'info-link' => 
'https://www.mediawiki.org/wiki/Extension:ContentTranslation',
+                       'discussion-link' => 
'https://www.mediawiki.org/wiki/Extension_talk:ContentTranslation',
+               );
+
+               return true;
+       }
+
+       /**
         * Hook: ResourceLoaderGetConfigVars
         * @param array $vars
         * @return bool
diff --git a/ContentTranslation.php b/ContentTranslation.php
index dc0fd8e..567d104 100644
--- a/ContentTranslation.php
+++ b/ContentTranslation.php
@@ -65,6 +65,7 @@
 
 // Hooks
 $GLOBALS['wgHooks']['BeforePageDisplay'][] = 
'ContentTranslationHooks::addModules';
+$GLOBALS['wgHooks']['GetBetaFeaturePreferences'][] = 
'ContentTranslationHooks::getPreferences';
 $GLOBALS['wgHooks']['ResourceLoaderGetConfigVars'][] = 
'ContentTranslationHooks::addConfig';
 
 $GLOBALS['wgExtensionFunctions'][] = function () {
diff --git a/i18n/en.json b/i18n/en.json
index df4afcb..8092594 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -20,6 +20,8 @@
        "cx-translation-add-translation": "+ Add translation",
        "tag-contenttranslation": "ContentTranslation",
        "cx-source-loading": "Loading $1",
+       "cx-red-interlanguage-link-preference": "Content translation",
+       "cx-red-interlanguage-link-preference-beta-desc": "Shows a red link to 
your language in the language links list if the page is not yet translated to 
your language and helps translating a page to your language using a convenient 
translation interface.",
        "cx-entrypoint-title": "Translate this page to $1",
        "cx-entrypoint-dialog-page-doesnt-exist-yet": "This page does not exist 
in $1 yet.<br />\nDo you want to create it?",
        "cx-entrypoint-dialog-title-in": "Title for the new page in $1:",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 9655ff4..30523c9 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -22,6 +22,8 @@
        "cx-translation-add-translation": "This appears in the empty paragraph 
in the translation column. Clicking the paragraph adds an automatic translation 
of the corresponding source paragraph. The plus sign is used as an icon that 
hints that something is being added.",
        "tag-contenttranslation": "A short description of the 
contenttranslation tag. Appears in the edit summary when a translated page is 
created.",
        "cx-source-loading": "Status text shown in the source article pane 
while article is being loaded.\n\nParameters:\n* $1 - the title of the page 
being loaded",
+       "cx-red-interlanguage-link-preference": "Beta feature title.",
+       "cx-red-interlanguage-link-preference-beta-desc": "Beta feature 
description.",
        "cx-entrypoint-title": "Tooltip for a red link that appears in the 
interlanguage links list and invites the user to translate the article to their 
language.\n\nParameters:\n* $1 - the language name in the interface language",
        "cx-entrypoint-dialog-page-doesnt-exist-yet": "The heading that appears 
at the top of the dialog that appears when the red interlanguage link is 
clicked.\n\nParameters:\n* $1 - the name of the target language, enclosed in 
<code><nowiki><span></nowiki></code> tags",
        "cx-entrypoint-dialog-title-in": "Label for a text input field where 
the user is supposed to write a title for the new that is going to be 
translated.\n\nParameters:\n* $1 - the name of the target language, enclosed in 
<code><nowiki><span></nowiki></code> tags",
diff --git a/modules/entrypoint/images/close.svg 
b/modules/entrypoint/images/close.svg
old mode 100755
new mode 100644
diff --git a/modules/entrypoint/images/translate-redlink-ltr.svg 
b/modules/entrypoint/images/translate-redlink-ltr.svg
new file mode 100644
index 0000000..1d850a8
--- /dev/null
+++ b/modules/entrypoint/images/translate-redlink-ltr.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 264 162" 
enable-background="new 0 0 264 162"><path fill="#fff" d="M13.4 
161.4l-12.9-9.6v-151.3h263v151.7l-9 6.7v-116.4h-39v112.6l-4.4-3.7-7.6 
5.3v-114.2h-155v110.8l-9.8 8-13.9-10-11.4 10.1z"/><path fill="#E5E5E5" d="M263 
1v151l-8 6v-116h-40v112l-3.3-2.8-.6-.5-.6.4-6.5 4.6v-113.7h-156v111.1l-9.3 
7.7-13.3-9.6-.6-.5-.6.5-10.9 9.5-12.3-9.2v-150.5h262m1-1h-264v152l13.4 10 
11.5-10 13.9 10 10.2-8.4v-110.6h154v114.7l8.1-5.7 4.9 
4.2v-113.2h38v117l10-7.4v-152.6zM203 157.7v-114.7h-154v110.6l2.1-1.6 12.6 10 
13.8-10 14.2 10 13-10 13 10 13.8-10 12.1 10 13.4-10 14.2 10 13-10 13 10 
5.8-4.3zM11 36c0-7.7 6.3-14 14-14s14 6.3 14 14-6.3 14-14 14-14-6.3-14-14zM254 
159.9v-116.9h-38v113.2l7.6 5.8 13.8-10 13.9 10 2.7-2.1zM38 
107v-35h-25v35h25zM232.5 5h26v6h-26v-6zM208.5 5h22v6h-22v-6zM142 
6v4h-92v-4h92m1-1h-94v6h94v-6zM184.5 5h22v6h-22v-6zM161.5 5h13v6h-13v-6zM176.5 
5h6v6h-6v-6zM153.5 5h6v6h-6v-6zM9 5h32v6h-32v-6z"/><path fill="#E5E5E5" 
stroke="#E5E5E5" d="M2 14.5h260"/><path fill="#E5E5E5" d="M52 7h2v2h-2v-2zM38 
59v-5h-25v5h25zM38 132v-35h-25v35h25z"/><path fill="#fff" d="M15.4 
108.5h20.1c.1 0 .2 0 .2.1v2c0 .1-.1.1-.2.1h-20.1c-.1 0-.2 
0-.2-.1v-2l.2-.1zM15.4 113.7h20.1c.1 0 .2 0 .2.1v2c0 .1-.1.1-.2.1h-20.1c-.1 
0-.2 0-.2-.1v-2l.2-.1z"/><path fill="#D11D13" d="M15.4 103.3h20.1c.1 0 .2 0 
.2.1v2c0 .1-.1.1-.2.1h-20.1c-.1 0-.2 0-.2-.1v-2l.2-.1z"/><path fill="#fff" 
d="M15.4 118.9h20.1c.1 0 .2 0 .2.1v2c0 .1-.1.1-.2.1h-20.1c-.1 0-.2 
0-.2-.1v-2l.2-.1zM15.4 124.2h20.1c.1 0 .2 0 .2.1v2c0 .1-.1.1-.2.1h-20.1c-.1 
0-.2 0-.2-.1v-2c.1-.1.1-.1.2-.1z"/><path fill="#347BFF" d="M54.5 
57.2v34.9l-13.5 12.2 13.5 12.2v23.5h139v-82.8z"/><g fill="#fff"><path d="M122.3 
103.7c-4.6-4.5-8.6-8.4-10.9-17.5h16v-6.8h-16v-8.9h-6.9v9h-16v6.8h16v2.3c-2.3 
8.9-5 14.6-16 20.2l2.3 6.8c10.4-5.6 15.9-12.5 18.3-20.3 2.3 5.9 6.2 10.6 10.6 
15.1l2.6-6.7zM143.5 81.7h-9.2l-16 45.1h6.9l4.6-13.5h18.2l4.6 
13.5h6.9l-16-45.1zm-11.5 24.8l6.9-18 6.9 18h-13.8z"/></g></svg>
\ No newline at end of file
diff --git a/modules/entrypoint/images/translate-redlink-rtl.svg 
b/modules/entrypoint/images/translate-redlink-rtl.svg
new file mode 100644
index 0000000..84df153
--- /dev/null
+++ b/modules/entrypoint/images/translate-redlink-rtl.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg"; viewBox="0 0 264 162" 
enable-background="new 0 0 264 162"><path fill="#fff" d="M239.2 151.4l-13.9 
10-9.8-8v-110.9h-155v114.2l-7.6-5.3-4.4 
3.7v-112.6h-39v116.5l-9-6.7v-151.8h263v151.2l-12.9 9.6-11.4-9.9z"/><path 
fill="#E5E5E5" d="M1 1h262v150.5l-12.3 9.2-10.9-9.5-.6-.5-.6.5-13.3 
9.6-9.3-7.7v-111.1h-156v113.7l-6.5-4.6-.6-.4-.6.5-3.3 
2.8v-112h-40v116l-8-6v-151m-1 151.5l10 7.4v-116.9h38v113.2l4.9-4.2 8.1 
5.7v-114.7h154v110.6l10.2 8.4 13.9-10 11.5 10 13.4-10v-152h-264v152.5zM61 
157.7l5.8 4.3 13-10 13 10 14.2-10 13.4 10 12.1-10 13.8 10 13-10 13 10 14.2-10 
13.8 10 12.6-10 2.1 1.6v-110.6h-154v114.7zM239 50c-7.7 0-14-6.3-14-14s6.3-14 
14-14 14 6.3 14 14-6.3 14-14 14zM12.7 162l13.9-10 13.8 10 
7.6-5.8v-113.2h-38v116.9l2.7 2.1zM251 107v-35h-25v35h25zM31.5 
5v6h-26v-6h26zM55.5 11h-22v-6h22v6zM122 6h92v4h-92v-4m-1 5h94v-6h-94v6zM79.5 
11h-22v-6h22v6zM102.5 11h-13v-6h13v6zM87.5 11h-6v-6h6v6zM110.5 
11h-6v-6h6v6zM255 11h-32v-6h32v6z"/><path fill="#E5E5E5" stroke="#E5E5E5" d="M2 
14.5h260"/><path fill="#E5E5E5" d="M212 9h-2v-2h2v2zM251 59v-5h-25v5h25zM251 
132v-35h-25v35h25z"/><path fill="#fff" d="M248.7 108.7v2c0 
.1-.1.1-.2.1h-20.1c-.1 0-.2 0-.2-.1v-2c0-.1.1-.1.2-.1h20.1c.2-.1.2 0 
.2.1zM248.7 113.9v2c0 .1-.1.1-.2.1h-20.1c-.1 0-.2 
0-.2-.1v-2c0-.1.1-.1.2-.1h20.1c.2-.1.2 0 .2.1z"/><path fill="#D11D13" d="M248.7 
103.5v2c0 .1-.1.1-.2.1h-20.1c-.1 0-.2 0-.2-.1v-2c0-.1.1-.1.2-.1h20.1c.2-.1.2 0 
.2.1z"/><path fill="#fff" d="M248.7 119.1v2c0 .1-.1.1-.2.1h-20.1c-.1 0-.2 
0-.2-.1v-2c0-.1.1-.1.2-.1h20.1c.2-.1.2 0 .2.1zM248.7 124.3v2c0 
.1-.1.1-.2.1h-20.1c-.1 0-.2 0-.2-.1v-2c0-.1.1-.1.2-.1h20.1c.2 0 .2 0 
.2.1z"/><path fill="#347BFF" d="M209.5 57.2v34.9l13.5 12.2-13.5 
12.2v23.5h-139v-82.8z"/><g fill="#fff"><path d="M138.3 
103.7c-4.6-4.5-8.6-8.4-10.9-17.5h16v-6.8h-16v-8.9h-6.9v9h-16v6.8h16v2.3c-2.3 
8.9-5 14.6-16 20.2l2.3 6.8c10.4-5.6 15.9-12.5 18.3-20.3 2.3 5.9 6.2 10.6 10.6 
15.1l2.6-6.7zM159.5 81.7h-9.2l-16 45.1h6.9l4.6-13.5h18.2l4.6 
13.5h6.9l-16-45.1zm-11.5 24.8l6.9-18 6.9 18h-13.8z"/></g></svg>
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I43158b857a035dc2977c6479ab2e04e80fcb0170
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il>
Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il>
Gerrit-Reviewer: KartikMistry <kartik.mis...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Santhosh <santhosh.thottin...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to