Albert221 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395817 )

Change subject: Internationalize hardcoded strings from View Task
......................................................................

Internationalize hardcoded strings from View Task

It's a part of T96418.

Change-Id: I4129f57f465dc7fad40d8883e207b7456db3ddd7
---
M i18n/en.json
M i18n/qqq.json
M src/MassActionSpecialPage.php
3 files changed, 65 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MassAction 
refs/changes/17/395817/1

diff --git a/i18n/en.json b/i18n/en.json
index 7b0ae63..be46c4a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -27,5 +27,23 @@
        "massaction-regexreplace-desc": "Performs a regex replace on the 
content using the pattern",
        "massaction-titleregexmatcher-desc": "Matches pages with titles 
matching regex \"$1\"",
        "massaction-titleregexmatcher-enabled": "Title regex matcher enabled?",
-       "massaction-titleregexmatcher-label": "Title regex"
+       "massaction-titleregexmatcher-label": "Title regex",
+       "massaction-task-id": "Task Id",
+       "massaction-view-task-submit": "View Task",
+       "massaction-view-task-title": "View Task",
+       "massaction-view-task-no-tasks": "No task exists with the id: $1",
+       "massaction-view-task-id": "Task $1",
+       "massaction-view-task-summary": "Summary: $1",
+       "massaction-view-task-user": "User: $1",
+       "massaction-view-task-target-type": "Target Type: $1",
+       "massaction-view-task-date-created": "Date Created: $1",
+       "massaction-view-task-state": "State: $1",
+       "massaction-view-task-actions": "Actions ($1)",
+       "massaction-view-task-matchers": "Matchers ($1)",
+       "massaction-view-task-targets": "Targets ($1)",
+       "massaction-view-task-save-all": "Save All",
+       "massaction-view-task-target-identifier": "Identifier",
+       "massaction-view-task-target-name": "Name",
+       "massaction-view-task-target-state": "State",
+       "massaction-view-task-target-save": "Save"
 }
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 856145a..53b2535 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -29,5 +29,23 @@
        "massaction-regexreplace-desc": "Description for the action that 
replaces the following regex pattern",
        "massaction-titleregexmatcher-desc": "Description for the matcher that 
matches the following regex pattern in titles. Parameters:\n* $1 - the regex 
pattern that is being matched",
        "massaction-titleregexmatcher-enabled": "Label for whether or not the 
matcher for title regex is enabled",
-       "massaction-titleregexmatcher-label": "Label for the title regex 
matcher"
+       "massaction-titleregexmatcher-label": "Label for the title regex 
matcher",
+       "massaction-task-id": "Placeholder for task id",
+       "massaction-view-task-submit": "Text displayed in submit button",
+       "massaction-view-task-title": "Title for page displaing tasks",
+       "massaction-view-task-no-tasks": "Text displayed when no tasks can be 
displayed for given id. Parameters:\n* $1 - given task id",
+       "massaction-view-task-id": "Title for page displaying task with given 
id. Parameters:\n* $1 - given task id",
+       "massaction-view-task-summary": "Text that shows summary of task. 
Parameters:\n* $1 - task summary",
+       "massaction-view-task-user": "Text that shows user of task. 
Parameters:\n* $1 - task user name",
+       "massaction-view-task-target-type": "Text that shows target type of 
task. Parameters:\n* $1 - task target type",
+       "massaction-view-task-date-created": "Text that shows creation date of 
task. Parameters:\n* $ - task creation date",
+       "massaction-view-task-state": "Text that shows state of task. 
Parameters:\n* $1 - task state",
+       "massaction-view-task-actions": "Title for actions with their count. 
Parameters:\n* $1 - actions count",
+       "massaction-view-task-matchers": "Title for matchers with their count. 
Parameters:\n* $1 - matchers count",
+       "massaction-view-task-targets": "Title for targets with their count. 
Parameters:\n* $1 - targets count",
+       "massaction-view-task-save-all": "Text that shows in submit button for 
saving all targets changes",
+       "massaction-view-task-target-identifier": "Text that shows in table 
heading for target identifier",
+       "massaction-view-task-target-name": "Text that shows in table heading 
for target name",
+       "massaction-view-task-target-state": "Text that shows in table heading 
for target state",
+       "massaction-view-task-target-save": "Text that shows in submit button 
for saving target changes"
 }
diff --git a/src/MassActionSpecialPage.php b/src/MassActionSpecialPage.php
index ece1dc1..5556c11 100644
--- a/src/MassActionSpecialPage.php
+++ b/src/MassActionSpecialPage.php
@@ -84,11 +84,11 @@
                $formDescriptor = array(
                        'viewid' => array(
                                'type' => 'text',
-                               'placeholder' => 'Task Id',
+                               'placeholder' => wfMessage( 
'massaction-task-id' )->parse(),
                        ),
                );
                $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 
'ViewIDForm' );
-               $htmlForm->setSubmitText( 'View Task' );
+               $htmlForm->setSubmitText( wfMessage( 
'massaction-view-task-submit' )->parse() );
                $htmlForm->setTitle(
                                Title::newFromText( 'MassAction/View/', 
NS_SPECIAL )
                );
@@ -154,43 +154,46 @@
 
                if ( is_null( $task ) ) {
                        //TODO easy form to allow entering of task ID to view 
task? (Or list of tasks?)
-                       $this->getOutput()->setPageTitle( 'View Task' );
-                       $this->getOutput()->addWikiText( 'No task exists with 
the id: ' . $taskId );
+                       $this->getOutput()->setPageTitle( wfMessage( 
'massaction-view-task-title' )->parse() );
+                       $this->getOutput()->addWikiText( wfMessage( 
'massaction-view-task-no-tasks', $taskId )->parse() );
 
                        return;
                }
 
-               $this->getOutput()->setPageTitle( 'Task ' . $taskId );
+               $this->getOutput()->setPageTitle( wfMessage( 
'massaction-view-task-id', $taskId )->parse() );
 
                $html = '';
                $html .= Html::element(
                        'p',
                        array( 'id' => 'ma-summary' ),
-                       'Summary: ' . $task->getSummary()
+                       wfMessage( 'massaction-view-task-summary', 
$task->getSummary() )->parse()
                );
                $html .= Html::element(
                        'p',
                        array( 'id' => 'ma-user' ),
-                       'User: ' . User::newFromId( $task->getUserId() 
)->getName()
+                       wfMessage( 'massaction-view-task-user', 
User::newFromId( $task->getUserId() )->getName() )
                );
                $html .= Html::element(
                        'p',
                        array( 'id' => 'ma-targettype' ),
-                       'Target Type: ' . ucfirst( $task->getTargetType() )
+                       wfMessage( 'massaction-view-task-target-type', ucfirst( 
$task->getTargetType() ) )->parse()
                );
                $html .= Html::element(
                        'p',
                        array( 'id' => 'ma-datecreated' ),
-                       'Date Created: ' . $task->getDateCreated()
+                       wfMessage( 'massaction-view-task-date-created', 
$task->getDateCreated() )->parse()
                );
                $html .= Html::element(
                        'p',
                        array( 'id' => 'ma-state' ),
-                       'State: ' . $task->getStateString()
+                       wfMessage( 'massaction-view-task-state', 
$task->getStateString() )->parse()
                );
 
                $actions = $task->getActions()->toArray();
-               $html .= Html::element( 'h2', array(), 'Actions (' . count( 
$actions ) . ')' );
+               $html .= Html::element( 'h2', array(), wfMessage(
+                   'massaction-view-task-actions',
+            $actions
+        )->parse() );
                $html .= Html::openElement( 'ul', array( 'id' => 'ma-actions' ) 
);
                foreach ( $actions as $action ) {
                        $html .= Html::element(
@@ -202,7 +205,10 @@
                $html .= Html::closeElement( 'ul' );
 
                $matchers = $task->getMatchers()->toArray();
-               $html .= Html::element( 'h2', array(), 'Matchers (' . count( 
$matchers ) . ')' );
+               $html .= Html::element( 'h2', array(), wfMessage(
+                   'massaction-view-task-matchers',
+            $matchers
+        )->parse() );
                $html .= Html::openElement( 'ul', array( 'id' => 'ma-matchers' 
) );
                foreach ( $matchers as $matcher ) {
                        $html .= Html::element(
@@ -215,7 +221,10 @@
 
                $targets = $db->getTargetsForTask( $task );
 
-               $html .= Html::element( 'h2', array(), 'Targets (' . count( 
$targets ) . ')' );
+               $html .= Html::element( 'h2', array(), wfMessage(
+                   'massaction-view-task-targets',
+            $targets
+        )->parse() );
 
                if ( $task->getState() == Task::S_TARGETS_FOUND ) {
                        $changeForm = new HTMLForm(
@@ -234,7 +243,7 @@
                        $changeForm->setTitle(
                                Title::newFromText( 'MassAction/View/' . 
$task->getId(), NS_SPECIAL )
                        );
-                       $changeForm->setSubmitText( 'Save All' );
+                       $changeForm->setSubmitText( wfMessage( 
'massaction-view-task-save-all' )->parse() );
                        $changeForm->prepareForm();
                        $html .= $changeForm->getHtml( '' );
                }
@@ -243,9 +252,9 @@
                $html .= Html::rawElement(
                        'tr',
                        array(),
-                       Html::element( 'th', array(), 'Identifier' ) .
-                       Html::element( 'th', array(), 'Name' ) .
-                       Html::element( 'th', array(), 'State' )
+                       Html::element( 'th', array(), wfMessage( 
'massaction-view-task-target-identifier' )->parse() ) .
+                       Html::element( 'th', array(), wfMessage( 
'massaction-view-task-target-name' )->parse() ) .
+                       Html::element( 'th', array(), wfMessage( 
'massaction-view-task-target-name' )->parse() )
                );
                foreach ( $targets as $target ) {
                        $saveTargetButtonHtml = '';
@@ -268,7 +277,7 @@
                                $changeForm->setTitle(
                                        Title::newFromText( 'MassAction/View/' 
. $task->getId(), NS_SPECIAL )
                                );
-                               $changeForm->setSubmitText( 'Save' );
+                               $changeForm->setSubmitText( wfMessage( 
'massaction-view-task-target-save' )->parse() );
                                $changeForm->prepareForm();
                                $saveTargetButtonHtml = $changeForm->getHtml( 
'' );
                        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4129f57f465dc7fad40d8883e207b7456db3ddd7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MassAction
Gerrit-Branch: master
Gerrit-Owner: Albert221 <w.albert...@gmail.com>

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

Reply via email to