From 7498aec194ecf2d333e0e2eaddd9d5cdf922d7f1 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Sat, 2 Nov 2013 08:43:53 -0700 Subject: [PATCH] Fix Phriction email language Summary: This adds pht's and such english to Phriction email body. Test Plan: Edited a Document, Moved a Document. Got new emails. Such Wow. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7477 --- .../editor/PhrictionDocumentEditor.php | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/applications/phriction/editor/PhrictionDocumentEditor.php b/src/applications/phriction/editor/PhrictionDocumentEditor.php index 55c0c50a5f..effeda2203 100644 --- a/src/applications/phriction/editor/PhrictionDocumentEditor.php +++ b/src/applications/phriction/editor/PhrictionDocumentEditor.php @@ -286,6 +286,22 @@ final class PhrictionDocumentEditor extends PhabricatorEditor { return $this; } + private function getChangeTypeDescription($const, $title) { + $map = array( + PhrictionChangeType::CHANGE_EDIT => + pht("Phriction Document %s was edited.", $title), + PhrictionChangeType::CHANGE_DELETE => + pht("Phriction Document %s was deleted.", $title), + PhrictionChangeType::CHANGE_MOVE_HERE => + pht("Phriction Document %s was moved here.", $title), + PhrictionChangeType::CHANGE_MOVE_AWAY => + pht("Phriction Document %s was moved away.", $title), + PhrictionChangeType::CHANGE_STUB => + pht("Phriction Document %s was created through child.", $title), + ); + return idx($map, $const, pht('Something magical occurred.')); + } + private function sendMailToSubscribers(array $subscribers, $old_content) { if (!$subscribers) { return; @@ -304,14 +320,9 @@ final class PhrictionDocumentEditor extends PhabricatorEditor { $old_title = $old_content->getTitle(); $title = $content->getTitle(); - - // TODO: Currently, this produces something like - // Phriction Document Xyz was Edit - // I'm too lazy to build my own action string everywhere - // Plus, it does not have pht() anyway + $name = $this->getChangeTypeDescription($content->getChangeType(), $title); $action = PhrictionChangeType::getChangeTypeLabel( $content->getChangeType()); - $name = pht("Phriction Document %s was %s", $title, $action); $body = array($name); // Content may have changed, you never know