diff --git a/src/applications/diviner/atom/DivinerAtom.php b/src/applications/diviner/atom/DivinerAtom.php index 22b0618162..b87a44bb31 100644 --- a/src/applications/diviner/atom/DivinerAtom.php +++ b/src/applications/diviner/atom/DivinerAtom.php @@ -5,6 +5,9 @@ final class DivinerAtom { const TYPE_FILE = 'file'; const TYPE_ARTICLE = 'article'; const TYPE_METHOD = 'method'; + const TYPE_CLASS = 'class'; + const TYPE_FUNCTION = 'function'; + const TYPE_INTERFACE = 'interface'; private $type; private $name; @@ -357,18 +360,42 @@ final class DivinerAtom { public static function getThisAtomIsNotDocumentedString($type) { switch ($type) { - case 'function': + case self::TYPE_FILE: + return pht('This file is not documented.'); + case self::TYPE_FUNCTION: return pht('This function is not documented.'); - case 'class': + case self::TYPE_CLASS: return pht('This class is not documented.'); - case 'article': + case self::TYPE_ARTICLE: return pht('This article is not documented.'); - case 'method': + case self::TYPE_METHOD: return pht('This method is not documented.'); + case self::TYPE_INTERFACE: + return pht('This interface is not documented.'); default: phlog("Need translation for '{$type}'."); return pht('This %s is not documented.', $type); } } + public static function getAtomTypeNameString($type) { + switch ($type) { + case self::TYPE_FILE: + return pht('File'); + case self::TYPE_FUNCTION: + return pht('Function'); + case self::TYPE_CLASS: + return pht('Class'); + case self::TYPE_ARTICLE: + return pht('Article'); + case self::TYPE_METHOD: + return pht('Method'); + case self::TYPE_INTERFACE: + return pht('Interface'); + default: + phlog("Need translation for '{$type}'."); + return ucwords($type); + } + } + } diff --git a/src/applications/diviner/controller/DivinerAtomController.php b/src/applications/diviner/controller/DivinerAtomController.php index 54d5f4c5dd..d381a53d03 100644 --- a/src/applications/diviner/controller/DivinerAtomController.php +++ b/src/applications/diviner/controller/DivinerAtomController.php @@ -89,7 +89,7 @@ final class DivinerAtomController extends DivinerController { id(new PhabricatorTagView()) ->setType(PhabricatorTagView::TYPE_STATE) ->setBackgroundColor(PhabricatorTagView::COLOR_BLUE) - ->setName($this->renderAtomTypeName($atom->getType()))); + ->setName(DivinerAtom::getAtomTypeNameString($atom->getType()))); $properties = id(new PhabricatorPropertyListView()); @@ -208,10 +208,6 @@ final class DivinerAtomController extends DivinerController { )); } - private function renderAtomTypeName($name) { - return phutil_utf8_ucwords($name); - } - private function buildExtendsAndImplements( PhabricatorPropertyListView $view, DivinerLiveSymbol $symbol) { diff --git a/src/applications/diviner/controller/DivinerController.php b/src/applications/diviner/controller/DivinerController.php index 2622e05368..8e116d110a 100644 --- a/src/applications/diviner/controller/DivinerController.php +++ b/src/applications/diviner/controller/DivinerController.php @@ -34,7 +34,9 @@ abstract class DivinerController extends PhabricatorController { $item = id(new PhabricatorObjectItemView()) ->setHeader($symbol->getTitle()) ->setHref($symbol->getURI()) - ->addIcon('none', $symbol->getType()); + ->addIcon('none', + DivinerAtom::getAtomTypeNameString( + $symbol->getType())); $item->addAttribute(phutil_safe_html($symbol->getSummary()));