1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

PHT's on Audit and Macro

Summary:
Went through some files and pht'd some stuff while the kid was in the bath.

LINT

Test Plan: Doinked all over each of these apps, didn't spot anything out of the ordinary.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4613
This commit is contained in:
Chad Little 2013-01-23 19:36:23 -08:00
parent 3440892d7b
commit 99e7810572
9 changed files with 79 additions and 74 deletions

View file

@ -3,7 +3,7 @@
final class PhabricatorApplicationAudit extends PhabricatorApplication { final class PhabricatorApplicationAudit extends PhabricatorApplication {
public function getShortDescription() { public function getShortDescription() {
return 'Audit Code'; return pht('Audit Code');
} }
public function getBaseURI() { public function getBaseURI() {

View file

@ -6,7 +6,7 @@ abstract class PhabricatorAuditController extends PhabricatorController {
$page = $this->buildStandardPageView(); $page = $this->buildStandardPageView();
$page->setApplicationName('Audit'); $page->setApplicationName(pht('Audit'));
$page->setBaseURI('/audit/'); $page->setBaseURI('/audit/');
$page->setTitle(idx($data, 'title')); $page->setTitle(idx($data, 'title'));
$page->setGlyph("\xE2\x9C\x8D"); $page->setGlyph("\xE2\x9C\x8D");

View file

@ -49,13 +49,13 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
if (!$handle) { if (!$handle) {
switch ($this->filter) { switch ($this->filter) {
case 'project': case 'project':
$title = 'Choose A Project'; $title = pht('Choose A Project');
$message = 'Choose a project to view audits for.'; $message = pht('Choose a project to view audits for.');
break; break;
case 'package': case 'package':
case 'packagecommits': case 'packagecommits':
$title = 'Choose a Package'; $title = pht('Choose a Package');
$message = 'Choose a package to view audits for.'; $message = pht('Choose a package to view audits for.');
break; break;
} }
} }
@ -73,26 +73,26 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
$nav, $nav,
array( array(
'title' => 'Audits', 'title' => pht('Audits'),
)); ));
} }
private function buildNavAndSelectFilter() { private function buildNavAndSelectFilter() {
$nav = new AphrontSideNavFilterView(); $nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/audit/view/')); $nav->setBaseURI(new PhutilURI('/audit/view/'));
$nav->addLabel('Active'); $nav->addLabel(pht('Active'));
$nav->addFilter('active', 'Need Attention'); $nav->addFilter('active', pht('Need Attention'));
$nav->addLabel('Audits'); $nav->addLabel(pht('Audits'));
$nav->addFilter('audits', 'All'); $nav->addFilter('audits', pht('All'));
$nav->addFilter('user', 'By User'); $nav->addFilter('user', pht('By User'));
$nav->addFilter('project', 'By Project'); $nav->addFilter('project', pht('By Project'));
$nav->addFilter('package', 'By Package'); $nav->addFilter('package', pht('By Package'));
$nav->addLabel('Commits'); $nav->addLabel(pht('Commits'));
$nav->addFilter('commits', 'All'); $nav->addFilter('commits', pht('All'));
$nav->addFilter('author', 'By Author'); $nav->addFilter('author', pht('By Author'));
$nav->addFilter('packagecommits', 'By Package'); $nav->addFilter('packagecommits', pht('By Package'));
$this->filter = $nav->selectFilter($this->filter, 'active'); $this->filter = $nav->selectFilter($this->filter, 'active');
@ -138,13 +138,13 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
if ($show_user || $show_project || $show_package) { if ($show_user || $show_project || $show_package) {
if ($show_user) { if ($show_user) {
$uri = '/typeahead/common/users/'; $uri = '/typeahead/common/users/';
$label = 'User'; $label = pht('User');
} else if ($show_project) { } else if ($show_project) {
$uri = '/typeahead/common/projects/'; $uri = '/typeahead/common/projects/';
$label = 'Project'; $label = pht('Project');
} else if ($show_package) { } else if ($show_package) {
$uri = '/typeahead/common/packages/'; $uri = '/typeahead/common/packages/';
$label = 'Package'; $label = pht('Package');
} }
$tok_value = null; $tok_value = null;
@ -167,19 +167,19 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
$form->appendChild( $form->appendChild(
id(new AphrontFormToggleButtonsControl()) id(new AphrontFormToggleButtonsControl())
->setName('status') ->setName('status')
->setLabel('Status') ->setLabel(pht('Status'))
->setBaseURI($request->getRequestURI(), 'status') ->setBaseURI($request->getRequestURI(), 'status')
->setValue($this->filterStatus) ->setValue($this->filterStatus)
->setButtons( ->setButtons(
array( array(
'all' => 'All', 'all' => pht('All'),
'open' => 'Open', 'open' => pht('Open'),
))); )));
} }
$form->appendChild( $form->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Filter Audits')); ->setValue(pht('Filter Audits')));
$view = new AphrontListFilterView(); $view = new AphrontListFilterView();
$view->appendChild($form); $view->appendChild($form);
@ -342,24 +342,24 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
switch ($this->filter) { switch ($this->filter) {
case 'active': case 'active':
$header = 'Required Audits'; $header = pht('Required Audits');
$nodata = 'No commits require your audit.'; $nodata = pht('No commits require your audit.');
break; break;
case 'user': case 'user':
$header = "Audits for {$handle_name}"; $header = pht("Audits for %s", $handle_name);
$nodata = "No matching audits by {$handle_name}."; $nodata = pht("No matching audits by %s.", $handle_name);
break; break;
case 'audits': case 'audits':
$header = "Audits"; $header = pht('Audits');
$nodata = "No matching audits."; $nodata = pht('No matching audits.');
break; break;
case 'project': case 'project':
$header = "Audits in Project '{$handle_name}'"; $header = pht("Audits in Project %s", $handle_name);
$nodata = "No matching audits in project '{$handle_name}'."; $nodata = pht("No matching audits in project %s.", $handle_name);
break; break;
case 'package': case 'package':
$header = "Audits for Package '{$handle_name}'"; $header = pht("Audits for Package %s", $handle_name);
$nodata = "No matching audits in package '{$handle_name}'."; $nodata = pht("No matching audits in package %s.", $handle_name);
break; break;
} }
@ -442,20 +442,20 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
switch ($this->filter) { switch ($this->filter) {
case 'active': case 'active':
$header = 'Problem Commits'; $header = pht('Problem Commits');
$nodata = 'None of your commits have open concerns.'; $nodata = pht('None of your commits have open concerns.');
break; break;
case 'author': case 'author':
$header = "Commits by {$handle_name}"; $header = pht("Commits by %s", $handle_name);
$nodata = "No matching commits by {$handle_name}."; $nodata = pht("No matching commits by %s.", $handle_name);
break; break;
case 'commits': case 'commits':
$header = "Commits"; $header = pht("Commits");
$nodata = "No matching commits."; $nodata = pht("No matching commits.");
break; break;
case 'packagecommits': case 'packagecommits':
$header = "Commits in Package '{$handle_name}'"; $header = pht("Commits in Package %s", $handle_name);
$nodata = "No matching commits in package '{$handle_name}'."; $nodata = pht("No matching commits in package %s.", $handle_name);
break; break;
} }

View file

@ -7,7 +7,7 @@ final class PhabricatorApplicationMacro extends PhabricatorApplication {
} }
public function getShortDescription() { public function getShortDescription() {
return 'Image Macros and Memes'; return pht('Image Macros and Memes');
} }
public function getIconName() { public function getIconName() {

View file

@ -8,14 +8,18 @@ abstract class PhabricatorMacroController
$nav->setBaseURI(new PhutilURI($this->getApplicationURI())); $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
if ($for_app) { if ($for_app) {
$nav->addLabel('Create'); $nav->addLabel(pht('Create'));
$nav->addFilter('', 'Create Macro', $this->getApplicationURI('/create/')); $nav->addFilter('',
pht('Create Macro'),
$this->getApplicationURI('/create/'));
} }
$nav->addLabel('Macros'); $nav->addLabel(pht('Macros'));
$nav->addFilter('/', 'All Macros'); $nav->addFilter('/', pht('All Macros'));
if ($has_search) { if ($has_search) {
$nav->addFilter('search', 'Search', $this->getRequest()->getRequestURI()); $nav->addFilter('search',
pht('Search'),
$this->getRequest()->getRequestURI());
} }

View file

@ -42,13 +42,13 @@ final class PhabricatorMacroDisableController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog $dialog
->setUser($request->getUser()) ->setUser($request->getUser())
->setTitle('Really disable macro?') ->setTitle(pht('Really disable macro?'))
->appendChild( ->appendChild(
'<p>Really disable the much-beloved image macro "'. '<p>'.pht('Really disable the much-beloved image macro %s? '.
phutil_escape_html($macro->getName()).'"? It will be sorely missed.'. 'It will be sorely missed.', phutil_escape_html($macro->getName())).
'</p>') '</p>')
->setSubmitURI($this->getApplicationURI('/disable/'.$this->id.'/')) ->setSubmitURI($this->getApplicationURI('/disable/'.$this->id.'/'))
->addSubmitButton('Disable') ->addSubmitButton(pht('Disable'))
->addCancelButton($view_uri); ->addCancelButton($view_uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -37,13 +37,13 @@ final class PhabricatorMacroEditController
$macro->setName($new_name); $macro->setName($new_name);
if (!strlen($macro->getName())) { if (!strlen($macro->getName())) {
$errors[] = 'Macro name is required.'; $errors[] = pht('Macro name is required.');
$e_name = 'Required'; $e_name = pht('Required');
} else if (!preg_match('/^[a-z0-9_-]{3,}$/', $macro->getName())) { } else if (!preg_match('/^[a-z0-9_-]{3,}$/', $macro->getName())) {
$errors[] = 'Macro must be at least three characters long and '. $errors[] = pht('Macro must be at least three characters long and '.
'contain only lowercase letters, digits, hyphen and '. 'contain only lowercase letters, digits, hyphen and '.
'underscore.'; 'underscore.');
$e_name = 'Invalid'; $e_name = pht('Invalid');
} else { } else {
$e_name = null; $e_name = null;
} }
@ -74,7 +74,7 @@ final class PhabricatorMacroEditController
} }
if (!$macro->getID() && !$file) { if (!$macro->getID() && !$file) {
$errors[] = 'You must upload an image to create a macro.'; $errors[] = pht('You must upload an image to create a macro.');
$e_file = pht('Required'); $e_file = pht('Required');
} }
@ -110,15 +110,15 @@ final class PhabricatorMacroEditController
return id(new AphrontRedirectResponse())->setURI($view_uri); return id(new AphrontRedirectResponse())->setURI($view_uri);
} catch (AphrontQueryDuplicateKeyException $ex) { } catch (AphrontQueryDuplicateKeyException $ex) {
throw $ex; throw $ex;
$errors[] = 'Macro name is not unique!'; $errors[] = pht('Macro name is not unique!');
$e_name = 'Duplicate'; $e_name = pht('Duplicate');
} }
} }
} }
if ($errors) { if ($errors) {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle('Form Errors'); $error_view->setTitle(pht('Form Errors'));
$error_view->setErrors($errors); $error_view->setErrors($errors);
} else { } else {
$error_view = null; $error_view = null;
@ -141,10 +141,11 @@ final class PhabricatorMacroEditController
->setEncType('multipart/form-data') ->setEncType('multipart/form-data')
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Name') ->setLabel(pht('Name'))
->setName('name') ->setName('name')
->setValue($macro->getName()) ->setValue($macro->getName())
->setCaption('This word or phrase will be replaced with the image.') ->setCaption(
pht('This word or phrase will be replaced with the image.'))
->setError($e_name)); ->setError($e_name));
if (!$macro->getID()) { if (!$macro->getID()) {
@ -158,7 +159,7 @@ final class PhabricatorMacroEditController
$form->addHiddenInput('phid', $current_file->getPHID()); $form->addHiddenInput('phid', $current_file->getPHID());
$form->appendChild( $form->appendChild(
id(new AphrontFormMarkupControl()) id(new AphrontFormMarkupControl())
->setLabel('Selected File') ->setLabel(pht('Selected File'))
->setValue($current_file_view)); ->setValue($current_file_view));
$other_label = pht('Change File'); $other_label = pht('Change File');
@ -223,11 +224,11 @@ final class PhabricatorMacroEditController
->setUser($request->getUser()) ->setUser($request->getUser())
->appendChild( ->appendChild(
id(new AphrontFormFileControl()) id(new AphrontFormFileControl())
->setLabel('File') ->setLabel(pht('File'))
->setName('file')) ->setName('file'))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Upload File')); ->setValue(pht('Upload File')));
$upload = array($upload_header, $upload_form); $upload = array($upload_header, $upload_form);
} }

View file

@ -90,7 +90,7 @@ final class PhabricatorMacroListController
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setName('name') ->setName('name')
->setLabel('Name') ->setLabel(pht('Name'))
->setValue($filter)) ->setValue($filter))
->appendChild( ->appendChild(
id(new AphrontFormTokenizerControl()) id(new AphrontFormTokenizerControl())
@ -100,7 +100,7 @@ final class PhabricatorMacroListController
->setValue(mpull($author_handles, 'getFullName'))) ->setValue(mpull($author_handles, 'getFullName')))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Filter Image Macros')); ->setValue(pht('Filter Image Macros')));
$filter_view = new AphrontListFilterView(); $filter_view = new AphrontListFilterView();
$filter_view->appendChild($filter_form); $filter_view->appendChild($filter_form);
@ -132,7 +132,7 @@ final class PhabricatorMacroListController
phutil_render_tag( phutil_render_tag(
'div', 'div',
array(), array(),
'Created on '.$datetime)); pht('Created on %s', $datetime)));
} }
$item->setURI($this->getApplicationURI('/view/'.$macro->getID().'/')); $item->setURI($this->getApplicationURI('/view/'.$macro->getID().'/'));
$item->setHeader($macro->getName()); $item->setHeader($macro->getName());
@ -159,7 +159,7 @@ final class PhabricatorMacroListController
$nav, $nav,
array( array(
'device' => true, 'device' => true,
'title' => 'Image Macros', 'title' => pht('Image Macros'),
)); ));
} }
} }

View file

@ -112,21 +112,21 @@ final class PhabricatorMacroViewController
$view->setObject($macro); $view->setObject($macro);
$view->addAction( $view->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName('Edit Macro') ->setName(pht('Edit Macro'))
->setHref($this->getApplicationURI('/edit/'.$macro->getID().'/')) ->setHref($this->getApplicationURI('/edit/'.$macro->getID().'/'))
->setIcon('edit')); ->setIcon('edit'));
if ($macro->getIsDisabled()) { if ($macro->getIsDisabled()) {
$view->addAction( $view->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName('Restore Macro') ->setName(pht('Restore Macro'))
->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/')) ->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/'))
->setWorkflow(true) ->setWorkflow(true)
->setIcon('undo')); ->setIcon('undo'));
} else { } else {
$view->addAction( $view->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName('Disable Macro') ->setName(pht('Disable Macro'))
->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/')) ->setHref($this->getApplicationURI('/disable/'.$macro->getID().'/'))
->setWorkflow(true) ->setWorkflow(true)
->setIcon('delete')); ->setIcon('delete'));