1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Mark some strings for translation

Summary: Add some more `pht`izations.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13200
This commit is contained in:
Joshua Spence 2015-06-09 23:06:52 +10:00
parent 5397779ee2
commit f47e69c015
78 changed files with 181 additions and 151 deletions

View file

@ -1,7 +1,6 @@
<?php
function phabricator_read_config_file($original_config) {
$root = dirname(dirname(__FILE__));
// Accept either "myconfig" (preferred) or "myconfig.conf.php".
@ -9,7 +8,6 @@ function phabricator_read_config_file($original_config) {
$full_config_path = $root.'/conf/'.$config.'.conf.php';
if (!Filesystem::pathExists($full_config_path)) {
// These are very old configuration files which we used to ship with
// by default. File based configuration was de-emphasized once web-based
// configuration was built. The actual files were removed to reduce
@ -37,12 +35,14 @@ function phabricator_read_config_file($original_config) {
$file = trim($file, './');
$files[$key] = preg_replace('/\.conf\.php$/', '', $file);
}
$files = " ".implode("\n ", $files);
$files = ' '.implode("\n ", $files);
throw new Exception(
pht(
"CONFIGURATION ERROR\n".
"Config file '{$original_config}' does not exist. Valid config files ".
"are:\n\n".$files);
"Config file '%s' does not exist. Valid config files are:\n\n%s",
$original_config,
$files));
}
// Make sure config file errors are reported.
@ -58,7 +58,11 @@ function phabricator_read_config_file($original_config) {
ini_set('display_errors', $old_display_errors);
if ($conf === false) {
throw new Exception("Failed to read config file '{$config}': {$errors}");
throw new Exception(
pht(
"Failed to read config file '%s': %s",
$config,
$errors));
}
return $conf;

View file

@ -5,4 +5,4 @@
// already migrated, so this was cleaned up when ReleephRequestEvent was
// removed.
echo "(This migration is obsolete.)\n";
echo pht('(This migration is obsolete.)')."\n";

View file

@ -75,7 +75,9 @@ final class AphrontHTTPSinkTestCase extends PhabricatorTestCase {
$this->assertEqual(
'for (;;);{"x":"\u003ciframe\u003e"}',
$sink->getEmittedData(),
'JSONResponse should prevent content-sniffing attacks.');
pht(
'%s should prevent content-sniffing attacks.',
'JSONResponse'));
}

View file

@ -87,7 +87,7 @@ final class AlmanacBindingEditController
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('interfacePHIDs')
->setLabel('Interface')
->setLabel(pht('Interface'))
->setLimit(1)
->setDatasource(new AlmanacInterfaceDatasource())
->setValue($v_interface)

View file

@ -38,7 +38,7 @@ final class AlmanacConsoleController extends AlmanacController {
$crumbs->addTextCrumb(pht('Console'));
$box = id(new PHUIObjectBoxView())
->setHeaderText('Console')
->setHeaderText(pht('Console'))
->appendChild($menu);
return $this->buildApplicationPage(

View file

@ -44,7 +44,9 @@ final class PhabricatorAuditCommentEditor extends PhabricatorEditor {
return array(
'diffusion-audit-'.$commit->getPHID(),
'Commit r'.$repository->getCallsign().$commit->getCommitIdentifier(),
pht(
'Commit %s',
'r'.$repository->getCallsign().$commit->getCommitIdentifier()),
);
}

View file

@ -161,7 +161,7 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase {
->setNewValue(array('+' => $participant_phids));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue('Test');
->setNewValue(pht('Test'));
id(new ConpherenceEditor())
->setActor($creator)

View file

@ -160,8 +160,8 @@ final class ConpherenceThreadTestCase extends ConpherenceTestCase {
list($errors, $conpherence) = ConpherenceEditor::createThread(
$creator,
$participant_phids,
'Test',
'Test',
pht('Test'),
pht('Test'),
PhabricatorContentSource::newConsoleSource());
return $conpherence;
}

View file

@ -190,7 +190,7 @@ final class DifferentialChangesetListView extends AphrontView {
} else {
$detail->setAutoload(isset($this->visibleChangesets[$key]));
if (isset($this->visibleChangesets[$key])) {
$load = 'Loading...';
$load = pht('Loading...');
} else {
$load = javelin_tag(
'a',

View file

@ -78,7 +78,7 @@ final class DifferentialResultsTableView extends AphrontView {
'href' => '#',
'mustcapture' => true,
),
'Hide');
pht('Hide'));
$rows[] = javelin_tag(
'tr',

View file

@ -36,15 +36,14 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
}
public function render() {
$this->requireResource('differential-core-view-css');
$this->requireResource('differential-revision-history-css');
$data = array(
array(
'name' => 'Base',
'name' => pht('Base'),
'id' => null,
'desc' => 'Base',
'desc' => pht('Base'),
'age' => null,
'obj' => null,
),
@ -53,7 +52,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$seq = 0;
foreach ($this->diffs as $diff) {
$data[] = array(
'name' => 'Diff '.(++$seq),
'name' => pht('Diff %d', ++$seq),
'id' => $diff->getID(),
'desc' => $diff->getDescription(),
'age' => $diff->getDateCreated(),

View file

@ -116,7 +116,7 @@ final class DiffusionLintController extends DiffusionController {
->setValue($owners))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Filter'));
->setValue(pht('Filter')));
$content[] = id(new AphrontListFilterView())->appendChild($form);
}

View file

@ -181,7 +181,7 @@ final class DiffusionRepositoryEditHostingController
'%s: This repository is hosted elsewhere, so Phabricator can not '.
'perform writes. This mode will act like "Read Only" for '.
'repositories hosted elsewhere.',
phutil_tag('strong', array(), 'WARNING')),
phutil_tag('strong', array(), pht('WARNING'))),
);
}

View file

@ -149,7 +149,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
$summary = AphrontTableView::renderSingleDisplayLine(
$history->getSummary());
} else {
$summary = phutil_tag('em', array(), "Importing\xE2\x80\xA6");
$summary = phutil_tag('em', array(), pht("Importing\xE2\x80\xA6"));
}
$build = null;

View file

@ -29,8 +29,7 @@ final class DoorkeeperObjectRef extends Phobject {
public function getExternalObject() {
if (!$this->externalObject) {
throw new Exception(
'Call attachExternalObject() before getExternalObject()!');
throw new PhutilInvalidStateException('attachExternalObject');
}
return $this->externalObject;
}

View file

@ -155,7 +155,7 @@ abstract class DrydockBlueprintImplementation {
$resource->endReadLocking();
if ($allocated) {
$resource->saveTransaction();
$this->log('Allocated Lease');
$this->log(pht('Allocated Lease'));
} else {
$resource->killTransaction();
$this->log(pht('Failed to Allocate Lease'));

View file

@ -80,7 +80,9 @@ final class DrydockWorkingCopyBlueprintImplementation
$this->log(pht('Complete.'));
$resource = $this->newResourceTemplate(
'Working Copy ('.$repository->getCallsign().')');
pht(
'Working Copy (%s)',
$repository->getCallsign()));
$resource->setStatus(DrydockResourceStatus::STATUS_OPEN);
$resource->setAttribute('lease.host', $host_lease->getID());
$resource->setAttribute('path', $path);

View file

@ -43,16 +43,16 @@ final class DrydockLogListView extends AphrontView {
$table->setDeviceReadyTable(true);
$table->setHeaders(
array(
'Resource',
'Lease',
'Message',
'Date',
pht('Resource'),
pht('Lease'),
pht('Message'),
pht('Date'),
));
$table->setShortHeaders(
array(
'R',
'L',
'Message',
pht('Message'),
'',
));
$table->setColumnClasses(

View file

@ -109,7 +109,7 @@ final class PhabricatorFactHomeController extends PhabricatorFactController {
->setUser($user)
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Y-Axis')
->setLabel(pht('Y-Axis'))
->setName('y1')
->setOptions($options))
->appendChild(

View file

@ -82,7 +82,7 @@ final class HarbormasterPlanRunController extends HarbormasterController {
$plan->getID()))
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Buildable Name')
->setLabel(pht('Buildable Name'))
->setName('buildablePHID')
->setError($e_name)
->setValue($v_name));

View file

@ -183,9 +183,9 @@ final class HeraldTranscript extends HeraldDAO
public function getMetadataMap() {
return array(
'Run At Epoch' => date('F jS, g:i:s A', $this->time),
'Run On Host' => $this->host,
'Run Duration' => (int)(1000 * $this->duration).' ms',
pht('Run At Epoch') => date('F jS, g:i:s A', $this->time),
pht('Run On Host') => $this->host,
pht('Run Duration') => (int)(1000 * $this->duration).' ms',
);
}

View file

@ -212,16 +212,16 @@ EOTEXT
$status_example = array(
'open' => array(
'name' => 'Open',
'name' => pht('Open'),
'special' => 'default',
),
'closed' => array(
'name' => 'Closed',
'name' => pht('Closed'),
'special' => 'closed',
'closed' => true,
),
'duplicate' => array(
'name' => 'Duplicate',
'name' => pht('Duplicate'),
'special' => 'duplicate',
'closed' => true,
),

View file

@ -34,16 +34,16 @@ final class ManiphestTaskStatusTestCase extends PhabricatorTestCase {
$valid = array(
'open' => array(
'name' => 'Open',
'name' => pht('Open'),
'special' => 'default',
),
'closed' => array(
'name' => 'Closed',
'name' => pht('Closed'),
'special' => 'closed',
'closed' => true,
),
'duplicate' => array(
'name' => 'Duplicate',
'name' => pht('Duplicate'),
'special' => 'duplicate',
'closed' => true,
),
@ -52,7 +52,7 @@ final class ManiphestTaskStatusTestCase extends PhabricatorTestCase {
// We should raise on a bad key.
$bad_key = $valid;
$bad_key['!'] = array('name' => 'Exclaim');
$bad_key['!'] = array('name' => pht('Exclaim'));
$this->assertConfigValid(false, pht('Bad Key'), $bad_key);
// We should raise on a value type.
@ -68,7 +68,7 @@ final class ManiphestTaskStatusTestCase extends PhabricatorTestCase {
// We should raise on two statuses with the same special.
$double_close = $valid;
$double_close['finished'] = array(
'name' => 'Finished',
'name' => pht('Finished'),
'special' => 'closed',
'closed' => true,
);

View file

@ -589,7 +589,7 @@ final class ManiphestReportController extends ManiphestController {
$cname[] = $label;
$cclass[] = 'n';
}
$cname[] = 'Total';
$cname[] = pht('Total');
$cclass[] = 'n';
$cname[] = javelin_tag(
'span',

View file

@ -53,16 +53,16 @@ final class PhabricatorApplicationUninstallController
if ($this->action == 'install') {
if ($selected->canUninstall()) {
$dialog
->setTitle('Confirmation')
->setTitle(pht('Confirmation'))
->appendChild(
pht(
'Install %s application?',
$selected->getName()))
->addSubmitButton('Install');
->addSubmitButton(pht('Install'));
} else {
$dialog
->setTitle('Information')
->setTitle(pht('Information'))
->appendChild(pht('You cannot install an installed application.'));
}
} else {

View file

@ -23,7 +23,7 @@ final class PhabricatorMetaMTAMailgunReceiveController
if (!$this->verifyMessage()) {
throw new Exception(
'Mail signature is not valid. Check your Mailgun API key.');
pht('Mail signature is not valid. Check your Mailgun API key.'));
}
$request = $this->getRequest();

View file

@ -18,7 +18,7 @@ final class PhabricatorMailReceiverTestCase extends PhabricatorTestCase {
foreach ($same as $address) {
$this->assertTrue(
PhabricatorMailReceiver::matchAddresses($base, $address),
"Address {$address}");
pht('Address %s', $address));
}
$diff = array(

View file

@ -72,9 +72,9 @@ final class PhabricatorPeopleDatasource
}
if ($this->enrichResults) {
$display_type = 'User';
$display_type = pht('User');
if ($user->getIsAdmin()) {
$display_type = 'Administrator';
$display_type = pht('Administrator');
}
$result->setDisplayType($display_type);
$result->setImageURI($handles[$user->getPHID()]->getImageURI());

View file

@ -15,7 +15,7 @@ final class PhabricatorPhameApplication extends PhabricatorApplication {
}
public function getShortDescription() {
return 'Blog';
return pht('Blog');
}
public function getTitleGlyph() {

View file

@ -167,13 +167,13 @@ final class PhamePost extends PhameDAO
if ($current == 'facebook' ||
PhabricatorFacebookAuthProvider::getFacebookApplicationID()) {
$options['facebook'] = 'Facebook';
$options['facebook'] = pht('Facebook');
}
if ($current == 'disqus' ||
PhabricatorEnv::getEnvConfig('disqus.shortname')) {
$options['disqus'] = 'Disqus';
$options['disqus'] = pht('Disqus');
}
$options['none'] = 'None';
$options['none'] = pht('None');
return $options;
}

View file

@ -93,7 +93,7 @@ final class PholioMockEditController extends PholioController {
$mock_xactions[$type_cc] = array('=' => $v_cc);
if (!strlen($request->getStr('name'))) {
$e_name = 'Required';
$e_name = pht('Required');
$errors[] = pht('You must give the mock a name.');
}

View file

@ -17,7 +17,9 @@ final class PhortuneProductListController extends PhabricatorController {
$title = pht('Product List');
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb('Products', $this->getApplicationURI('product/'));
$crumbs->addTextCrumb(
pht('Products'),
$this->getApplicationURI('product/'));
$crumbs->addAction(
id(new PHUIListItemView())
->setName(pht('Create Product'))

View file

@ -44,12 +44,10 @@ final class PhortuneProviderActionController
return $response;
}
$title = 'Phortune';
return $this->buildApplicationPage(
$response,
array(
'title' => $title,
'title' => pht('Phortune'),
));
}

View file

@ -41,7 +41,7 @@ final class PhabricatorXHPASTViewRunController
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Parse'));
->setValue(pht('Parse')));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText(pht('Generate XHP AST'))

View file

@ -78,7 +78,7 @@ final class PhragmentBrowseController extends PhragmentController {
$item->addAttribute(pht('Deleted'));
}
} else {
$item->addAttribute('Directory');
$item->addAttribute(pht('Directory'));
}
$list->addItem($item);
}

View file

@ -67,7 +67,7 @@ final class PhragmentHistoryController extends PhragmentController {
if ($version->getFilePHID() === null) {
$item->setDisabled(true);
$item->addAttribute('Deletion');
$item->addAttribute(pht('Deletion'));
}
if (!$first && $can_edit) {

View file

@ -89,8 +89,8 @@ final class PhragmentSnapshotCreateController extends PhragmentController {
'tr',
array(),
array(
phutil_tag('th', array(), 'Fragment'),
phutil_tag('th', array(), 'Version'),
phutil_tag('th', array(), pht('Fragment')),
phutil_tag('th', array(), pht('Version')),
));
$rows[] = phutil_tag(
'tr',

View file

@ -68,7 +68,7 @@ final class PhragmentZIPController extends PhragmentController {
}
if (!$zip->open((string)$temp, ZipArchive::CREATE)) {
throw new Exception('Unable to create ZIP archive!');
throw new Exception(pht('Unable to create ZIP archive!'));
}
$mappings = $this->getFragmentMappings($fragment, $fragment->getPath());

View file

@ -227,7 +227,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
private function createProject(PhabricatorUser $user) {
$project = PhabricatorProject::initializeNewProject($user);
$project->setName('Test Project '.mt_rand());
$project->setName(pht('Test Project %d', mt_rand()));
$project->save();
return $project;
@ -247,7 +247,7 @@ final class PhabricatorProjectEditorTestCase extends PhabricatorTestCase {
$user = new PhabricatorUser();
$user->setUsername('unittestuser'.$rand);
$user->setRealName('Unit Test User '.$rand);
$user->setRealName(pht('Unit Test User %d', $rand));
return $user;
}

View file

@ -64,7 +64,7 @@ final class PhabricatorProjectDatasource
$proj_result = id(new PhabricatorTypeaheadResult())
->setName($all_strings)
->setDisplayName($proj->getName())
->setDisplayType('Project')
->setDisplayType(pht('Project'))
->setURI('/tag/'.$proj->getPrimarySlug().'/')
->setPHID($proj->getPHID())
->setIcon($proj->getIcon())

View file

@ -250,7 +250,7 @@ final class ReleephRequestEditController extends ReleephBranchController {
->addHiddenInput('requestIdentifierRaw', 'D'.$diff_rev_id)
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Diff')
->setLabel(pht('Diff'))
->setValue($title));
} else {
$origin = $branch->getURI();

View file

@ -51,7 +51,7 @@ final class DifferentialReleephRequestFieldSpecification {
}
public function renderLabelForRevisionView() {
return 'Releeph';
return pht('Releeph');
}
public function getRequiredHandlePHIDs() {
@ -246,7 +246,7 @@ final class DifferentialReleephRequestFieldSpecification {
}
public function renderLabelForCommitMessage() {
return 'Releeph';
return pht('Releeph');
}
public function shouldAppearOnCommitMessageTemplate() {

View file

@ -8,7 +8,7 @@ final class ReleephAuthorFieldSpecification
}
public function getName() {
return 'Author';
return pht('Author');
}
public function getRequiredHandlePHIDsForPropertyView() {

View file

@ -8,7 +8,7 @@ final class ReleephBranchCommitFieldSpecification
}
public function getName() {
return 'Commit';
return pht('Commit');
}
public function getRequiredHandlePHIDsForPropertyView() {

View file

@ -8,7 +8,7 @@ final class ReleephDiffMessageFieldSpecification
}
public function getName() {
return 'Message';
return pht('Message');
}
public function getStyleForPropertyView() {

View file

@ -8,7 +8,7 @@ final class ReleephIntentFieldSpecification
}
public function getName() {
return 'Intent';
return pht('Intent');
}
public function getRequiredHandlePHIDsForPropertyView() {

View file

@ -37,7 +37,7 @@ abstract class ReleephLevelFieldSpecification
}
$control = id(new AphrontFormRadioButtonControl())
->setLabel('Level')
->setLabel(pht('Level'))
->setName($control_name)
->setValue($level);
@ -75,7 +75,7 @@ abstract class ReleephLevelFieldSpecification
public function validate($value) {
if ($value === null) {
$this->error = 'Required';
$this->error = pht('Required');
$label = $this->getName();
throw new ReleephFieldParseException(
$this,

View file

@ -8,7 +8,7 @@ final class ReleephOriginalCommitFieldSpecification
}
public function getName() {
return 'Commit';
return pht('Commit');
}
public function getRequiredHandlePHIDsForPropertyView() {

View file

@ -44,7 +44,7 @@ final class ReleephReasonFieldSpecification
public function validate($reason) {
if (!$reason) {
$this->error = 'Required';
$this->error = pht('Required');
throw new ReleephFieldParseException(
$this,
pht('You must give a reason for your request.'));
@ -53,8 +53,8 @@ final class ReleephReasonFieldSpecification
public function renderHelpForArcanist() {
$text = pht(
"Fully explain why you are requesting this code be included ".
"in the next release.\n");
'Fully explain why you are requesting this code be included '.
'in the next release.')."\n";
return phutil_console_wrap($text, 8);
}

View file

@ -11,7 +11,7 @@ final class ReleephSeverityFieldSpecification
}
public function getName() {
return 'Severity';
return pht('Severity');
}
public function getStorageKey() {

View file

@ -14,7 +14,7 @@ final class ReleephSummaryFieldSpecification
}
public function getName() {
return 'Summary';
return pht('Summary');
}
public function getStorageKey() {
@ -25,7 +25,7 @@ final class ReleephSummaryFieldSpecification
public function renderEditControl(array $handles) {
return id(new AphrontFormTextControl())
->setLabel('Summary')
->setLabel(pht('Summary'))
->setName('summary')
->setError($this->error)
->setValue($this->getValue())

View file

@ -157,11 +157,11 @@ final class ReleephRequestSearchEngine
if (ReleephDefaultFieldSelector::isFacebook()) {
return array(
'' => pht('(All Severities)'),
11 => 'HOTFIX',
12 => 'PIGGYBACK',
13 => 'RELEASE',
14 => 'DAILY',
15 => 'PARKING',
11 => pht('HOTFIX'),
12 => pht('PIGGYBACK'),
13 => pht('RELEASE'),
14 => pht('DAILY'),
15 => pht('PARKING'),
);
} else {
return array(

View file

@ -18,7 +18,7 @@ final class PhabricatorRepositoryType {
public static function getNameForRepositoryType($type) {
$map = self::getAllRepositoryTypes();
return idx($map, $type, 'Unknown');
return idx($map, $type, pht('Unknown'));
}
}

View file

@ -100,7 +100,10 @@ final class PhabricatorMercurialGraphStream
}
throw new Exception(
"No such {$until_type} '{$until_name}' in repository!");
pht(
"No such %s '%s' in repository!",
$until_type,
$until_name));
}

View file

@ -68,7 +68,10 @@ abstract class PhabricatorRepositoryEngine {
$matches = null;
if (!preg_match('/^\s*Fetch URL:\s*(.*?)\s*$/m', $remotes, $matches)) {
throw new Exception(
"Expected 'Fetch URL' in 'git remote show -n origin'.");
pht(
"Expected '%s' in '%s'.",
'Fetch URL',
'git remote show -n origin'));
}
$remote_uri = $matches[1];

View file

@ -60,16 +60,16 @@ final class PhabricatorRepositoryManagementImportingWorkflow
$status = $row['importStatus'];
$need = array();
if (!($status & PhabricatorRepositoryCommit::IMPORTED_MESSAGE)) {
$need[] = 'Message';
$need[] = pht('Message');
}
if (!($status & PhabricatorRepositoryCommit::IMPORTED_CHANGE)) {
$need[] = 'Change';
$need[] = pht('Change');
}
if (!($status & PhabricatorRepositoryCommit::IMPORTED_OWNERS)) {
$need[] = 'Owners';
$need[] = pht('Owners');
}
if (!($status & PhabricatorRepositoryCommit::IMPORTED_HERALD)) {
$need[] = 'Herald';
$need[] = pht('Herald');
}
$console->writeOut(' %s', implode(', ', $need));

View file

@ -27,7 +27,7 @@ final class PhabricatorRepositoryURITestCase
$repo = PhabricatorRepository::initializeNewRepository($user)
->setVersionControlSystem($svn)
->setName('Test Repo')
->setName(pht('Test Repo'))
->setCallsign('TESTREPO')
->setCredentialPHID($http_credential->getPHID())
->save();

View file

@ -15,7 +15,7 @@ final class PhabricatorApplicationTransactionNoEffectException
$this->hasComment = $has_comment;
$message = array();
$message[] = 'Transactions have no effect:';
$message[] = pht('Transactions have no effect:');
foreach ($this->transactions as $transaction) {
$message[] = ' - '.$transaction->getNoEffectDescription();
}

View file

@ -96,8 +96,8 @@ final class PHUITimelineExample extends PhabricatorUIExample {
$events[] = id(new PHUITimelineEventView())
->setUserHandle($handle)
->setIcon('fa-tag')
->setTitle(str_repeat('Long Text Title ', 64))
->appendChild(str_repeat('Long Text Body ', 64))
->setTitle(str_repeat(pht('Long Text Title').' ', 64))
->appendChild(str_repeat(pht('Long Text Body').' ', 64))
->setColor(PhabricatorTransactions::COLOR_ORANGE);
$events[] = id(new PHUITimelineEventView())

View file

@ -53,7 +53,7 @@ final class PhabricatorAphrontBarUIExample extends PhabricatorUIExample {
}
return $this->wrap(
'Glyph bars in weird order',
pht('Glyph bars in weird order'),
$views);
}
@ -61,12 +61,13 @@ final class PhabricatorAphrontBarUIExample extends PhabricatorUIExample {
$bar = id(new AphrontGlyphBarView())
->setValue(50)
->setMax(100)
->setCaption('Glyphs!')
->setCaption(pht('Glyphs!'))
->setNumGlyphs(10)
->setGlyph(hsprintf('%s', '*'));
return $this->wrap(
'Ascii star glyph bar', $bar);
pht('ASCII star glyph bar'),
$bar);
}
}

View file

@ -22,28 +22,28 @@ final class PhabricatorPagedFormUIExample extends PhabricatorUIExample {
->addControl(
id(new AphrontFormTextControl())
->setName('page1')
->setLabel('Page 1'));
->setLabel(pht('Page 1')));
$page2 = id(new PHUIFormPageView())
->setPageName(pht('Page 2'))
->addControl(
id(new AphrontFormTextControl())
->setName('page2')
->setLabel('Page 2'));
->setLabel(pht('Page 2')));
$page3 = id(new PHUIFormPageView())
->setPageName(pht('Page 3'))
->addControl(
id(new AphrontFormTextControl())
->setName('page3')
->setLabel('Page 3'));
->setLabel(pht('Page 3')));
$page4 = id(new PHUIFormPageView())
->setPageName(pht('Page 4'))
->addControl(
id(new AphrontFormTextControl())
->setName('page4')
->setLabel('Page 4'));
->setLabel(pht('Page 4')));
$form = new PHUIPagedFormView();
$form->setUser($user);

View file

@ -23,7 +23,7 @@ final class PhabricatorPagerUIExample extends PhabricatorUIExample {
$rows = array();
for ($ii = $offset; $ii < min($item_count, $offset + $page_size); $ii++) {
$rows[] = array(
'Item #'.($ii + 1),
pht('Item #%d', $ii + 1),
);
}

View file

@ -18,28 +18,28 @@ final class PhabricatorSortTableUIExample extends PhabricatorUIExample {
'model' => 'Civic',
'year' => 2004,
'price' => 3199,
'color' => 'Blue',
'color' => pht('Blue'),
),
array(
'make' => 'Ford',
'model' => 'Focus',
'year' => 2001,
'price' => 2549,
'color' => 'Red',
'color' => pht('Red'),
),
array(
'make' => 'Toyota',
'model' => 'Camry',
'year' => 2009,
'price' => 4299,
'color' => 'Black',
'color' => pht('Black'),
),
array(
'make' => 'NASA',
'model' => 'Shuttle',
'year' => 1998,
'price' => 1000000000,
'color' => 'White',
'color' => pht('White'),
),
);

View file

@ -5,7 +5,7 @@ abstract class PhabricatorXHProfController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
$page->setApplicationName('XHProf');
$page->setApplicationName(pht('XHProf'));
$page->setBaseURI('/xhprof/');
$page->setTitle(idx($data, 'title'));
$page->setGlyph("\xE2\x98\x84");

View file

@ -17,7 +17,7 @@ abstract class PhabricatorEditor extends Phobject {
final public function requireActor() {
$actor = $this->getActor();
if (!$actor) {
throw new Exception('You must setActor()!');
throw new PhutilInvalidStateException('setActor');
}
return $actor;
}

View file

@ -15,12 +15,14 @@ final class PhabricatorCustomFieldImplementationIncompleteException
$name = $field->getFieldName();
}
$class = get_class($field);
parent::__construct(
"Custom field '{$name}' (with key '{$key}', of class '{$class}') is ".
"incompletely implemented: it claims to support a feature, but does not ".
"implement all of the required methods for that feature.");
pht(
"Custom field '%s' (with key '%s', of class '%s') is incompletely ".
"implemented: it claims to support a feature, but does not ".
"implement all of the required methods for that feature.",
$name,
$key,
get_class($field)));
}
}

View file

@ -59,10 +59,11 @@ abstract class PhabricatorCustomField {
$spec = $object->getCustomFieldSpecificationForRole($role);
if (!is_array($spec)) {
$obj_class = get_class($object);
throw new Exception(
"Expected an array from getCustomFieldSpecificationForRole() for ".
"object of class '{$obj_class}'.");
pht(
"Expected an array from %s for object of class '%s'.",
'getCustomFieldSpecificationForRole()',
get_class($object)));
}
$fields = self::buildFieldList(
@ -128,10 +129,13 @@ abstract class PhabricatorCustomField {
foreach ($field_object->createFields($object) as $field) {
$key = $field->getFieldKey();
if (isset($fields[$key])) {
$original_class = $from_map[$key];
throw new Exception(
"Both '{$original_class}' and '{$current_class}' define a custom ".
"field with field key '{$key}'. Field keys must be unique.");
pht(
"Both '%s' and '%s' define a custom field with ".
"field key '%s'. Field keys must be unique.",
$from_map[$key],
$current_class,
$key));
}
$from_map[$key] = $current_class;
$fields[$key] = $field;
@ -290,7 +294,7 @@ abstract class PhabricatorCustomField {
case self::ROLE_DEFAULT:
return true;
default:
throw new Exception("Unknown field role '{$role}'!");
throw new Exception(pht("Unknown field role '%s'!", $role));
}
}

View file

@ -20,7 +20,9 @@ final class PhabricatorCustomFieldAttachment {
public function getCustomFieldList($role) {
if (empty($this->lists[$role])) {
throw new PhabricatorCustomFieldNotAttachedException(
"Role list '{$role}' is not available!");
pht(
"Role list '%s' is not available!",
$role));
}
return $this->lists[$role];
}

View file

@ -114,7 +114,7 @@ final class PhabricatorBotObjectNameHandler extends PhabricatorBotHandler {
'poll_id' => $vote_id,
));
$output[$vote['phid']] = 'V'.$vote['id'].': '.$vote['question'].
' Come Vote '.$vote['uri'];
' '.pht('Come Vote').' '.$vote['uri'];
}
}

View file

@ -29,7 +29,7 @@ final class PhabricatorTaskmasterDaemon extends PhabricatorDaemon {
} else if ($ex instanceof PhabricatorWorkerYieldException) {
$this->log(pht('Task %s yielded.', $id));
} else {
$this->log("Task {$id} failed!");
$this->log(pht('Task %d failed!', $id));
throw new PhutilProxyException(
pht('Error while executing Task ID %d.', $id),
$ex);

View file

@ -42,10 +42,11 @@ final class PhabricatorWorkerManagementExecuteWorkflow
$task->getDataID());
$task->setData($task_data->getData());
$id = $task->getID();
$class = $task->getTaskClass();
$console->writeOut("Executing task {$id} ({$class})...");
$console->writeOut(
pht(
'Executing task %d (%s)...',
$task->getID(),
$task->getTaskClass()));
$task = $task->executeTask();
$ex = $task->getExecutionException();

View file

@ -191,7 +191,7 @@ final class PhabricatorStorageManagementAPI {
$this->applyPatchPHP($name);
break;
default:
throw new Exception("Unable to apply patch of type '{$type}'.");
throw new Exception(pht("Unable to apply patch of type '%s'.", $type));
}
}

View file

@ -200,12 +200,13 @@ final class PhabricatorStorageManagementUpgradeWorkflow
if (!$applied_something) {
if (count($patches)) {
throw new Exception(
'Some patches could not be applied: '.
implode(', ', array_keys($patches)));
pht(
'Some patches could not be applied: %s',
implode(', ', array_keys($patches))));
} else if (!$is_dry && !$apply_only) {
echo pht(
"Storage is up to date. Use '%s' for details.\n",
'storage status');
"Storage is up to date. Use '%s' for details.",
'storage status')."\n";
}
break;
}

View file

@ -184,7 +184,7 @@ abstract class PhabricatorTestCase extends PhutilTestCase {
$seed = $this->getNextObjectSeed();
$user = id(new PhabricatorUser())
->setRealName("Test User {$seed}}")
->setRealName(pht('Test User %s', $seed))
->setUserName("test{$seed}")
->setIsApproved(1);
@ -211,15 +211,17 @@ abstract class PhabricatorTestCase extends PhutilTestCase {
if (!self::$testsAreRunning) {
throw new Exception(
pht(
'Executing test code outside of test execution! This code path can '.
'only be run during unit tests.'));
'Executing test code outside of test execution! '.
'This code path can only be run during unit tests.'));
}
}
protected function requireBinaryForTest($binary) {
if (!Filesystem::binaryExists($binary)) {
$this->assertSkipped(
pht('No binary "%s" found on this system, skipping test.', $binary));
pht(
'No binary "%s" found on this system, skipping test.',
$binary));
}
}

View file

@ -234,7 +234,10 @@ final class AphrontDialogView extends AphrontView {
case self::WIDTH_DEFAULT:
break;
default:
throw new Exception("Unknown dialog width '{$this->width}'!");
throw new Exception(
pht(
"Unknown dialog width '%s'!",
$this->width));
}
if ($this->isStandalone) {

View file

@ -61,7 +61,7 @@ final class AphrontFormDateControl extends AphrontFormControl {
$this->valueTime = $time;
// Assume invalid.
$err = 'Invalid';
$err = pht('Invalid');
$zone = $this->getTimezone();

View file

@ -110,14 +110,14 @@ final class PHUIListViewTestCase extends PhabricatorTestCase {
return id(new PHUIListItemView())
->setKey($key)
->setHref('#')
->setName('Link');
->setName(pht('Link'));
}
private function newLabel($key) {
return id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LABEL)
->setKey($key)
->setName('Label');
->setName(pht('Label'));
}
private function newABCMenu() {