Amire80 has uploaded a new change for review.

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

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
A modules/entrypoint/images/translate-redlink-ltr.svg
A modules/entrypoint/images/translate-redlink-rtl.svg
6 files changed, 98 insertions(+), 0 deletions(-)


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

diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index b47e359..d56e149 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -21,7 +21,12 @@
                $title = $out->getTitle();
                $user = $out->getUser();
 
+               $redlinkFeatureEnabled = class_exists( BetaFeatures ) ?
+                       BetaFeatures::isFeatureEnabled( $user, 
'red-interlanguage-link' ) :
+                       true;
+
                if ( $user->isLoggedIn() &&
+                       $redlinkFeatureEnabled &&
                        $title->getNamespace() === NS_MAIN &&
                        $out->getLanguage()->getCode() !== 
$title->getPageLanguage()->getCode()
                ) {
@@ -40,6 +45,24 @@
                return true;
        }
 
+       public static function getPreferences( $user, &$prefs ) {
+               global $wgExtensionAssetsPath;
+
+               $prefs['red-interlanguage-link'] = array(
+                       // The first two are message keys
+                       'label-message' => 
'cx-red-interlanguage-link-preference',
+                       'desc-message' => 
'cx-red-interlanguage-link-preference-beta-desc',
+                       'screenshot' => array(
+                               'ltr' => 
"$wgExtensionAssetsPath/ContentTranslation/modules/entrypoint/images/translate-redlink-ltr.svg",
+                               'rtl' => 
"$wgExtensionAssetsPath/ContentTranslation/modules/entrypoint/images/translate-redlink-rtl.svg",
+                       ),
+                       // Link to information on the feature - use subpages on 
mw.org, maybe?
+                       'info-link' => 
'https://mediawiki.org/wiki/Extension:ContentTranslation',
+                       // Link to discussion about the feature - talk pages 
might work
+                       'discussion-link' => 
'https://mediawiki.org/wiki/Extension_talk:ContentTranslation',
+               );
+       }
+
        /**
         * Hook: ResourceLoaderGetConfigVars
         * @param array $vars
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..d0a0b96 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": "Show a red link in 
the list of interlanguage links if an article doesn't have an interlanguage 
link to your language.",
        "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/translate-redlink-ltr.svg 
b/modules/entrypoint/images/translate-redlink-ltr.svg
new file mode 100644
index 0000000..9ad9f7c
--- /dev/null
+++ b/modules/entrypoint/images/translate-redlink-ltr.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 
6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; x="0px" y="0px" viewBox="0 0 264 
162" enable-background="new 0 0 264 162" xml:space="preserve">
+<g>
+       <path fill="#FFFFFF" 
d="M13.4,161.4l-12.9-9.6V0.5h263v151.7l-9,6.7V42.5h-39v112.6l-4.4-3.7l-7.6,5.3V42.5h-155v110.8l-9.8,8
   l-13.9-10L13.4,161.4z"/>
+       <path fill="#E5E5E5" 
d="M263,1v151l-8,6V42h-40v112l-3.3-2.8l-0.6-0.5l-0.6,0.4l-6.5,4.6V42H48v111.1l-9.3,7.7l-13.3-9.6l-0.6-0.5
   l-0.6,0.5l-10.9,9.5L1,151.5V1L263,1 
M264,0H0v152l13.4,10l11.5-10l13.9,10l10.2-8.4V43h154v114.7l8.1-5.7l4.9,4.2V43h38V160
   l10-7.4V0z"/>
+</g>
+<path fill="#E5E5E5" 
d="M203,157.7V43H49v110.6l2.1-1.6l12.6,10l13.8-10l14.2,10l13-10l13,10l13.8-10l12.1,10l13.4-10l14.2,10l13-10
  l13,10L203,157.7L203,157.7z"/>
+<path fill="#E5E5E5" 
d="M11,36c0-7.7,6.3-14,14-14s14,6.3,14,14s-6.3,14-14,14S11,43.7,11,36z"/>
+<path fill="#E5E5E5" 
d="M254,159.9V43h-38v113.2l7.6,5.8l13.8-10l13.9,10L254,159.9z"/>
+<path fill="#E5E5E5" d="M38,107V72H13v35H38z"/>
+<path fill="#E5E5E5" d="M232.5,5h26v6h-26L232.5,5L232.5,5z"/>
+<path fill="#E5E5E5" d="M208.5,5h22v6h-22V5z"/>
+<path fill="#E5E5E5" d="M142,6v4H50V6H142 M143,5H49v6h94V5z"/>
+<path fill="#E5E5E5" d="M184.5,5h22v6h-22V5z"/>
+<path fill="#E5E5E5" d="M161.5,5h13v6h-13V5z"/>
+<path fill="#E5E5E5" d="M176.5,5h6v6h-6V5z"/>
+<path fill="#E5E5E5" d="M153.5,5h6v6h-6V5z"/>
+<path fill="#E5E5E5" d="M9,5h32v6H9V5z"/>
+<path fill="#E5E5E5" stroke="#E5E5E5" d="M2,14.5h260"/>
+<path fill="#E5E5E5" d="M52,7h2v2h-2V7z"/>
+<path fill="#E5E5E5" d="M38,59v-5H13v5H38z"/>
+<path fill="#E5E5E5" d="M38,132V97H13v35H38z"/>
+<path fill="#FFFFFF" 
d="M15.4,108.5h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,108.6,15.3,108.5,15.4,108.5z"/>
+<path fill="#FFFFFF" 
d="M15.4,113.7h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,113.8,15.3,113.7,15.4,113.7z"/>
+<path fill="#D11D13" 
d="M15.4,103.3h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,103.4,15.3,103.3,15.4,103.3z"/>
+<path fill="#FFFFFF" 
d="M15.4,118.9h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,119,15.3,118.9,15.4,118.9z"/>
+<path fill="#FFFFFF" 
d="M15.4,124.2h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,124.2,15.3,124.2,15.4,124.2z"/>
+<polygon fill="#347BFF" points="54.5,57.2 54.5,92.1 41,104.3 54.5,116.5 
54.5,140 193.5,140 193.5,57.2 "/>
+<g>
+       <path fill="#FFFFFF" 
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.8h16c0,2.3,0.2,1.3,0,2.3
   
c-2.3,8.9-5,14.6-16,20.2l2.3,6.8c10.4-5.6,15.9-12.5,18.3-20.3c2.3,5.9,6.2,10.6,10.6,15.1L122.3,103.7z"/>
+       <path fill="#FFFFFF" 
d="M143.5,81.7h-9.2l-16,45.1h6.9l4.6-13.5H148l4.6,13.5h6.9L143.5,81.7z 
M132,106.5l6.9-18l6.9,18L132,106.5   L132,106.5z"/>
+</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..9ad9f7c
--- /dev/null
+++ b/modules/entrypoint/images/translate-redlink-rtl.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 
6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; x="0px" y="0px" viewBox="0 0 264 
162" enable-background="new 0 0 264 162" xml:space="preserve">
+<g>
+       <path fill="#FFFFFF" 
d="M13.4,161.4l-12.9-9.6V0.5h263v151.7l-9,6.7V42.5h-39v112.6l-4.4-3.7l-7.6,5.3V42.5h-155v110.8l-9.8,8
   l-13.9-10L13.4,161.4z"/>
+       <path fill="#E5E5E5" 
d="M263,1v151l-8,6V42h-40v112l-3.3-2.8l-0.6-0.5l-0.6,0.4l-6.5,4.6V42H48v111.1l-9.3,7.7l-13.3-9.6l-0.6-0.5
   l-0.6,0.5l-10.9,9.5L1,151.5V1L263,1 
M264,0H0v152l13.4,10l11.5-10l13.9,10l10.2-8.4V43h154v114.7l8.1-5.7l4.9,4.2V43h38V160
   l10-7.4V0z"/>
+</g>
+<path fill="#E5E5E5" 
d="M203,157.7V43H49v110.6l2.1-1.6l12.6,10l13.8-10l14.2,10l13-10l13,10l13.8-10l12.1,10l13.4-10l14.2,10l13-10
  l13,10L203,157.7L203,157.7z"/>
+<path fill="#E5E5E5" 
d="M11,36c0-7.7,6.3-14,14-14s14,6.3,14,14s-6.3,14-14,14S11,43.7,11,36z"/>
+<path fill="#E5E5E5" 
d="M254,159.9V43h-38v113.2l7.6,5.8l13.8-10l13.9,10L254,159.9z"/>
+<path fill="#E5E5E5" d="M38,107V72H13v35H38z"/>
+<path fill="#E5E5E5" d="M232.5,5h26v6h-26L232.5,5L232.5,5z"/>
+<path fill="#E5E5E5" d="M208.5,5h22v6h-22V5z"/>
+<path fill="#E5E5E5" d="M142,6v4H50V6H142 M143,5H49v6h94V5z"/>
+<path fill="#E5E5E5" d="M184.5,5h22v6h-22V5z"/>
+<path fill="#E5E5E5" d="M161.5,5h13v6h-13V5z"/>
+<path fill="#E5E5E5" d="M176.5,5h6v6h-6V5z"/>
+<path fill="#E5E5E5" d="M153.5,5h6v6h-6V5z"/>
+<path fill="#E5E5E5" d="M9,5h32v6H9V5z"/>
+<path fill="#E5E5E5" stroke="#E5E5E5" d="M2,14.5h260"/>
+<path fill="#E5E5E5" d="M52,7h2v2h-2V7z"/>
+<path fill="#E5E5E5" d="M38,59v-5H13v5H38z"/>
+<path fill="#E5E5E5" d="M38,132V97H13v35H38z"/>
+<path fill="#FFFFFF" 
d="M15.4,108.5h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,108.6,15.3,108.5,15.4,108.5z"/>
+<path fill="#FFFFFF" 
d="M15.4,113.7h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,113.8,15.3,113.7,15.4,113.7z"/>
+<path fill="#D11D13" 
d="M15.4,103.3h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,103.4,15.3,103.3,15.4,103.3z"/>
+<path fill="#FFFFFF" 
d="M15.4,118.9h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,119,15.3,118.9,15.4,118.9z"/>
+<path fill="#FFFFFF" 
d="M15.4,124.2h20.1c0.1,0,0.2,0,0.2,0.1v2c0,0.1-0.1,0.1-0.2,0.1H15.4c-0.1,0-0.2,0-0.2-0.1v-2
  C15.3,124.2,15.3,124.2,15.4,124.2z"/>
+<polygon fill="#347BFF" points="54.5,57.2 54.5,92.1 41,104.3 54.5,116.5 
54.5,140 193.5,140 193.5,57.2 "/>
+<g>
+       <path fill="#FFFFFF" 
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.8h16c0,2.3,0.2,1.3,0,2.3
   
c-2.3,8.9-5,14.6-16,20.2l2.3,6.8c10.4-5.6,15.9-12.5,18.3-20.3c2.3,5.9,6.2,10.6,10.6,15.1L122.3,103.7z"/>
+       <path fill="#FFFFFF" 
d="M143.5,81.7h-9.2l-16,45.1h6.9l4.6-13.5H148l4.6,13.5h6.9L143.5,81.7z 
M132,106.5l6.9-18l6.9,18L132,106.5   L132,106.5z"/>
+</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: newchange
Gerrit-Change-Id: I43158b857a035dc2977c6479ab2e04e80fcb0170
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il>

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

Reply via email to