Skip to content

Commit

Permalink
Mark some strings for translation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joshuaspence committed Jun 9, 2015
1 parent 5397779 commit f47e69c
Show file tree
Hide file tree
Showing 78 changed files with 181 additions and 151 deletions.
18 changes: 11 additions & 7 deletions conf/__init_conf__.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?php

function phabricator_read_config_file($original_config) {

$root = dirname(dirname(__FILE__));

// Accept either "myconfig" (preferred) or "myconfig.conf.php".
$config = preg_replace('/\.conf\.php$/', '', $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
Expand Down Expand Up @@ -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(
"CONFIGURATION ERROR\n".
"Config file '{$original_config}' does not exist. Valid config files ".
"are:\n\n".$files);
pht(
"CONFIGURATION ERROR\n".
"Config file '%s' does not exist. Valid config files are:\n\n%s",
$original_config,
$files));
}

// Make sure config file errors are reported.
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion resources/sql/patches/20130508.releephtransactionsmig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
4 changes: 3 additions & 1 deletion src/aphront/sink/__tests__/AphrontHTTPSinkTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public function testJSONContentSniff() {
$this->assertEqual(
'for (;;);{"x":"\u003ciframe\u003e"}',
$sink->getEmittedData(),
'JSONResponse should prevent content-sniffing attacks.');
pht(
'%s should prevent content-sniffing attacks.',
'JSONResponse'));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function handleRequest(AphrontRequest $request) {
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('interfacePHIDs')
->setLabel('Interface')
->setLabel(pht('Interface'))
->setLimit(1)
->setDatasource(new AlmanacInterfaceDatasource())
->setValue($v_interface)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function handleRequest(AphrontRequest $request) {
$crumbs->addTextCrumb(pht('Console'));

$box = id(new PHUIObjectBoxView())
->setHeaderText('Console')
->setHeaderText(pht('Console'))
->appendChild($menu);

return $this->buildApplicationPage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public static function getMailThreading(

return array(
'diffusion-audit-'.$commit->getPHID(),
'Commit r'.$repository->getCallsign().$commit->getCommitIdentifier(),
pht(
'Commit %s',
'r'.$repository->getCallsign().$commit->getCommitIdentifier()),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private function createRoom(
->setNewValue(array('+' => $participant_phids));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue('Test');
->setNewValue(pht('Test'));

id(new ConpherenceEditor())
->setActor($creator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ private function createThread(
list($errors, $conpherence) = ConpherenceEditor::createThread(
$creator,
$participant_phids,
'Test',
'Test',
pht('Test'),
pht('Test'),
PhabricatorContentSource::newConsoleSource());
return $conpherence;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
const TYPE_UPDATE = 'differential:update';
const TYPE_ACTION = 'differential:action';
const TYPE_STATUS = 'differential:status';

const MAILTAG_REVIEWERS = 'differential-reviewers';
const MAILTAG_CLOSED = 'differential-committed';
const MAILTAG_CC = 'differential-cc';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function render() {
} else {
$detail->setAutoload(isset($this->visibleChangesets[$key]));
if (isset($this->visibleChangesets[$key])) {
$load = 'Loading...';
$load = pht('Loading...');
} else {
$load = javelin_tag(
'a',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function render() {
'href' => '#',
'mustcapture' => true,
),
'Hide');
pht('Hide'));

$rows[] = javelin_tag(
'tr',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ public function setCommitsForLinks(array $commits) {
}

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,
),
Expand All @@ -53,7 +52,7 @@ public function render() {
$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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
->setValue($owners))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue('Filter'));
->setValue(pht('Filter')));
$content[] = id(new AphrontListFilterView())->appendChild($form);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function handleProtocols(PhabricatorRepository $repository) {
'%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'))),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function render() {
$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;
Expand Down
3 changes: 1 addition & 2 deletions src/applications/doorkeeper/engine/DoorkeeperObjectRef.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public function attachExternalObject(

public function getExternalObject() {
if (!$this->externalObject) {
throw new Exception(
'Call attachExternalObject() before getExternalObject()!');
throw new PhutilInvalidStateException('attachExternalObject');
}
return $this->externalObject;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ final public function allocateLease(
$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'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ protected function executeAllocateResource(DrydockLease $lease) {
$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);
Expand Down
10 changes: 5 additions & 5 deletions src/applications/drydock/view/DrydockLogListView.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ public function render() {
$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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private function buildChartForm() {
->setUser($user)
->appendChild(
id(new AphrontFormSelectControl())
->setLabel('Y-Axis')
->setLabel(pht('Y-Axis'))
->setName('y1')
->setOptions($options))
->appendChild(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function processRequest() {
$plan->getID()))
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Buildable Name')
->setLabel(pht('Buildable Name'))
->setName('buildablePHID')
->setError($e_name)
->setValue($v_name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ public function getConditionTranscriptsForRule($rule_id) {

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',
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ public function getOptions() {

$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,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public function testManiphestStatusConfigValidation() {

$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,
),
Expand All @@ -52,7 +52,7 @@ public function testManiphestStatusConfigValidation() {

// 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.
Expand All @@ -68,7 +68,7 @@ public function testManiphestStatusConfigValidation() {
// 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,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ public function renderOpenTasks() {
$cname[] = $label;
$cclass[] = 'n';
}
$cname[] = 'Total';
$cname[] = pht('Total');
$cclass[] = 'n';
$cname[] = javelin_tag(
'span',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ public function processRequest() {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function processRequest() {

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testAddressSimilarity() {
foreach ($same as $address) {
$this->assertTrue(
PhabricatorMailReceiver::matchAddresses($base, $address),
"Address {$address}");
pht('Address %s', $address));
}

$diff = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public function loadResults() {
}

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());
Expand Down
Loading

0 comments on commit f47e69c

Please sign in to comment.