KartikMistry has uploaded a new change for review.

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


Change subject: Added new log subtype for message key instead of hard coded text
......................................................................

Added new log subtype for message key instead of hard coded text

Bug: 58707
Change-Id: I865c0ca1ba6395f5af9d60bc32e17a1d91a1183a
---
M Translate.php
M _autoload.php
M api/ApiTranslateSandbox.php
M i18n/sandbox/en.json
M i18n/sandbox/qqq.json
A utils/PromotedSandboxUsersLogFormatter.php
6 files changed, 43 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/96/104796/1

diff --git a/Translate.php b/Translate.php
index b54ccb2..4e16295 100644
--- a/Translate.php
+++ b/Translate.php
@@ -220,6 +220,8 @@
 $wgLogActionsHandlers['translatorsandbox/promoted'] = 'TranslateLogFormatter';
 $wgLogActionsHandlers['translatorsandbox/rejected'] = 'TranslateLogFormatter';
 
+$wgLogActionsHandlers['newusers/tsbpromoted'] = 
'PromotedSandboxUsersLogFormatter';
+
 // New jobs
 $wgJobClasses['MessageIndexRebuildJob'] = 'MessageIndexRebuildJob';
 $wgJobClasses['MessageUpdateJob'] = 'MessageUpdateJob';
diff --git a/_autoload.php b/_autoload.php
index d8cf84b..2d02bff 100644
--- a/_autoload.php
+++ b/_autoload.php
@@ -97,6 +97,8 @@
 $wgAutoloadClasses['StringMatcher'] = "$dir/utils/StringMatcher.php";
 $wgAutoloadClasses['TTMServer'] = "$dir/utils/TTMServer.php";
 $wgAutoloadClasses['TranslateLogFormatter'] = 
"$dir/utils/TranslateLogFormatter.php";
+$wgAutoloadClasses['PromotedSandboxUsersLogFormatter'] =
+       "$dir/utils/PromotedSandboxUsersLogFormatter.php";
 $wgAutoloadClasses['TranslateMetadata'] = "$dir/utils/TranslateMetadata.php";
 $wgAutoloadClasses['TranslatePerLanguageStats'] = 
"$dir/specials/SpecialTranslationStats.php";
 $wgAutoloadClasses['TranslatePreferences'] = "$dir/utils/UserToggles.php";
diff --git a/api/ApiTranslateSandbox.php b/api/ApiTranslateSandbox.php
index 0b956b5..947bbe0 100644
--- a/api/ApiTranslateSandbox.php
+++ b/api/ApiTranslateSandbox.php
@@ -132,10 +132,7 @@
                        $logEntry->publish( $logid );
 
                        global $wgContLang;
-                       $user->addNewUserLogEntry(
-                               'create',
-                               $this->msg( 'tsb-promoted-from-sandbox' 
)->inLanguage( $wgContLang )->text()
-                       );
+                       $user->addNewUserLogEntry( 'tsbpromoted' );
                        $this->createUserPage( $user );
                }
        }
diff --git a/i18n/sandbox/en.json b/i18n/sandbox/en.json
index cafe244..b1ee748 100644
--- a/i18n/sandbox/en.json
+++ b/i18n/sandbox/en.json
@@ -48,6 +48,7 @@
     "tsb-create-user-page": "Create basic user page",
     "log-name-translatorsandbox": "Translation sandbox",
     "log-description-translatorsandbox": "A log of actions on translation 
sandbox users",
+    "logentry-newusers-tsbpromoted": "User account $3 was 
{{GENDER:$2|created}}",
     "logentry-translatorsandbox-promoted": "$1 {{GENDER:$2|promoted}} $3 to 
{{GENDER:$4|translator}}",
     "logentry-translatorsandbox-rejected": "$1 {{GENDER:$2|rejected}} the 
request from \"$3\" to become a translator"
 }
diff --git a/i18n/sandbox/qqq.json b/i18n/sandbox/qqq.json
index 302afba..f6db5e4 100644
--- a/i18n/sandbox/qqq.json
+++ b/i18n/sandbox/qqq.json
@@ -49,6 +49,7 @@
     "tsb-create-user-page": "Edit summary for user page creation once approved 
as translator. Will be in content language.",
     "log-name-translatorsandbox": "{{doc-logpage}}",
     "log-description-translatorsandbox": "Log page description",
+    "logentry-newusers-tsbpromoted": 
"{{logentry|[[Special:Log/newusers]]}}\nLogentry for users promoted from 
translator sandbox.\n$2 is the gender of the creator.",
     "logentry-translatorsandbox-promoted": "{{logentry}}\n* $4 - The name of 
the user that was promoted, can be used for GENDER.",
     "logentry-translatorsandbox-rejected": "{{logentry}}"
 }
\ No newline at end of file
diff --git a/utils/PromotedSandboxUsersLogFormatter.php 
b/utils/PromotedSandboxUsersLogFormatter.php
new file mode 100644
index 0000000..cbdd85c
--- /dev/null
+++ b/utils/PromotedSandboxUsersLogFormatter.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Formatter for promoted sandbox users log entries based on 
NewUsersLogFormatter.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @author Kartik Mistry
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
+ * @since 2014.01
+ */
+
+/**
+ * This class formats new user log entries for users promoted from sandbox.
+ *
+ * @since 2014.01
+ */
+class PromotedSandboxUsersLogFormatter extends NewUsersLogFormatter {
+       public function getComment() {
+               $comment = $this->msg( 'tsb-promoted-from-sandbox' )->text();
+               return $this->msg( 'parentheses' )->params( $comment )->text();
+       }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I865c0ca1ba6395f5af9d60bc32e17a1d91a1183a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <kartik.mis...@gmail.com>

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

Reply via email to