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

pht for phriction

Summary: Scan all phriction app files for text to pht

Test Plan: Use phriction in ALL CAPS, seems reasonably usable.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4862
This commit is contained in:
Chad Little 2013-02-08 09:54:27 -08:00
parent 9c19e9b7d8
commit 51dfeb7950
9 changed files with 75 additions and 72 deletions

View file

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

View file

@ -9,7 +9,7 @@ abstract class PhrictionController extends PhabricatorController {
$page = $this->buildStandardPageView(); $page = $this->buildStandardPageView();
$page->setApplicationName('Phriction'); $page->setApplicationName(pht('Phriction'));
$page->setBaseURI('/w/'); $page->setBaseURI('/w/');
$page->setTitle(idx($data, 'title')); $page->setTitle(idx($data, 'title'));
$page->setGlyph("\xE2\x9A\xA1"); $page->setGlyph("\xE2\x9A\xA1");
@ -32,7 +32,7 @@ abstract class PhrictionController extends PhabricatorController {
$nav->addFilter('', pht('Create Document'), '/phriction/new'); $nav->addFilter('', pht('Create Document'), '/phriction/new');
} }
$nav->addLabel('Filters'); $nav->addLabel(pht('Filters'));
$nav->addFilter('active', pht('Active Documents')); $nav->addFilter('active', pht('Active Documents'));
$nav->addFilter('all', pht('All Documents')); $nav->addFilter('all', pht('All Documents'));
$nav->addFilter('updates', pht('Recently Updated')); $nav->addFilter('updates', pht('Recently Updated'));

View file

@ -32,11 +32,11 @@ final class PhrictionDeleteController extends PhrictionController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle('Delete document?') ->setTitle(pht('Delete document?'))
->appendChild( ->appendChild(
'Really delete this document? You can recover it later by reverting '. pht('Really delete this document? You can recover it later by '.
'to a previous version.') 'reverting to a previous version.'))
->addSubmitButton('Delete') ->addSubmitButton(pht('Delete'))
->addCancelButton($document_uri); ->addCancelButton($document_uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -138,9 +138,9 @@ final class PhrictionDiffController
array( array(
'href' => $uri->alter('l', $l - 1)->alter('r', $r - 1), 'href' => $uri->alter('l', $l - 1)->alter('r', $r - 1),
), ),
"\xC2\xAB Previous Change"); pht("\xC2\xAB Previous Change"));
} else { } else {
$link_l = 'Original Change'; $link_l = pht('Original Change');
} }
$link_r = null; $link_r = null;
@ -150,9 +150,9 @@ final class PhrictionDiffController
array( array(
'href' => $uri->alter('l', $l + 1)->alter('r', $r + 1), 'href' => $uri->alter('l', $l + 1)->alter('r', $r + 1),
), ),
"Next Change \xC2\xBB"); pht("Next Change \xC2\xBB"));
} else { } else {
$link_r = 'Most Recent Change'; $link_r = pht('Most Recent Change');
} }
$navigation_table = $navigation_table =
@ -184,7 +184,7 @@ final class PhrictionDiffController
$output, $output,
), ),
array( array(
'title' => 'Document History', 'title' => pht('Document History'),
)); ));
} }
@ -208,7 +208,7 @@ final class PhrictionDiffController
'href' => '/phriction/edit/'.$document_id.'/', 'href' => '/phriction/edit/'.$document_id.'/',
'class' => 'button', 'class' => 'button',
), ),
'Edit Current Version'); pht('Edit Current Version'));
} }
@ -218,7 +218,7 @@ final class PhrictionDiffController
'href' => '/phriction/edit/'.$document_id.'/?revert='.$version, 'href' => '/phriction/edit/'.$document_id.'/?revert='.$version,
'class' => 'button', 'class' => 'button',
), ),
'Revert to Version '.phutil_escape_html($version).'...'); pht('Revert to Version %s...', phutil_escape_html($version)));
} }
private function renderComparisonTable(array $content) { private function renderComparisonTable(array $content) {
@ -244,11 +244,11 @@ final class PhrictionDiffController
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setHeaders( $table->setHeaders(
array( array(
'Date', pht('Date'),
'Time', pht('Time'),
'Version', pht('Version'),
'Author', pht('Author'),
'Description', pht('Description'),
)); ));
$table->setColumnClasses( $table->setColumnClasses(
array( array(

View file

@ -60,15 +60,15 @@ final class PhrictionDocumentController
'href' => $create_uri, 'href' => $create_uri,
'class' => 'green button', 'class' => 'green button',
), ),
'Create Page'); pht('Create Page'));
$page_content = $page_content =
'<div class="phriction-content">'. '<div class="phriction-content">'.
'<em>No content here!</em><br />'. '<em>'.pht('No content here!').'</em><br />'.
'No document found at <tt>'.phutil_escape_html($slug).'</tt>. '. pht('No document found at <tt>%s</tt>.', phutil_escape_html($slug)).
$create_sentence. ' '.$create_sentence.
'</div>'; '</div>';
$page_title = 'Page Not Found'; $page_title = pht('Page Not Found');
$buttons = $button; $buttons = $button;
} else { } else {
$version = $request->getInt('v'); $version = $request->getInt('v');
@ -82,13 +82,13 @@ final class PhrictionDocumentController
} }
if ($content->getID() != $document->getContentID()) { if ($content->getID() != $document->getContentID()) {
$vdate = phabricator_datetime($content->getDateCreated(), $user);
$version_note = new AphrontErrorView(); $version_note = new AphrontErrorView();
$version_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $version_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$version_note->setTitle('Older Version'); $version_note->setTitle('Older Version');
$version_note->appendChild( $version_note->appendChild(
'You are viewing an older version of this document, as it '. pht('You are viewing an older version of this document, as it '.
'appeared on '. 'appeared on %s.', $vdate));
phabricator_datetime($content->getDateCreated(), $user).'.');
} }
} else { } else {
$content = id(new PhrictionContent())->load($document->getContentID()); $content = id(new PhrictionContent())->load($document->getContentID());
@ -154,8 +154,8 @@ final class PhrictionDocumentController
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Document Deleted'); $notice->setTitle('Document Deleted');
$notice->appendChild( $notice->appendChild(
'This document has been deleted. You can edit it to put new content '. pht('This document has been deleted. You can edit it to put new '.
'here, or use history to revert to an earlier version.'); 'content here, or use history to revert to an earlier version.'));
$core_content = $notice->render(); $core_content = $notice->render();
} else { } else {
throw new Exception("Unknown document status '{$doc_status}'!"); throw new Exception("Unknown document status '{$doc_status}'!");
@ -338,20 +338,22 @@ final class PhrictionDocumentController
} }
} }
if ($more_children) { if ($more_children) {
$list[] = '<li>More...</li>'; $list[] = '<li>'.pht('More...').'</li>';
} }
$list[] = '</ul>'; $list[] = '</ul>';
$list = implode("\n", $list); $list = implode("\n", $list);
return return
'<div class="phriction-children">'. '<div class="phriction-children">'.
'<div class="phriction-children-header">Document Hierarchy</div>'. '<div class="phriction-children-header">'.
pht('Document Hierarchy').
'</div>'.
$list. $list.
'</div>'; '</div>';
} }
private function renderChildDocumentLink(array $info) { private function renderChildDocumentLink(array $info) {
$title = nonempty($info['title'], '(Untitled Document)'); $title = nonempty($info['title'], pht('(Untitled Document)'));
$item = phutil_render_tag( $item = phutil_render_tag(
'a', 'a',
array( array(

View file

@ -95,8 +95,8 @@ final class PhrictionEditController
$notes = $request->getStr('description'); $notes = $request->getStr('description');
if (!strlen($title)) { if (!strlen($title)) {
$e_title = 'Required'; $e_title = pht('Required');
$errors[] = 'Document title is required.'; $errors[] = pht('Document title is required.');
} else { } else {
$e_title = null; $e_title = null;
} }
@ -107,9 +107,9 @@ final class PhrictionEditController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle('No Edits'); $dialog->setTitle(pht('No Edits'));
$dialog->appendChild( $dialog->appendChild(
'<p>You did not make any changes to the document.</p>'); '<p>'.pht('You did not make any changes to the document.').'</p>');
$dialog->addCancelButton($request->getRequestURI()); $dialog->addCancelButton($request->getRequestURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -121,9 +121,9 @@ final class PhrictionEditController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle('Empty Page'); $dialog->setTitle(pht('Empty Page'));
$dialog->appendChild( $dialog->appendChild(
'<p>You can not create an empty document.</p>'); '<p>'.pht('You can not create an empty document.').'</p>');
$dialog->addCancelButton($request->getRequestURI()); $dialog->addCancelButton($request->getRequestURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -150,16 +150,16 @@ final class PhrictionEditController
$error_view = null; $error_view = null;
if ($errors) { if ($errors) {
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle('Form Errors') ->setTitle(pht('Form Errors'))
->setErrors($errors); ->setErrors($errors);
} }
if ($document->getID()) { if ($document->getID()) {
$panel_header = 'Edit Phriction Document'; $panel_header = pht('Edit Phriction Document');
$submit_button = 'Save Changes'; $submit_button = pht('Save Changes');
} else { } else {
$panel_header = 'Create New Phriction Document'; $panel_header = pht('Create New Phriction Document');
$submit_button = 'Create Document'; $submit_button = pht('Create Document');
} }
$uri = $document->getSlug(); $uri = $document->getSlug();
@ -178,13 +178,14 @@ final class PhrictionEditController
array( array(
'href' => $request->getRequestURI()->alter('nodraft', true), 'href' => $request->getRequestURI()->alter('nodraft', true),
), ),
'discard this draft'); pht('discard this draft'));
$draft_note = new AphrontErrorView(); $draft_note = new AphrontErrorView();
$draft_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $draft_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$draft_note->setTitle('Recovered Draft'); $draft_note->setTitle('Recovered Draft');
$draft_note->appendChild( $draft_note->appendChild(
'<p>Showing a saved draft of your edits, you can '.$discard.'.</p>'); '<p>'.pht('Showing a saved draft of your edits, you can %s.',
$discard).'</p>');
} else { } else {
$content_text = $content->getContent(); $content_text = $content->getContent();
$draft_note = null; $draft_note = null;
@ -198,17 +199,17 @@ final class PhrictionEditController
->addHiddenInput('nodraft', $request->getBool('nodraft')) ->addHiddenInput('nodraft', $request->getBool('nodraft'))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Title') ->setLabel(pht('Title'))
->setValue($content->getTitle()) ->setValue($content->getTitle())
->setError($e_title) ->setError($e_title)
->setName('title')) ->setName('title'))
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel('URI') ->setLabel(pht('URI'))
->setValue($uri)) ->setValue($uri))
->appendChild( ->appendChild(
id(new PhabricatorRemarkupControl()) id(new PhabricatorRemarkupControl())
->setLabel('Content') ->setLabel(pht('Content'))
->setValue($content_text) ->setValue($content_text)
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
->setName('content') ->setName('content')
@ -216,7 +217,7 @@ final class PhrictionEditController
->setUser($user)) ->setUser($user))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Edit Notes') ->setLabel(pht('Edit Notes'))
->setValue($notes) ->setValue($notes)
->setError(null) ->setError(null)
->setName('description')) ->setName('description'))
@ -233,11 +234,11 @@ final class PhrictionEditController
$preview_panel = $preview_panel =
'<div class="aphront-panel-preview aphront-panel-preview-wide"> '<div class="aphront-panel-preview aphront-panel-preview-wide">
<div class="phriction-document-preview-header"> <div class="phriction-document-preview-header">
Document Preview '.pht('Document Preview').'
</div> </div>
<div id="document-preview"> <div id="document-preview">
<div class="aphront-panel-preview-loading-text"> <div class="aphront-panel-preview-loading-text">
Loading preview... '.pht('Loading preview...').'
</div> </div>
</div> </div>
</div>'; </div>';
@ -258,7 +259,7 @@ final class PhrictionEditController
$preview_panel, $preview_panel,
), ),
array( array(
'title' => 'Edit Document', 'title' => pht('Edit Document'),
)); ));
} }

View file

@ -49,7 +49,7 @@ final class PhrictionHistoryController
$diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/'); $diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/');
$vs_previous = '<em>Created</em>'; $vs_previous = '<em>'.pht('Created').'</em>';
if ($content->getVersion() != 1) { if ($content->getVersion() != 1) {
$uri = $diff_uri $uri = $diff_uri
->alter('l', $content->getVersion() - 1) ->alter('l', $content->getVersion() - 1)
@ -59,10 +59,10 @@ final class PhrictionHistoryController
array( array(
'href' => $uri, 'href' => $uri,
), ),
'Show Change'); pht('Show Change'));
} }
$vs_head = '<em>Current</em>'; $vs_head = '<em>'.pht('Current').'</em>';
if ($content->getID() != $document->getContentID()) { if ($content->getID() != $document->getContentID()) {
$uri = $diff_uri $uri = $diff_uri
->alter('l', $content->getVersion()) ->alter('l', $content->getVersion())
@ -73,7 +73,7 @@ final class PhrictionHistoryController
array( array(
'href' => $uri, 'href' => $uri,
), ),
'Show Later Changes'); pht('Show Later Changes'));
} }
$change_type = PhrictionChangeType::getChangeTypeLabel( $change_type = PhrictionChangeType::getChangeTypeLabel(
@ -87,7 +87,7 @@ final class PhrictionHistoryController
array( array(
'href' => $slug_uri.'?v='.$version, 'href' => $slug_uri.'?v='.$version,
), ),
'Version '.$version), pht('Version %s', $version)),
$handles[$content->getAuthorPHID()]->renderLink(), $handles[$content->getAuthorPHID()]->renderLink(),
$change_type, $change_type,
phutil_escape_html($content->getDescription()), phutil_escape_html($content->getDescription()),
@ -99,14 +99,14 @@ final class PhrictionHistoryController
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setHeaders( $table->setHeaders(
array( array(
'Date', pht('Date'),
'Time', pht('Time'),
'Version', pht('Version'),
'Author', pht('Author'),
'Type', pht('Type'),
'Description', pht('Description'),
'Against Previous', pht('Against Previous'),
'Against Current', pht('Against Current'),
)); ));
$table->setColumnClasses( $table->setColumnClasses(
array( array(
@ -132,7 +132,7 @@ final class PhrictionHistoryController
PhrictionDocument::getSlugURI($document->getSlug(), 'history'))); PhrictionDocument::getSlugURI($document->getSlug(), 'history')));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Document History'); $panel->setHeader(pht('Document History'));
$panel->setNoBackground(); $panel->setNoBackground();
$panel->appendChild($table); $panel->appendChild($table);
$panel->appendChild($pager); $panel->appendChild($pager);
@ -143,7 +143,7 @@ final class PhrictionHistoryController
$panel, $panel,
), ),
array( array(
'title' => 'Document History', 'title' => pht('Document History'),
'device' => true, 'device' => true,
)); ));

View file

@ -67,10 +67,10 @@ final class PhrictionListController
$document_table = new AphrontTableView($rows); $document_table = new AphrontTableView($rows);
$document_table->setHeaders( $document_table->setHeaders(
array( array(
'Last Editor', pht('Last Editor'),
'Title', pht('Title'),
'Last Update', pht('Last Update'),
'Time', pht('Time'),
)); ));
$document_table->setColumnClasses( $document_table->setColumnClasses(

View file

@ -78,7 +78,7 @@ final class PhrictionContent extends PhrictionDAO
$toc = $toc =
'<div class="phabricator-remarkup-toc">'. '<div class="phabricator-remarkup-toc">'.
'<div class="phabricator-remarkup-toc-header">'. '<div class="phabricator-remarkup-toc-header">'.
'Table of Contents'. pht('Table of Contents').
'</div>'. '</div>'.
$toc. $toc.
'</div>'; '</div>';