From 00fb8c22e414a22119eeba6cb00d3437cf0ebf9a Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Mon, 4 Nov 2013 11:38:28 -0800 Subject: [PATCH] Decentralize phtize Summary: The idea is to have all `phtize` definitions in applications to allow their separation. Test Plan: Clicked View Options after mangling the translation. Reviewers: epriestley Reviewed By: epriestley CC: btrahan, Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7345 --- .../view/DifferentialChangesetListView.php | 16 +++++++++- src/infrastructure/javelin/Javelin.php | 30 ------------------- .../control/PhabricatorRemarkupControl.php | 14 ++++++++- 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index 79203f165b..ca05bf97b0 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -114,7 +114,21 @@ final class DifferentialChangesetListView extends AphrontView { )); Javelin::initBehavior( 'differential-dropdown-menus', - array()); + array( + 'pht' => array( + 'Open in Editor' => pht('Open in Editor'), + 'Show Entire File' => pht('Show Entire File'), + 'Entire File Shown' => pht('Entire File Shown'), + "Can't Toggle Unloaded File" => pht("Can't Toggle Unloaded File"), + 'Expand File' => pht('Expand File'), + 'Collapse File' => pht('Collapse File'), + 'Browse in Diffusion' => pht('Browse in Diffusion'), + 'View Standalone' => pht('View Standalone'), + 'Show Raw File (Left)' => pht('Show Raw File (Left)'), + 'Show Raw File (Right)' => pht('Show Raw File (Right)'), + 'Configure Editor' => pht('Configure Editor'), + ), + )); $output = array(); $mapping = array(); diff --git a/src/infrastructure/javelin/Javelin.php b/src/infrastructure/javelin/Javelin.php index 686f6e1c67..922cd45e83 100644 --- a/src/infrastructure/javelin/Javelin.php +++ b/src/infrastructure/javelin/Javelin.php @@ -3,36 +3,6 @@ final class Javelin { public static function initBehavior($behavior, array $config = array()) { - switch ($behavior) { - case 'differential-dropdown-menus': - $config['pht'] = array( - 'Open in Editor' => pht('Open in Editor'), - 'Show Entire File' => pht('Show Entire File'), - 'Entire File Shown' => pht('Entire File Shown'), - "Can't Toggle Unloaded File" => pht("Can't Toggle Unloaded File"), - 'Expand File' => pht('Expand File'), - 'Collapse File' => pht('Collapse File'), - 'Browse in Diffusion' => pht('Browse in Diffusion'), - 'View Standalone' => pht('View Standalone'), - 'Show Raw File (Left)' => pht('Show Raw File (Left)'), - 'Show Raw File (Right)' => pht('Show Raw File (Right)'), - 'Configure Editor' => pht('Configure Editor'), - ); - break; - - case 'phabricator-remarkup-assist': - $config['pht'] = array( - 'bold text' => pht('bold text'), - 'italic text' => pht('italic text'), - 'monospaced text' => pht('monospaced text'), - 'List Item' => pht('List Item'), - 'data' => pht('data'), - 'name' => pht('name'), - 'URL' => pht('URL'), - ); - break; - } - $response = CelerityAPI::getStaticResourceResponse(); $response->initBehavior($behavior, $config); } diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 7d873466df..7fb0ad3e44 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -27,7 +27,19 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { 'uri' => '/file/dropupload/', )); - Javelin::initBehavior('phabricator-remarkup-assist', array()); + Javelin::initBehavior( + 'phabricator-remarkup-assist', + array( + 'pht' => array( + 'bold text' => pht('bold text'), + 'italic text' => pht('italic text'), + 'monospaced text' => pht('monospaced text'), + 'List Item' => pht('List Item'), + 'data' => pht('data'), + 'name' => pht('name'), + 'URL' => pht('URL'), + ), + )); Javelin::initBehavior('phabricator-tooltips', array()); $actions = array(