From d57cc740ca297deada7d5e12ca82f1cc1dd5b4f9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 9 Dec 2015 08:59:16 -0800 Subject: [PATCH] Clean up some custom field strings in Feed Summary: Fixes T9919. We were missing feed strings and US English localizations for some of this stuff. Test Plan: Before: {F1018877} After: {F1018879} {F1018880} {F1018881} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9919 Differential Revision: https://secure.phabricator.com/D14721 --- .../PhabricatorStandardCustomFieldPHIDs.php | 40 +++++++++++++++++++ .../PhabricatorUSEnglishTranslation.php | 18 +++++++++ 2 files changed, 58 insertions(+) diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php index 216c7ccb63..855cf2b4a0 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php @@ -145,6 +145,46 @@ abstract class PhabricatorStandardCustomFieldPHIDs } } + public function getApplicationTransactionTitleForFeed( + PhabricatorApplicationTransaction $xaction) { + $author_phid = $xaction->getAuthorPHID(); + $object_phid = $xaction->getObjectPHID(); + + $old = $this->decodeValue($xaction->getOldValue()); + $new = $this->decodeValue($xaction->getNewValue()); + + $add = array_diff($new, $old); + $rem = array_diff($old, $new); + + if ($add && !$rem) { + return pht( + '%s updated %s for %s, added %d: %s.', + $xaction->renderHandleLink($author_phid), + $this->getFieldName(), + $xaction->renderHandleLink($object_phid), + phutil_count($add), + $xaction->renderHandleList($add)); + } else if ($rem && !$add) { + return pht( + '%s updated %s for %s, removed %s: %s.', + $xaction->renderHandleLink($author_phid), + $this->getFieldName(), + $xaction->renderHandleLink($object_phid), + phutil_count($rem), + $xaction->renderHandleList($rem)); + } else { + return pht( + '%s updated %s for %s, added %s: %s; removed %s: %s.', + $xaction->renderHandleLink($author_phid), + $this->getFieldName(), + $xaction->renderHandleLink($object_phid), + phutil_count($add), + $xaction->renderHandleList($add), + phutil_count($rem), + $xaction->renderHandleList($rem)); + } + } + public function validateApplicationTransactions( PhabricatorApplicationTransactionEditor $editor, $type, diff --git a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php index 1648d6608d..3c23491a4f 100644 --- a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php @@ -1483,6 +1483,24 @@ final class PhabricatorUSEnglishTranslation 'repositories for updates yet.', ), + + '%s updated %s, added %d: %s.' => + '%s updated %s, added: %4$s.', + + '%s updated %s, removed %s: %s.' => + '%s updated %s, removed: %4$s.', + + '%s updated %s, added %s: %s; removed %s: %s.' => + '%s updated %s, added: %4$s; removed: %6$s.', + + '%s updated %s for %s, added %d: %s.' => + '%s updated %s for %s, added: %5$s.', + + '%s updated %s for %s, removed %s: %s.' => + '%s updated %s for %s, removed: %5$s.', + + '%s updated %s for %s, added %s: %s; removed %s: %s.' => + '%s updated %s for %s, added: %5$s; removed; %7$s.', ); }