diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -74,7 +74,6 @@ "type": "xhpast", "include": "(\\.php$)", "severity": { - "16": "advice", "34": "error" }, "xhpast.blacklisted.function": { diff --git a/resources/sql/autopatches/20140106.macromailkey.2.php b/resources/sql/autopatches/20140106.macromailkey.2.php --- a/resources/sql/autopatches/20140106.macromailkey.2.php +++ b/resources/sql/autopatches/20140106.macromailkey.2.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ foreach ($iterator as $macro) { $id = $macro->getID(); - echo "Populating macro {$id}...\n"; + echo pht('Populating macro %d...', $id)."\n"; if (!$macro->getMailKey()) { queryfx( @@ -20,4 +20,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140108.ddbpname.2.php b/resources/sql/autopatches/20140108.ddbpname.2.php --- a/resources/sql/autopatches/20140108.ddbpname.2.php +++ b/resources/sql/autopatches/20140108.ddbpname.2.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ foreach ($iterator as $blueprint) { $id = $blueprint->getID(); - echo "Populating blueprint {$id}...\n"; + echo pht('Populating blueprint %d...', $id)."\n"; if (!strlen($blueprint->getBlueprintName())) { queryfx( @@ -20,4 +20,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140113.legalpadsig.2.php b/resources/sql/autopatches/20140113.legalpadsig.2.php --- a/resources/sql/autopatches/20140113.legalpadsig.2.php +++ b/resources/sql/autopatches/20140113.legalpadsig.2.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ foreach ($iterator as $sig) { $id = $sig->getID(); - echo "Populating signature {$id}...\n"; + echo pht('Populating signature %d...', $id)."\n"; if (!$sig->getSecretKey()) { queryfx( @@ -20,4 +20,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140115.auth.3.unlimit.php b/resources/sql/autopatches/20140115.auth.3.unlimit.php --- a/resources/sql/autopatches/20140115.auth.3.unlimit.php +++ b/resources/sql/autopatches/20140115.auth.3.unlimit.php @@ -9,7 +9,7 @@ foreach (new LiskMigrationIterator($session_table) as $session) { $id = $session->getID(); - echo "Migrating session {$id}...\n"; + echo pht('Migrating session %d...', $id)."\n"; $old_type = $session->getType(); $new_type = preg_replace('/-.*$/', '', $old_type); @@ -23,4 +23,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140205.cal.3.phid-mig.php b/resources/sql/autopatches/20140205.cal.3.phid-mig.php --- a/resources/sql/autopatches/20140205.cal.3.phid-mig.php +++ b/resources/sql/autopatches/20140205.cal.3.phid-mig.php @@ -3,11 +3,11 @@ $table = new PhabricatorCalendarEvent(); $conn_w = $table->establishConnection('w'); -echo "Assigning PHIDs to events...\n"; +echo pht('Assigning PHIDs to events...')."\n"; foreach (new LiskMigrationIterator($table) as $event) { $id = $event->getID(); - echo "Updating event {$id}...\n"; + echo pht('Updating event %d...', $id)."\n"; if ($event->getPHID()) { continue; } @@ -19,4 +19,4 @@ $table->generatePHID(), $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140210.herald.rule-condition-mig.php b/resources/sql/autopatches/20140210.herald.rule-condition-mig.php --- a/resources/sql/autopatches/20140210.herald.rule-condition-mig.php +++ b/resources/sql/autopatches/20140210.herald.rule-condition-mig.php @@ -3,7 +3,8 @@ $table = new HeraldCondition(); $conn_w = $table->establishConnection('w'); -echo "Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n"; +echo pht( + "Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n"); foreach (new LiskMigrationIterator($table) as $condition) { if ($condition->getFieldName() != HeraldAdapter::FIELD_RULE) { continue; @@ -14,7 +15,7 @@ continue; } $id = $condition->getID(); - echo "Updating condition {$id}...\n"; + echo pht('Updating condition %s...', $id)."\n"; $rule = id(new HeraldRuleQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) @@ -28,4 +29,4 @@ json_encode($rule->getPHID()), $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140210.projcfield.1.blurb.php b/resources/sql/autopatches/20140210.projcfield.1.blurb.php --- a/resources/sql/autopatches/20140210.projcfield.1.blurb.php +++ b/resources/sql/autopatches/20140210.projcfield.1.blurb.php @@ -5,10 +5,9 @@ $rows = new LiskRawMigrationIterator($conn_w, 'project_profile'); -echo "Migrating project descriptions to custom storage...\n"; +echo pht('Migrating project descriptions to custom storage...')."\n"; foreach ($rows as $row) { $phid = $row['projectPHID']; - echo "Migrating {$phid}...\n"; $desc = $row['blurb']; if (strlen($desc)) { @@ -23,4 +22,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php --- a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php +++ b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php @@ -7,18 +7,18 @@ PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Differential comment text to modern storage...\n"; +echo pht('Migrating Differential comment text to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating Differential comment {$id}...\n"; + echo pht('Migrating Differential comment %d...', $id)."\n"; if (!strlen($row['content'])) { - echo "Comment has no text, continuing.\n"; + echo pht('Comment has no text, continuing.')."\n"; continue; } $revision = id(new DifferentialRevision())->load($row['revisionID']); if (!$revision) { - echo "Comment has no valid revision, continuing.\n"; + echo pht('Comment has no valid revision, continuing.')."\n"; continue; } @@ -68,4 +68,4 @@ $row['id']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140212.dx.1.armageddon.php b/resources/sql/autopatches/20140212.dx.1.armageddon.php --- a/resources/sql/autopatches/20140212.dx.1.armageddon.php +++ b/resources/sql/autopatches/20140212.dx.1.armageddon.php @@ -7,14 +7,14 @@ PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Differential comments to modern storage...\n"; +echo pht('Migrating Differential comments to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating comment {$id}...\n"; + echo pht('Migrating comment %d...', $id)."\n"; $revision = id(new DifferentialRevision())->load($row['revisionID']); if (!$revision) { - echo "No revision, continuing.\n"; + echo pht('No revision, continuing.')."\n"; continue; } @@ -219,4 +219,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140218.passwords.4.vcs.php b/resources/sql/autopatches/20140218.passwords.4.vcs.php --- a/resources/sql/autopatches/20140218.passwords.4.vcs.php +++ b/resources/sql/autopatches/20140218.passwords.4.vcs.php @@ -3,13 +3,13 @@ $table = new PhabricatorRepositoryVCSPassword(); $conn_w = $table->establishConnection('w'); -echo "Upgrading password hashing for VCS passwords.\n"; +echo pht('Upgrading password hashing for VCS passwords.')."\n"; $best_hasher = PhabricatorPasswordHasher::getBestHasher(); foreach (new LiskMigrationIterator($table) as $password) { $id = $password->getID(); - echo "Migrating VCS password {$id}...\n"; + echo pht('Migrating VCS password %d...', $id)."\n"; $input_hash = $password->getPasswordHash(); $input_envelope = new PhutilOpaqueEnvelope($input_hash); @@ -24,4 +24,4 @@ $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php b/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php --- a/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php +++ b/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php @@ -3,12 +3,12 @@ $conn_w = id(new DifferentialRevision())->establishConnection('w'); $rows = new LiskRawMigrationIterator($conn_w, 'differential_auxiliaryfield'); -echo "Modernizing Differential auxiliary field storage...\n"; +echo pht('Modernizing Differential auxiliary field storage...')."\n"; $table_name = id(new DifferentialCustomFieldStorage())->getTableName(); foreach ($rows as $row) { $id = $row['id']; - echo "Migrating row {$id}...\n"; + echo pht('Migrating row %d...', $id)."\n"; queryfx( $conn_w, 'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue) @@ -19,4 +19,4 @@ $row['value']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140321.mstatus.2.mig.php b/resources/sql/autopatches/20140321.mstatus.2.mig.php --- a/resources/sql/autopatches/20140321.mstatus.2.mig.php +++ b/resources/sql/autopatches/20140321.mstatus.2.mig.php @@ -11,10 +11,10 @@ $conn_w = id(new ManiphestTask())->establishConnection('w'); -echo "Migrating tasks to new status constants...\n"; +echo pht('Migrating tasks to new status constants...')."\n"; foreach (new LiskMigrationIterator(new ManiphestTask()) as $task) { $id = $task->getID(); - echo "Migrating T{$id}...\n"; + echo pht('Migrating %s...', "T{$id}")."\n"; $status = $task->getStatus(); if (isset($status_map[$status])) { @@ -27,13 +27,13 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; -echo "Migrating task transactions to new status constants...\n"; +echo pht('Migrating task transactions to new status constants...')."\n"; foreach (new LiskMigrationIterator(new ManiphestTransaction()) as $xaction) { $id = $xaction->getID(); - echo "Migrating {$id}...\n"; + echo pht('Migrating %d...', $id)."\n"; if ($xaction->getTransactionType() == ManiphestTransaction::TYPE_STATUS) { $old = $xaction->getOldValue(); @@ -55,14 +55,14 @@ $id); } } -echo "Done.\n"; +echo pht('Done.')."\n"; $conn_w = id(new PhabricatorSavedQuery())->establishConnection('w'); -echo "Migrating searches to new status constants...\n"; +echo pht('Migrating searches to new status constants...')."\n"; foreach (new LiskMigrationIterator(new PhabricatorSavedQuery()) as $query) { $id = $query->getID(); - echo "Migrating {$id}...\n"; + echo pht('Migrating %d...', $id)."\n"; if ($query->getEngineClassName() !== 'ManiphestTaskSearchEngine') { continue; @@ -91,4 +91,4 @@ } } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140323.harbor.1.renames.php b/resources/sql/autopatches/20140323.harbor.1.renames.php --- a/resources/sql/autopatches/20140323.harbor.1.renames.php +++ b/resources/sql/autopatches/20140323.harbor.1.renames.php @@ -14,14 +14,14 @@ id(new HarbormasterBuildTarget())->getTableName(), ); -echo "Renaming Harbormaster classes...\n"; +echo pht('Renaming Harbormaster classes...')."\n"; $conn_w = id(new HarbormasterBuildStep())->establishConnection('w'); foreach ($names as $name) { $old = $name; $new = 'Harbormaster'.$name; - echo "Renaming {$old} -> {$new}...\n"; + echo pht('Renaming %s -> %s...', $old, $new)."\n"; foreach ($tables as $table) { queryfx( $conn_w, @@ -32,4 +32,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140325.push.3.groups.php b/resources/sql/autopatches/20140325.push.3.groups.php --- a/resources/sql/autopatches/20140325.push.3.groups.php +++ b/resources/sql/autopatches/20140325.push.3.groups.php @@ -2,7 +2,7 @@ $conn_w = id(new PhabricatorRepository())->establishConnection('w'); -echo "Adding transaction log event groups...\n"; +echo pht('Adding transaction log event groups...')."\n"; $logs = queryfx_all( $conn_w, @@ -10,7 +10,7 @@ 'repository_pushlog'); foreach ($logs as $log) { $id = $log['id']; - echo "Migrating log {$id}...\n"; + echo pht('Migrating log %d...', $id)."\n"; if ($log['pushEventPHID']) { continue; } @@ -40,4 +40,4 @@ $log['transactionKey']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140410.accountsecret.2.php b/resources/sql/autopatches/20140410.accountsecret.2.php --- a/resources/sql/autopatches/20140410.accountsecret.2.php +++ b/resources/sql/autopatches/20140410.accountsecret.2.php @@ -1,12 +1,10 @@ getID(); - echo "Updating {$id}...\n"; + echo pht('Updating %d...', $id)."\n"; if (strlen($user->getAccountSecret())) { continue; @@ -20,4 +18,4 @@ $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140420.rel.2.objectmig.php b/resources/sql/autopatches/20140420.rel.2.objectmig.php --- a/resources/sql/autopatches/20140420.rel.2.objectmig.php +++ b/resources/sql/autopatches/20140420.rel.2.objectmig.php @@ -4,11 +4,11 @@ $table_name = $pull_table->getTableName(); $conn_w = $pull_table->establishConnection('w'); -echo "Setting object PHIDs for requests...\n"; +echo pht('Setting object PHIDs for requests...')."\n"; foreach (new LiskMigrationIterator($pull_table) as $pull) { $id = $pull->getID(); - echo "Migrating pull request {$id}...\n"; + echo pht('Migrating pull request %d...', $id)."\n"; if ($pull->getRequestedObjectPHID()) { // We already have a valid PHID, so skip this request. continue; @@ -42,4 +42,4 @@ $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140521.projectslug.2.mig.php b/resources/sql/autopatches/20140521.projectslug.2.mig.php --- a/resources/sql/autopatches/20140521.projectslug.2.mig.php +++ b/resources/sql/autopatches/20140521.projectslug.2.mig.php @@ -6,16 +6,16 @@ $slug_table_name = id(new PhabricatorProjectSlug())->getTableName(); $time = time(); -echo "Migrating project phriction slugs...\n"; +echo pht('Migrating project phriction slugs...')."\n"; foreach (new LiskMigrationIterator($project_table) as $project) { $id = $project->getID(); - echo "Migrating project {$id}...\n"; + echo pht('Migrating project %d...', $id)."\n"; $phriction_slug = rtrim($project->getPhrictionSlug(), '/'); $slug = id(new PhabricatorProjectSlug()) ->loadOneWhere('slug = %s', $phriction_slug); if ($slug) { - echo "Already migrated {$id}... Continuing.\n"; + echo pht('Already migrated %d... Continuing.', $id)."\n"; continue; } queryfx( @@ -27,7 +27,7 @@ $phriction_slug, $time, $time); - echo "Migrated {$id}.\n"; + echo pht('Migrated %d.', $id)."\n"; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140711.pnames.2.php b/resources/sql/autopatches/20140711.pnames.2.php --- a/resources/sql/autopatches/20140711.pnames.2.php +++ b/resources/sql/autopatches/20140711.pnames.2.php @@ -1,11 +1,11 @@ getName(); - echo "Updating project '{$name}'...\n"; + echo pht("Updating project '%d'...", $name)."\n"; $project->updateDatasourceTokens(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140722.appname.php b/resources/sql/autopatches/20140722.appname.php --- a/resources/sql/autopatches/20140722.appname.php +++ b/resources/sql/autopatches/20140722.appname.php @@ -74,7 +74,7 @@ /* -( User preferences )--------------------------------------------------- */ -echo "Migrating user preferences...\n"; +echo pht('Migrating user preferences...')."\n"; $table = new PhabricatorUserPreferences(); $conn_w = $table->establishConnection('w'); $pref_pinned = PhabricatorUserPreferences::PREFERENCE_APP_PINNED; @@ -107,7 +107,7 @@ /* -( Dashboard installs )------------------------------------------------- */ -echo "Migrating dashboard installs...\n"; +echo pht('Migrating dashboard installs...')."\n"; $table = new PhabricatorDashboardInstall(); $conn_w = $table->establishConnection('w'); @@ -126,7 +126,7 @@ /* -( Phabricator configuration )------------------------------------------ */ $config_key = 'phabricator.uninstalled-applications'; -echo "Migrating `{$config_key}` config...\n"; +echo pht('Migrating `%s` config...', $config_key)."\n"; $config = PhabricatorConfigEntry::loadConfigEntry($config_key); $old_config = $config->getValue(); @@ -147,7 +147,7 @@ /* -( phabricator.application-settings )----------------------------------- */ $config_key = 'phabricator.application-settings'; -echo "Migrating `{$config_key}` config...\n"; +echo pht('Migrating `%s` config...', $config_key)."\n"; $config = PhabricatorConfigEntry::loadConfigEntry($config_key); $old_config = $config->getValue(); diff --git a/resources/sql/autopatches/20140722.audit.3.miginlines.php b/resources/sql/autopatches/20140722.audit.3.miginlines.php --- a/resources/sql/autopatches/20140722.audit.3.miginlines.php +++ b/resources/sql/autopatches/20140722.audit.3.miginlines.php @@ -7,7 +7,7 @@ $src_table = 'audit_inlinecomment'; $dst_table = 'audit_transaction_comment'; -echo "Migrating Audit inline comments to new format...\n"; +echo pht('Migrating Audit inline comments to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, @@ -17,7 +17,7 @@ foreach ($rows as $row) { $id = $row['id']; - echo "Migrating inline #{$id}...\n"; + echo pht('Migrating inline #%d...', $id); if ($row['auditCommentID']) { $xaction_phid = PhabricatorPHID::generateNewPHID( @@ -74,4 +74,4 @@ } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140722.audit.4.migtext.php b/resources/sql/autopatches/20140722.audit.4.migtext.php --- a/resources/sql/autopatches/20140722.audit.4.migtext.php +++ b/resources/sql/autopatches/20140722.audit.4.migtext.php @@ -7,12 +7,12 @@ PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Audit comment text to modern storage...\n"; +echo pht('Migrating Audit comment text to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating Audit comment {$id}...\n"; + echo pht('Migrating Audit comment %d...', $id)."\n"; if (!strlen($row['content'])) { - echo "Comment has no text, continuing.\n"; + echo pht('Comment has no text, continuing.')."\n"; continue; } @@ -58,4 +58,4 @@ $row['id']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140722.renameauth.php b/resources/sql/autopatches/20140722.renameauth.php --- a/resources/sql/autopatches/20140722.renameauth.php +++ b/resources/sql/autopatches/20140722.renameauth.php @@ -18,7 +18,7 @@ 'PhabricatorAuthProviderOAuthWordPress' => 'PhabricatorWordPressAuthProvider', ); -echo "Migrating auth providers...\n"; +echo pht('Migrating auth providers...')."\n"; $table = new PhabricatorAuthProviderConfig(); $conn_w = $table->establishConnection('w'); diff --git a/resources/sql/autopatches/20140725.audit.1.migxactions.php b/resources/sql/autopatches/20140725.audit.1.migxactions.php --- a/resources/sql/autopatches/20140725.audit.1.migxactions.php +++ b/resources/sql/autopatches/20140725.audit.1.migxactions.php @@ -7,10 +7,10 @@ PhabricatorContentSource::SOURCE_LEGACY, array())->serialize(); -echo "Migrating Audit comments to modern storage...\n"; +echo pht('Migrating Audit comments to modern storage...')."\n"; foreach ($rows as $row) { $id = $row['id']; - echo "Migrating comment {$id}...\n"; + echo pht('Migrating comment %d...', $id)."\n"; $comments = queryfx_all( $conn_w, @@ -147,4 +147,4 @@ } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140731.audit.1.subscribers.php b/resources/sql/autopatches/20140731.audit.1.subscribers.php --- a/resources/sql/autopatches/20140731.audit.1.subscribers.php +++ b/resources/sql/autopatches/20140731.audit.1.subscribers.php @@ -3,11 +3,11 @@ $table = new PhabricatorRepositoryAuditRequest(); $conn_w = $table->establishConnection('w'); -echo "Migrating Audit subscribers to subscriptions...\n"; +echo pht('Migrating Audit subscribers to subscriptions...')."\n"; foreach (new LiskMigrationIterator($table) as $request) { $id = $request->getID(); - echo "Migrating auditor {$id}...\n"; + echo pht("Migrating audit %d...\n", $id); if ($request->getAuditStatus() != 'cc') { // This isn't a "subscriber", so skip it. @@ -27,4 +27,4 @@ $request->delete(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140731.cancdn.php b/resources/sql/autopatches/20140731.cancdn.php --- a/resources/sql/autopatches/20140731.cancdn.php +++ b/resources/sql/autopatches/20140731.cancdn.php @@ -4,7 +4,7 @@ $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $file) { $id = $file->getID(); - echo "Updating flags for file {$id}...\n"; + echo pht('Updating flags for file %d...', $id)."\n"; $meta = $file->getMetadata(); if (!idx($meta, 'canCDN')) { diff --git a/resources/sql/autopatches/20140805.boardcol.2.php b/resources/sql/autopatches/20140805.boardcol.2.php --- a/resources/sql/autopatches/20140805.boardcol.2.php +++ b/resources/sql/autopatches/20140805.boardcol.2.php @@ -19,12 +19,12 @@ $sql = array(); foreach ($cols as $col_phid => $obj_phids) { - echo "Migrating column '{$col_phid}'...\n"; + echo pht("Migrating column '%s'...", $col_phid)."\n"; $column = id(new PhabricatorProjectColumn())->loadOneWhere( 'phid = %s', $col_phid); if (!$column) { - echo "Column '{$col_phid}' does not exist.\n"; + echo pht("Column '%s' does not exist.", $col_phid)."\n"; continue; } @@ -40,7 +40,7 @@ } } -echo "Inserting rows...\n"; +echo pht('Inserting rows...')."\n"; foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) { queryfx( $conn_w, @@ -50,4 +50,4 @@ $chunk); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140808.boardprop.3.php b/resources/sql/autopatches/20140808.boardprop.3.php --- a/resources/sql/autopatches/20140808.boardprop.3.php +++ b/resources/sql/autopatches/20140808.boardprop.3.php @@ -6,7 +6,7 @@ foreach (new LiskMigrationIterator($table) as $column) { $id = $column->getID(); - echo "Adjusting column {$id}...\n"; + echo pht('Adjusting column %d...', $id)."\n"; if ($column->getSequence() == 0) { $properties = $column->getProperties(); @@ -21,4 +21,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140815.cancdncase.php b/resources/sql/autopatches/20140815.cancdncase.php --- a/resources/sql/autopatches/20140815.cancdncase.php +++ b/resources/sql/autopatches/20140815.cancdncase.php @@ -7,7 +7,10 @@ $conn_w = $table->establishConnection('w'); foreach (new LiskMigrationIterator($table) as $file) { $id = $file->getID(); - echo "Updating capitalization of canCDN property for file {$id}...\n"; + echo pht( + "Updating capitalization of %s property for file %d...\n", + 'canCDN', + $id); $meta = $file->getMetadata(); if (isset($meta['cancdn'])) { diff --git a/resources/sql/autopatches/20140904.macroattach.php b/resources/sql/autopatches/20140904.macroattach.php --- a/resources/sql/autopatches/20140904.macroattach.php +++ b/resources/sql/autopatches/20140904.macroattach.php @@ -4,7 +4,7 @@ foreach (new LiskMigrationIterator($table) as $macro) { $name = $macro->getName(); - echo "Linking macro '{$name}'...\n"; + echo pht("Linking macro '%s'...", $name)."\n"; $editor = new PhabricatorEdgeEditor(); @@ -16,11 +16,11 @@ foreach ($phids as $phid) { $editor->addEdge( $macro->getPHID(), - PhabricatorObjectHasFileEdgeType::EDGECONST , + PhabricatorObjectHasFileEdgeType::EDGECONST, $phid); } $editor->save(); } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20140914.betaproto.php b/resources/sql/autopatches/20140914.betaproto.php --- a/resources/sql/autopatches/20140914.betaproto.php +++ b/resources/sql/autopatches/20140914.betaproto.php @@ -3,16 +3,16 @@ $old_key = 'phabricator.show-beta-applications'; $new_key = 'phabricator.show-prototypes'; -echo "Migrating '{$old_key}' to '{$new_key}'...\n"; +echo pht("Migrating '%s' to '%s'...", $old_key, $new_key)."\n"; if (PhabricatorEnv::getEnvConfig($new_key)) { - echo "Skipping migration, new data is already set.\n"; + echo pht('Skipping migration, new data is already set.')."\n"; return; } $old = PhabricatorEnv::getEnvConfigIfExists($old_key); if (!$old) { - echo "Skipping migration, old data does not exist.\n"; + echo pht('Skipping migration, old data does not exist.')."\n"; return; } @@ -21,4 +21,4 @@ ->setValue($old) ->save(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141107.phriction.policy.2.php b/resources/sql/autopatches/20141107.phriction.policy.2.php --- a/resources/sql/autopatches/20141107.phriction.policy.2.php +++ b/resources/sql/autopatches/20141107.phriction.policy.2.php @@ -3,7 +3,7 @@ $table = new PhrictionDocument(); $conn_w = $table->establishConnection('w'); -echo "Populating Phriction policies.\n"; +echo pht('Populating Phriction policies.')."\n"; $default_view_policy = PhabricatorPolicies::POLICY_USER; $default_edit_policy = PhabricatorPolicies::POLICY_USER; @@ -12,7 +12,7 @@ $id = $doc->getID(); if ($doc->getViewPolicy() && $doc->getEditPolicy()) { - echo "Skipping doc $id; already has policy set.\n"; + echo pht('Skipping document %d; already has policy set.', $id)."\n"; continue; } @@ -38,7 +38,10 @@ $edit_policy = nonempty($project->getEditPolicy(), $default_edit_policy); $project_name = $project->getName(); - echo "Migrating doc $id to project policy $project_name...\n"; + echo pht( + "Migrating document %d to project policy %s...\n", + $id, + $project_name); $doc->setViewPolicy($view_policy); $doc->setEditPolicy($edit_policy); $doc->save(); @@ -46,10 +49,10 @@ } } - echo "Migrating doc $id to default install policy...\n"; + echo pht('Migrating document %d to default install policy...', $id)."\n"; $doc->setViewPolicy($default_view_policy); $doc->setEditPolicy($default_edit_policy); $doc->save(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141107.phriction.popkeys.php b/resources/sql/autopatches/20141107.phriction.popkeys.php --- a/resources/sql/autopatches/20141107.phriction.popkeys.php +++ b/resources/sql/autopatches/20141107.phriction.popkeys.php @@ -3,7 +3,7 @@ $table = new PhrictionDocument(); $conn_w = $table->establishConnection('w'); -echo "Populating Phriction mailkeys.\n"; +echo pht('Populating Phriction mailkeys.')."\n"; foreach (new LiskMigrationIterator($table) as $doc) { $id = $doc->getID(); @@ -12,10 +12,10 @@ if ((strlen($key) == 20) && (strpos($key, "\0") === false)) { // To be valid, keys must have length 20 and not contain any null bytes. // See T6487. - echo "Document has valid mailkey.\n"; + echo pht('Document has valid mailkey.')."\n"; continue; } else { - echo "Populating mailkey for document {$id}...\n"; + echo pht('Populating mailkey for document %d...', $id)."\n"; $mail_key = Filesystem::readRandomCharacters(20); queryfx( $conn_w, @@ -26,4 +26,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141107.ssh.4.keymig.php b/resources/sql/autopatches/20141107.ssh.4.keymig.php --- a/resources/sql/autopatches/20141107.ssh.4.keymig.php +++ b/resources/sql/autopatches/20141107.ssh.4.keymig.php @@ -3,18 +3,18 @@ $table = new PhabricatorAuthSSHKey(); $conn_w = $table->establishConnection('w'); -echo "Updating SSH public key indexes...\n"; +echo pht('Updating SSH public key indexes...')."\n"; $keys = new LiskMigrationIterator($table); foreach ($keys as $key) { $id = $key->getID(); - echo "Updating key {$id}...\n"; + echo pht('Updating key %d...', $id)."\n"; try { $hash = $key->toPublicKey()->getHash(); } catch (Exception $ex) { - echo "Key has bad format! Removing key.\n"; + echo pht('Key has bad format! Removing key.')."\n"; queryfx( $conn_w, 'DELETE FROM %T WHERE id = %d', @@ -30,7 +30,7 @@ $hash, $key->getID()); if ($collision) { - echo "Key is a duplicate! Removing key.\n"; + echo pht('Key is a duplicate! Removing key.')."\n"; queryfx( $conn_w, 'DELETE FROM %T WHERE id = %d', @@ -47,4 +47,4 @@ $key->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141113.auditdupes.php b/resources/sql/autopatches/20141113.auditdupes.php --- a/resources/sql/autopatches/20141113.auditdupes.php +++ b/resources/sql/autopatches/20141113.auditdupes.php @@ -3,7 +3,7 @@ $table = new PhabricatorRepositoryAuditRequest(); $conn_w = $table->establishConnection('w'); -echo "Removing duplicate Audit requests...\n"; +echo pht('Removing duplicate Audit requests...')."\n"; $seen_audit_map = array(); foreach (new LiskMigrationIterator($table) as $request) { $commit_phid = $request->getCommitPHID(); @@ -19,4 +19,4 @@ $seen_audit_map[$commit_phid][$auditor_phid] = 1; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141218.maniphestcctxn.php b/resources/sql/autopatches/20141218.maniphestcctxn.php --- a/resources/sql/autopatches/20141218.maniphestcctxn.php +++ b/resources/sql/autopatches/20141218.maniphestcctxn.php @@ -3,8 +3,9 @@ $table = new ManiphestTransaction(); $conn_w = $table->establishConnection('w'); -echo "Converting Maniphest CC transactions to modern SUBSCRIBER ". - "transactions...\n"; +echo pht( + "Converting Maniphest CC transactions to modern ". + "subscriber transactions...\n"); foreach (new LiskMigrationIterator($table) as $txn) { // ManiphestTransaction::TYPE_CCS if ($txn->getTransactionType() == 'ccs') { @@ -17,4 +18,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20141222.maniphestprojtxn.php b/resources/sql/autopatches/20141222.maniphestprojtxn.php --- a/resources/sql/autopatches/20141222.maniphestprojtxn.php +++ b/resources/sql/autopatches/20141222.maniphestprojtxn.php @@ -3,8 +3,8 @@ $table = new ManiphestTransaction(); $conn_w = $table->establishConnection('w'); -echo "Converting Maniphest project transactions to modern EDGE ". - "transactions...\n"; +echo pht( + "Converting Maniphest project transactions to modern edge transactions...\n"); $metadata = array( 'edge:type' => PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, ); @@ -31,7 +31,7 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; function mig20141222_build_edge_data(array $project_phids, $task_phid) { $edge_data = array(); diff --git a/resources/sql/autopatches/20150102.policyname.php b/resources/sql/autopatches/20150102.policyname.php --- a/resources/sql/autopatches/20150102.policyname.php +++ b/resources/sql/autopatches/20150102.policyname.php @@ -15,7 +15,7 @@ $map[$old_name] = $new_name; } -echo "Migrating policies...\n"; +echo pht('Migrating policies...')."\n"; $table = new PhabricatorPolicy(); $conn_w = $table->establishConnection('w'); diff --git a/resources/sql/autopatches/20150116.maniphestapplicationemails.php b/resources/sql/autopatches/20150116.maniphestapplicationemails.php --- a/resources/sql/autopatches/20150116.maniphestapplicationemails.php +++ b/resources/sql/autopatches/20150116.maniphestapplicationemails.php @@ -1,7 +1,7 @@ setApplicationPHID($maniphest->getPHID()) ->save(); } catch (AphrontDuplicateKeyQueryException $ex) { - // already migrated? + // Already migrated? } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20150120.maniphestdefaultauthor.php b/resources/sql/autopatches/20150120.maniphestdefaultauthor.php --- a/resources/sql/autopatches/20150120.maniphestdefaultauthor.php +++ b/resources/sql/autopatches/20150120.maniphestdefaultauthor.php @@ -1,7 +1,7 @@ setApplicationPHID($files_app->getPHID()) ->save(); } catch (AphrontDuplicateKeyQueryException $ex) { - // already migrated? + // Already migrated? } } @@ -31,8 +33,8 @@ ->setApplicationPHID($paste_app->getPHID()) ->save(); } catch (AphrontDuplicateKeyQueryException $ex) { - // already migrated? + // Already migrated? } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20150501.calendar.2.reply.php b/resources/sql/autopatches/20150501.calendar.2.reply.php --- a/resources/sql/autopatches/20150501.calendar.2.reply.php +++ b/resources/sql/autopatches/20150501.calendar.2.reply.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -8,7 +8,7 @@ foreach ($iterator as $event) { $id = $event->getID(); - echo "Populating event {$id}...\n"; + echo pht('Populating event %d...', $id)."\n"; queryfx( $conn_w, @@ -18,4 +18,4 @@ $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php --- a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php +++ b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php @@ -1,6 +1,6 @@ establishConnection('w'); @@ -9,7 +9,7 @@ $id = $event->getID(); if (strlen($event->getName()) == 0) { - echo "Renaming event {$id}...\n"; + echo pht('Renaming event %d...', $id)."\n"; $viewer = PhabricatorUser::getOmnipotentUser(); // NOTE: This uses PeopleQuery directly, instead of HandleQuery, to avoid @@ -35,4 +35,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/059.engines.php b/resources/sql/patches/059.engines.php --- a/resources/sql/patches/059.engines.php +++ b/resources/sql/patches/059.engines.php @@ -15,17 +15,18 @@ return; } -echo "There are ".count($tables)." tables using the MyISAM engine. These will ". - "now be converted to InnoDB. This process may take a few minutes, please ". - "be patient.\n"; +echo pht( + "There are %d tables using the MyISAM engine. These will now be converted ". + "to InnoDB. This process may take a few minutes, please be patient.\n", + count($tables)); foreach ($tables as $table) { $name = $table['db'].'.'.$table['tbl']; - echo "Converting {$name}...\n"; + echo pht('Converting %s...', $name)."\n"; queryfx( $conn, 'ALTER TABLE %T.%T ENGINE=InnoDB', $table['db'], $table['tbl']); } -echo "Done!\n"; +echo pht('Done!')."\n"; diff --git a/resources/sql/patches/079.nametokenindex.php b/resources/sql/patches/079.nametokenindex.php --- a/resources/sql/patches/079.nametokenindex.php +++ b/resources/sql/patches/079.nametokenindex.php @@ -1,13 +1,13 @@ openTransaction(); $table->beginReadLocking(); $users = $table->loadAll(); -echo count($users).' users to index'; +echo pht('%d users to index', count($users)); foreach ($users as $user) { $user->updateNameTokens(); echo '.'; @@ -15,4 +15,4 @@ $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/081.filekeys.php b/resources/sql/patches/081.filekeys.php --- a/resources/sql/patches/081.filekeys.php +++ b/resources/sql/patches/081.filekeys.php @@ -1,12 +1,12 @@ openTransaction(); $table->beginReadLocking(); $files = $table->loadAllWhere('secretKey IS NULL'); -echo count($files).' files to generate keys for'; +echo pht('%d files to generate keys for', count($files)); foreach ($files as $file) { queryfx( $file->establishConnection('w'), @@ -19,4 +19,4 @@ $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/090.forceuniqueprojectnames.php b/resources/sql/patches/090.forceuniqueprojectnames.php --- a/resources/sql/patches/090.forceuniqueprojectnames.php +++ b/resources/sql/patches/090.forceuniqueprojectnames.php @@ -1,6 +1,6 @@ openTransaction(); $table->beginReadLocking(); @@ -14,8 +14,8 @@ $slug = $project->getPhrictionSlug(); if ($slug == '/') { $project_id = $project->getID(); - echo "Project #{$project_id} doesn't have a meaningful name...\n"; - $project->setName(trim('Unnamed Project '.$project->getName())); + echo pht("Project #%d doesn't have a meaningful name...", $project_id)."\n"; + $project->setName(trim(pht('Unnamed Project %s', $project->getName()))); } $slug_map[$slug][] = $project->getID(); } @@ -25,15 +25,18 @@ if (count($similar) <= 1) { continue; } - echo "Too many projects are similar to '{$slug}'...\n"; + echo pht("Too many projects are similar to '%s'...", $slug)."\n"; foreach (array_slice($similar, 1, null, true) as $key => $project_id) { $project = $projects[$project_id]; $old_name = $project->getName(); $new_name = rename_project($project, $projects); - echo "Renaming project #{$project_id} ". - "from '{$old_name}' to '{$new_name}'.\n"; + echo pht( + "Renaming project #%d from '%s' to '%s'.\n", + $project_id, + $old_name, + $new_name); $project->setName($new_name); } } @@ -47,7 +50,7 @@ $project->setPhrictionSlug($name); $slug = $project->getPhrictionSlug(); - echo "Updating project #{$id} '{$name}' ({$slug})..."; + echo pht("Updating project #%d '%s' (%s)... ", $id, $name, $slug); try { queryfx( $project->establishConnection('w'), @@ -57,22 +60,23 @@ $slug, $project->getID()); unset($update[$key]); - echo "okay.\n"; + echo pht('OKAY')."\n"; } catch (AphrontDuplicateKeyQueryException $ex) { - echo "failed, will retry.\n"; + echo pht('Failed, will retry.')."\n"; } } if (count($update) == $size) { throw new Exception( - 'Failed to make any progress while updating projects. Schema upgrade '. - 'has failed. Go manually fix your project names to be unique (they are '. - 'probably ridiculous?) and then try again.'); + pht( + 'Failed to make any progress while updating projects. Schema upgrade '. + 'has failed. Go manually fix your project names to be unique '. + '(they are probably ridiculous?) and then try again.')); } } $table->endReadLocking(); $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; /** diff --git a/resources/sql/patches/093.gitremotes.php b/resources/sql/patches/093.gitremotes.php --- a/resources/sql/patches/093.gitremotes.php +++ b/resources/sql/patches/093.gitremotes.php @@ -1,6 +1,6 @@ openTransaction(); @@ -30,8 +30,13 @@ $id = $repo['id']; $name = $repo['name']; - echo "Updating default branch for repository #{$id} '{$name}' from ". - "'{$old}' to '{$new}' to remove the explicit remote.\n"; + echo pht( + "Updating default branch for repository #%d '%s' from ". + "'%s' to '%s' to remove the explicit remote.\n", + $id, + $name, + $old, + $new); queryfx( $conn_w, 'UPDATE %T SET details = %s WHERE id = %d', @@ -41,4 +46,4 @@ } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/098.heraldruletypemigration.php b/resources/sql/patches/098.heraldruletypemigration.php --- a/resources/sql/patches/098.heraldruletypemigration.php +++ b/resources/sql/patches/098.heraldruletypemigration.php @@ -1,6 +1,6 @@ openTransaction(); $table->beginReadLocking(); @@ -41,11 +41,11 @@ $rule->getRuleType(), $rule->getID()); - echo "Setting rule '".$rule->getName()."' to personal. "; + echo pht("Setting rule '%s' to personal.", $rule->getName())."\n"; } } } $table->endReadLocking(); $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/102.heraldcleanup.php b/resources/sql/patches/102.heraldcleanup.php --- a/resources/sql/patches/102.heraldcleanup.php +++ b/resources/sql/patches/102.heraldcleanup.php @@ -1,6 +1,6 @@ openTransaction(); $table->beginReadLocking(); @@ -24,7 +24,7 @@ mpull($rules, 'getID')); } -echo 'This may take a moment'; +echo pht('This may take a moment')."\n"; do { queryfx( $conn_w, @@ -36,4 +36,4 @@ $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/111.commitauditmigration.php b/resources/sql/patches/111.commitauditmigration.php --- a/resources/sql/patches/111.commitauditmigration.php +++ b/resources/sql/patches/111.commitauditmigration.php @@ -1,6 +1,6 @@ openTransaction(); @@ -31,10 +31,10 @@ } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; -echo "Updating old commit mailKeys...\n"; +echo pht('Updating old commit %s...', 'mailKeys')."\n"; $table->openTransaction(); $commits = queryfx_all( @@ -55,4 +55,4 @@ } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/131.migraterevisionquery.php b/resources/sql/patches/131.migraterevisionquery.php --- a/resources/sql/patches/131.migraterevisionquery.php +++ b/resources/sql/patches/131.migraterevisionquery.php @@ -5,7 +5,7 @@ $table->beginReadLocking(); $conn_w = $table->establishConnection('w'); -echo 'Migrating revisions'; +echo pht('Migrating revisions')."\n"; do { $revisions = $table->loadAllWhere('branchName IS NULL LIMIT 1000'); @@ -32,4 +32,4 @@ $table->endReadLocking(); $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20121209.xmacromigrate.php b/resources/sql/patches/20121209.xmacromigrate.php --- a/resources/sql/patches/20121209.xmacromigrate.php +++ b/resources/sql/patches/20121209.xmacromigrate.php @@ -1,6 +1,6 @@ openTransaction(); @@ -20,4 +20,4 @@ } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130201.revisionunsubscribed.php b/resources/sql/patches/20130201.revisionunsubscribed.php --- a/resources/sql/patches/20130201.revisionunsubscribed.php +++ b/resources/sql/patches/20130201.revisionunsubscribed.php @@ -1,6 +1,6 @@ openTransaction(); @@ -29,4 +29,4 @@ } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130218.updatechannelid.php b/resources/sql/patches/20130218.updatechannelid.php --- a/resources/sql/patches/20130218.updatechannelid.php +++ b/resources/sql/patches/20130218.updatechannelid.php @@ -1,6 +1,6 @@ saveTransaction(); $channel_table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130219.commitsummarymig.php b/resources/sql/patches/20130219.commitsummarymig.php --- a/resources/sql/patches/20130219.commitsummarymig.php +++ b/resources/sql/patches/20130219.commitsummarymig.php @@ -1,12 +1,12 @@ establishConnection('w'); $commits = new LiskMigrationIterator($table); foreach ($commits as $commit) { - echo 'Filling Commit #'.$commit->getID()."\n"; + echo pht('Filling Commit #%d', $commit->getID())."\n"; if (strlen($commit->getSummary())) { continue; @@ -28,4 +28,4 @@ $commit->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130403.conpherencecachemig.php b/resources/sql/patches/20130403.conpherencecachemig.php --- a/resources/sql/patches/20130403.conpherencecachemig.php +++ b/resources/sql/patches/20130403.conpherencecachemig.php @@ -1,6 +1,7 @@ openTransaction(); @@ -10,7 +11,7 @@ $conpherences = new LiskMigrationIterator($table); foreach ($conpherences as $conpherence) { - echo 'Migrating conpherence #'.$conpherence->getID()."\n"; + echo pht('Migrating conpherence #%d', $conpherence->getID())."\n"; $participants = id(new ConpherenceParticipant()) ->loadAllWhere('conpherencePHID = %s', $conpherence->getPHID()); @@ -61,4 +62,4 @@ } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130409.commitdrev.php b/resources/sql/patches/20130409.commitdrev.php --- a/resources/sql/patches/20130409.commitdrev.php +++ b/resources/sql/patches/20130409.commitdrev.php @@ -1,6 +1,6 @@ save(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130502.countdownrevamp2.php b/resources/sql/patches/20130502.countdownrevamp2.php --- a/resources/sql/patches/20130502.countdownrevamp2.php +++ b/resources/sql/patches/20130502.countdownrevamp2.php @@ -1,6 +1,6 @@ openTransaction(); @@ -20,4 +20,4 @@ } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130507.releephrqmailkeypop.php b/resources/sql/patches/20130507.releephrqmailkeypop.php --- a/resources/sql/patches/20130507.releephrqmailkeypop.php +++ b/resources/sql/patches/20130507.releephrqmailkeypop.php @@ -1,6 +1,6 @@ openTransaction(); @@ -17,11 +17,11 @@ $rq->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130529.macroauthormig.php b/resources/sql/patches/20130529.macroauthormig.php --- a/resources/sql/patches/20130529.macroauthormig.php +++ b/resources/sql/patches/20130529.macroauthormig.php @@ -1,8 +1,8 @@ getID()."\n"; + echo pht('Macro #%d', $macro->getID())."\n"; if ($macro->getAuthorPHID()) { // Already have an author; skip it. @@ -36,4 +36,4 @@ $macro->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130611.migrateoauth.php b/resources/sql/patches/20130611.migrateoauth.php --- a/resources/sql/patches/20130611.migrateoauth.php +++ b/resources/sql/patches/20130611.migrateoauth.php @@ -9,7 +9,7 @@ $xaccount = new PhabricatorExternalAccount(); -echo "Migrating OAuth to ExternalAccount...\n"; +echo pht('Migrating OAuth to %s...', 'ExternalAccount')."\n"; $domain_map = array( 'disqus' => 'disqus.com', @@ -31,18 +31,18 @@ $conn_w, 'SELECT * FROM user_oauthinfo'); foreach ($rows as $row) { - echo "Migrating row ID #".$row['id'].".\n"; + echo pht('Migrating row ID #%d.', $row['id'])."\n"; $user = id(new PhabricatorUser())->loadOneWhere( 'id = %d', $row['userID']); if (!$user) { - echo "Bad user ID!\n"; + echo pht('Bad user ID!')."\n"; continue; } $domain = idx($domain_map, $row['oauthProvider']); if (empty($domain)) { - echo "Unknown OAuth provider!\n"; + echo pht('Unknown OAuth provider!')."\n"; continue; } @@ -63,4 +63,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130611.nukeldap.php b/resources/sql/patches/20130611.nukeldap.php --- a/resources/sql/patches/20130611.nukeldap.php +++ b/resources/sql/patches/20130611.nukeldap.php @@ -9,16 +9,16 @@ $xaccount = new PhabricatorExternalAccount(); -echo "Migrating LDAP to ExternalAccount...\n"; +echo pht('Migrating LDAP to %s...', 'ExternalAccount')."\n"; $rows = queryfx_all($conn_w, 'SELECT * FROM %T', $table_name); foreach ($rows as $row) { - echo "Migrating row ID #".$row['id'].".\n"; + echo pht('Migrating row ID #%d.', $row['id'])."\n"; $user = id(new PhabricatorUser())->loadOneWhere( 'id = %d', $row['userID']); if (!$user) { - echo "Bad user ID!\n"; + echo pht('Bad user ID!')."\n"; continue; } @@ -38,4 +38,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130619.authconf.php b/resources/sql/patches/20130619.authconf.php --- a/resources/sql/patches/20130619.authconf.php +++ b/resources/sql/patches/20130619.authconf.php @@ -60,11 +60,11 @@ $enabled_default); if (!$enabled) { - echo pht("Skipping %s (not enabled).\n", $provider_class); + echo pht('Skipping %s (not enabled).', $provider_class)."\n"; // This provider was not previously enabled, so we can skip migrating it. continue; } else { - echo pht("Migrating %s...\n", $provider_class); + echo pht('Migrating %s...', $provider_class)."\n"; } $registration_key = idx($spec, 'registration'); @@ -161,4 +161,4 @@ $config->save(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130703.legalpaddocdenorm.php b/resources/sql/patches/20130703.legalpaddocdenorm.php --- a/resources/sql/patches/20130703.legalpaddocdenorm.php +++ b/resources/sql/patches/20130703.legalpaddocdenorm.php @@ -1,7 +1,9 @@ openTransaction(); @@ -9,14 +11,14 @@ $updated = false; $id = $document->getID(); - echo "Document {$id}: "; + echo pht('Document %d: ', $id); if (!$document->getTitle()) { $document_body = id(new LegalpadDocumentBody()) ->loadOneWhere('phid = %s', $document->getDocumentBodyPHID()); $title = $document_body->getTitle(); $document->setTitle($title); $updated = true; - echo "Added title: $title\n"; + echo pht('Added title: %s', $title)."\n"; } else { echo "-\n"; } @@ -29,9 +31,9 @@ $document->getPHID(), $type); $document->setRecentContributorPHIDs(array_slice($contributors, 0, 3)); - echo "Added recent contributor phids.\n"; + echo pht('Added recent contributor PHIDs.')."\n"; $document->setContributorCount(count($contributors)); - echo "Added contributor count.\n"; + echo pht('Added contributor count.')."\n"; } if (!$updated) { @@ -43,4 +45,4 @@ } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130711.pholioimageobsolete.php b/resources/sql/patches/20130711.pholioimageobsolete.php --- a/resources/sql/patches/20130711.pholioimageobsolete.php +++ b/resources/sql/patches/20130711.pholioimageobsolete.php @@ -1,6 +1,6 @@ openTransaction(); @@ -20,4 +20,4 @@ } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130711.trimrealnames.php b/resources/sql/patches/20130711.trimrealnames.php --- a/resources/sql/patches/20130711.trimrealnames.php +++ b/resources/sql/patches/20130711.trimrealnames.php @@ -3,18 +3,18 @@ $table = new PhabricatorUser(); $conn_w = $table->establishConnection('w'); -echo "Trimming trailing whitespace from user real names...\n"; +echo pht('Trimming trailing whitespace from user real names...')."\n"; foreach (new LiskMigrationIterator($table) as $user) { $id = $user->getID(); $real = $user->getRealName(); $trim = rtrim($real); if ($trim == $real) { - echo "User {$id} is already trim.\n"; + echo pht('User %d is already trim.', $id)."\n"; continue; } - echo "Trimming user {$id} from '{$real}' to '{$trim}'.\n"; + echo pht("Trimming user %d from '%s' to '%s'.", $id, $real, $trim)."\n"; qsprintf( $conn_w, 'UPDATE %T SET realName = %s WHERE id = %d', @@ -23,4 +23,4 @@ $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130715.votecomments.php b/resources/sql/patches/20130715.votecomments.php --- a/resources/sql/patches/20130715.votecomments.php +++ b/resources/sql/patches/20130715.votecomments.php @@ -1,6 +1,6 @@ setViewer($viewer) ->withIDs(array($poll_id)) ->executeOne(); if (!$poll) { - echo "No poll.\n"; + echo pht('No poll.')."\n"; continue; } @@ -36,7 +36,7 @@ ->withPHIDs(array($author_phid)) ->executeOne(); if (!$user) { - echo "No user.\n"; + echo pht('No user.')."\n"; continue; } @@ -98,4 +98,4 @@ $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130716.archivememberlessprojects.php b/resources/sql/patches/20130716.archivememberlessprojects.php --- a/resources/sql/patches/20130716.archivememberlessprojects.php +++ b/resources/sql/patches/20130716.archivememberlessprojects.php @@ -1,18 +1,17 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $project) { - $members = PhabricatorEdgeQuery::loadDestinationPHIDs( $project->getPHID(), PhabricatorProjectProjectHasMemberEdgeType::EDGECONST); if (count($members)) { - echo sprintf( + echo pht( 'Project "%s" has %d members; skipping.', $project->getName(), count($members)), "\n"; @@ -20,13 +19,13 @@ } if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ARCHIVED) { - echo sprintf( + echo pht( 'Project "%s" already archived; skipping.', $project->getName()), "\n"; continue; } - echo sprintf('Archiving project "%s"...', $project->getName()), "\n"; + echo pht('Archiving project "%s"...', $project->getName())."\n"; queryfx( $table->establishConnection('w'), 'UPDATE %T SET status = %s WHERE id = %d', @@ -36,4 +35,4 @@ } $table->saveTransaction(); -echo "\nDone.\n"; +echo "\n".pht('Done.')."\n"; diff --git a/resources/sql/patches/20130728.ponderunique.php b/resources/sql/patches/20130728.ponderunique.php --- a/resources/sql/patches/20130728.ponderunique.php +++ b/resources/sql/patches/20130728.ponderunique.php @@ -2,7 +2,7 @@ $map = array(); -echo "Merging duplicate answers by authors...\n"; +echo pht('Merging duplicate answers by authors...')."\n"; $atable = new PonderAnswer(); $conn_w = $atable->establishConnection('w'); @@ -14,14 +14,14 @@ $qid = $answer->getQuestionID(); $author_phid = $answer->getAuthorPHID(); - echo "Processing answer ID #{$aid}...\n"; + echo pht('Processing answer ID #%d...', $aid)."\n"; if (empty($map[$qid][$author_phid])) { - echo "Answer is unique.\n"; + echo pht('Answer is unique.')."\n"; $map[$qid][$author_phid] = $answer; continue; } else { - echo "Merging answer.\n"; + echo pht('Merging answer.')."\n"; $target = $map[$qid][$author_phid]; queryfx( $conn_w, @@ -55,4 +55,4 @@ } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130728.ponderxcomment.php b/resources/sql/patches/20130728.ponderxcomment.php --- a/resources/sql/patches/20130728.ponderxcomment.php +++ b/resources/sql/patches/20130728.ponderxcomment.php @@ -6,13 +6,13 @@ $conn_w = $qtable->establishConnection('w'); $conn_w->openTransaction(); -echo "Migrating Ponder comments to ApplicationTransactions...\n"; +echo pht('Migrating Ponder comments to %s...', 'ApplicationTransactions')."\n"; $rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment'); foreach ($rows as $row) { $id = $row['id']; - echo "Migrating {$id}...\n"; + echo pht('Migrating %d...', $id)."\n"; $type = phid_get_type($row['targetPHID']); switch ($type) { @@ -83,4 +83,4 @@ $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130801.pastexactions.php b/resources/sql/patches/20130801.pastexactions.php --- a/resources/sql/patches/20130801.pastexactions.php +++ b/resources/sql/patches/20130801.pastexactions.php @@ -6,13 +6,13 @@ $conn_w = $table->establishConnection('w'); $conn_w->openTransaction(); -echo "Adding transactions for existing paste objects...\n"; +echo pht('Adding transactions for existing paste objects...')."\n"; $rows = new LiskRawMigrationIterator($conn_w, 'pastebin_paste'); foreach ($rows as $row) { $id = $row['id']; - echo "Adding transactions for paste id {$id}...\n"; + echo pht('Adding transactions for paste id %d...', $id)."\n"; $xaction_phid = PhabricatorPHID::generateNewPHID( PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST); @@ -45,4 +45,4 @@ $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130802.heraldphids.php b/resources/sql/patches/20130802.heraldphids.php --- a/resources/sql/patches/20130802.heraldphids.php +++ b/resources/sql/patches/20130802.heraldphids.php @@ -3,11 +3,11 @@ $table = new HeraldRule(); $conn_w = $table->establishConnection('w'); -echo "Assigning PHIDs to Herald Rules...\n"; +echo pht('Assigning PHIDs to Herald Rules...')."\n"; foreach (new LiskMigrationIterator(new HeraldRule()) as $rule) { $id = $rule->getID(); - echo "Rule {$id}.\n"; + echo pht('Rule %d.', $id)."\n"; if ($rule->getPHID()) { continue; @@ -21,4 +21,4 @@ $rule->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130805.pastemailkeypop.php b/resources/sql/patches/20130805.pastemailkeypop.php --- a/resources/sql/patches/20130805.pastemailkeypop.php +++ b/resources/sql/patches/20130805.pastemailkeypop.php @@ -1,6 +1,6 @@ openTransaction(); @@ -17,11 +17,11 @@ $paste->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130820.file-mailkey-populate.php b/resources/sql/patches/20130820.file-mailkey-populate.php --- a/resources/sql/patches/20130820.file-mailkey-populate.php +++ b/resources/sql/patches/20130820.file-mailkey-populate.php @@ -1,6 +1,6 @@ getTableName(); @@ -35,4 +35,4 @@ } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130915.maniphestmigrate.php b/resources/sql/patches/20130915.maniphestmigrate.php --- a/resources/sql/patches/20130915.maniphestmigrate.php +++ b/resources/sql/patches/20130915.maniphestmigrate.php @@ -5,12 +5,12 @@ $rows = new LiskRawMigrationIterator($conn_w, 'maniphest_taskauxiliarystorage'); -echo "Migrating custom storage for Maniphest fields...\n"; +echo pht('Migrating custom storage for Maniphest fields...')."\n"; foreach ($rows as $row) { $phid = $row['taskPHID']; $name = $row['name']; - echo "Migrating {$phid} / {$name}...\n"; + echo pht('Migrating %s / %s...', $phid, $name)."\n"; queryfx( $conn_w, @@ -22,4 +22,4 @@ $row['value']); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130919.mfieldconf.php b/resources/sql/patches/20130919.mfieldconf.php --- a/resources/sql/patches/20130919.mfieldconf.php +++ b/resources/sql/patches/20130919.mfieldconf.php @@ -1,18 +1,18 @@ setValue($new) ->save(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130921.xmigratemaniphest.php b/resources/sql/patches/20130921.xmigratemaniphest.php --- a/resources/sql/patches/20130921.xmigratemaniphest.php +++ b/resources/sql/patches/20130921.xmigratemaniphest.php @@ -14,7 +14,7 @@ $row_id = $row['id']; $task_id = $row['taskID']; - echo "Migrating row {$row_id} (T{$task_id})...\n"; + echo pht('Migrating row %d (%s)...', $row_id, "T{$task_id}")."\n"; $task_row = queryfx_one( $conn_w, @@ -22,7 +22,7 @@ $task_table->getTableName(), $task_id); if (!$task_row) { - echo "Skipping, no such task.\n"; + echo pht('Skipping, no such task.')."\n"; continue; } @@ -145,4 +145,4 @@ } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20130926.dinline.php b/resources/sql/patches/20130926.dinline.php --- a/resources/sql/patches/20130926.dinline.php +++ b/resources/sql/patches/20130926.dinline.php @@ -7,7 +7,7 @@ $src_table = 'differential_inlinecomment'; $dst_table = 'differential_transaction_comment'; -echo "Migrating Differential inline comments to new format...\n"; +echo pht('Migrating Differential inline comments to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, @@ -19,7 +19,7 @@ $revision_id = $row['revisionID']; - echo "Migrating inline #{$id} (D{$revision_id})...\n"; + echo pht('Migrating inline #%d (%s)...', $id, "D{$revision_id}")."\n"; $revision_row = queryfx_one( $conn_w, @@ -87,4 +87,4 @@ } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131004.dxreviewers.php b/resources/sql/patches/20131004.dxreviewers.php --- a/resources/sql/patches/20131004.dxreviewers.php +++ b/resources/sql/patches/20131004.dxreviewers.php @@ -10,7 +10,7 @@ $revision_id = $revision->getID(); $revision_phid = $revision->getPHID(); - echo "Migrating reviewers for D{$revision_id}...\n"; + echo pht('Migrating reviewers for %s...', "D{$revision_id}")."\n"; $reviewer_phids = queryfx_all( $conn_w, @@ -48,4 +48,4 @@ $editor->save(); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131020.pxactionmig.php b/resources/sql/patches/20131020.pxactionmig.php --- a/resources/sql/patches/20131020.pxactionmig.php +++ b/resources/sql/patches/20131020.pxactionmig.php @@ -7,7 +7,7 @@ $src_table = 'project_legacytransaction'; $dst_table = 'project_transaction'; -echo "Migrating Project transactions to new format...\n"; +echo pht('Migrating Project transactions to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( PhabricatorContentSource::SOURCE_LEGACY, @@ -19,7 +19,7 @@ $project_id = $row['projectID']; - echo "Migrating transaction #{$id} (Project {$project_id})...\n"; + echo pht('Migrating transaction #%d (Project %d)...', $id, $project_id)."\n"; $project_row = queryfx_one( $conn_w, @@ -89,4 +89,4 @@ } $conn_w->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131106.diffphid.2.mig.php b/resources/sql/patches/20131106.diffphid.2.mig.php --- a/resources/sql/patches/20131106.diffphid.2.mig.php +++ b/resources/sql/patches/20131106.diffphid.2.mig.php @@ -13,7 +13,7 @@ foreach ($chunk as $diff) { $id = $diff->getID(); - echo "Migrating diff ID {$id}...\n"; + echo pht('Migrating diff ID %d...', $id)."\n"; $phid = $diff->getPHID(); if (strlen($phid)) { @@ -44,4 +44,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131112.userverified.2.mig.php b/resources/sql/patches/20131112.userverified.2.mig.php --- a/resources/sql/patches/20131112.userverified.2.mig.php +++ b/resources/sql/patches/20131112.userverified.2.mig.php @@ -5,7 +5,7 @@ foreach (new LiskMigrationIterator($table) as $user) { $username = $user->getUsername(); - echo "Migrating {$username}...\n"; + echo pht('Migrating %s...', $username)."\n"; if ($user->getIsEmailVerified()) { // Email already verified. continue; @@ -30,4 +30,4 @@ $user->getID()); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131118.ownerorder.php b/resources/sql/patches/20131118.ownerorder.php --- a/resources/sql/patches/20131118.ownerorder.php +++ b/resources/sql/patches/20131118.ownerorder.php @@ -9,7 +9,7 @@ foreach (new LiskMigrationIterator($table) as $task) { $id = $task->getID(); - echo "Checking task T{$id}...\n"; + echo pht('Checking task %s...', "T{$id}")."\n"; $owner_phid = $task->getOwnerPHID(); if (!$owner_phid && !$task->getOwnerOrdering()) { @@ -39,4 +39,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131121.repocredentials.2.mig.php b/resources/sql/patches/20131121.repocredentials.2.mig.php --- a/resources/sql/patches/20131121.repocredentials.2.mig.php +++ b/resources/sql/patches/20131121.repocredentials.2.mig.php @@ -7,16 +7,16 @@ $map = array(); foreach (new LiskMigrationIterator($table) as $repository) { $callsign = $repository->getCallsign(); - echo "Examining repository {$callsign}...\n"; + echo pht('Examining repository %s...', $callsign)."\n"; if ($repository->getCredentialPHID()) { - echo "...already has a Credential.\n"; + echo pht('...already has a Credential.')."\n"; continue; } $raw_uri = $repository->getRemoteURI(); if (!$raw_uri) { - echo "...no remote URI.\n"; + echo pht('...no remote URI.')."\n"; continue; } @@ -50,12 +50,12 @@ } if (!$username || !$secret) { - echo "...no credentials set.\n"; + echo pht('...no credentials set.')."\n"; continue; } $map[$type][$username][$secret][] = $repository; - echo "...will migrate.\n"; + echo pht('...will migrate.')."\n"; } $passphrase = new PassphraseSecret(); @@ -76,7 +76,7 @@ ->setMaximumGlyphs(128) ->truncateString($signs)); - echo "Creating: {$name}...\n"; + echo pht('Creating: %s...', $name)."\n"; $secret = id(new PassphraseSecret()) ->setSecretData($secret_plaintext) @@ -136,4 +136,4 @@ $table->saveTransaction(); $passphrase->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131205.buildstepordermig.php b/resources/sql/patches/20131205.buildstepordermig.php --- a/resources/sql/patches/20131205.buildstepordermig.php +++ b/resources/sql/patches/20131205.buildstepordermig.php @@ -9,7 +9,7 @@ foreach (new LiskMigrationIterator($table) as $plan) { $planname = $plan->getName(); - echo "Migrating steps in {$planname}...\n"; + echo pht('Migrating steps in %s...', $planname)."\n"; $rows = queryfx_all( $conn_w, @@ -23,10 +23,10 @@ $id = $row['id']; $existing = $row['sequence']; if ($existing != 0) { - echo " - {$id} (already migrated)...\n"; + echo " - ".pht('%d (already migrated)...', $id)."\n"; continue; } - echo " - {$id} to position {$sequence}...\n"; + echo " - ".pht('%d to position %s...', $id, $sequence)."\n"; queryfx( $conn_w, 'UPDATE harbormaster_buildstep '. @@ -38,4 +38,4 @@ } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/20131217.pushlogphid.2.mig.php b/resources/sql/patches/20131217.pushlogphid.2.mig.php --- a/resources/sql/patches/20131217.pushlogphid.2.mig.php +++ b/resources/sql/patches/20131217.pushlogphid.2.mig.php @@ -3,12 +3,12 @@ $table = new PhabricatorRepositoryPushLog(); $conn_w = $table->establishConnection('w'); -echo "Assigning PHIDs to push logs...\n"; +echo pht('Assigning PHIDs to push logs...')."\n"; $logs = new LiskMigrationIterator($table); foreach ($logs as $log) { $id = $log->getID(); - echo "Updating {$id}...\n"; + echo pht('Updating %s...', $id)."\n"; queryfx( $conn_w, 'UPDATE %T SET phid = %s WHERE id = %d', @@ -17,4 +17,4 @@ $id); } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/emailtableport.php b/resources/sql/patches/emailtableport.php --- a/resources/sql/patches/emailtableport.php +++ b/resources/sql/patches/emailtableport.php @@ -1,6 +1,6 @@ openTransaction(); @@ -19,7 +19,7 @@ // NOTE: Grandfather all existing email in as primary / verified. We generate // verification codes because they are used for password resets, etc. - echo "Migrating '{$phid}'...\n"; + echo pht("Migrating '%s'...", $phid)."\n"; queryfx( $conn, 'INSERT INTO %T (userPHID, address, verificationCode, isVerified, isPrimary) @@ -31,4 +31,4 @@ } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/legalpad-mailkey-populate.php b/resources/sql/patches/legalpad-mailkey-populate.php --- a/resources/sql/patches/legalpad-mailkey-populate.php +++ b/resources/sql/patches/legalpad-mailkey-populate.php @@ -1,13 +1,13 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $document) { $id = $document->getID(); - echo "Document {$id}: "; + echo pht('Document %s: ', $id); if (!$document->getMailKey()) { queryfx( $document->establishConnection('w'), @@ -15,11 +15,11 @@ $document->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/liskcounters.php b/resources/sql/patches/liskcounters.php --- a/resources/sql/patches/liskcounters.php +++ b/resources/sql/patches/liskcounters.php @@ -1,6 +1,6 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $rev) { $id = $rev->getID(); - echo "Revision {$id}: "; + echo pht('Revision %d: ', $id); $deps = $rev->getAttachedPHIDs(DifferentialRevisionPHIDType::TYPECONST); if (!$deps) { @@ -22,8 +22,8 @@ $dep); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/migrate-maniphest-dependencies.php b/resources/sql/patches/migrate-maniphest-dependencies.php --- a/resources/sql/patches/migrate-maniphest-dependencies.php +++ b/resources/sql/patches/migrate-maniphest-dependencies.php @@ -1,12 +1,12 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $task) { $id = $task->getID(); - echo "Task {$id}: "; + echo pht('Task %d: ', $id); $deps = $task->getAttachedPHIDs(ManiphestTaskPHIDType::TYPECONST); if (!$deps) { @@ -22,8 +22,8 @@ $dep); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/migrate-maniphest-revisions.php b/resources/sql/patches/migrate-maniphest-revisions.php --- a/resources/sql/patches/migrate-maniphest-revisions.php +++ b/resources/sql/patches/migrate-maniphest-revisions.php @@ -1,12 +1,12 @@ establishConnection('w'); foreach (new LiskMigrationIterator($table) as $task) { $id = $task->getID(); - echo "Task {$id}: "; + echo pht('Task %d: ', $id); $revs = $task->getAttachedPHIDs(DifferentialRevisionPHIDType::TYPECONST); if (!$revs) { @@ -22,7 +22,7 @@ $rev); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/migrate-project-edges.php b/resources/sql/patches/migrate-project-edges.php --- a/resources/sql/patches/migrate-project-edges.php +++ b/resources/sql/patches/migrate-project-edges.php @@ -1,12 +1,12 @@ establishConnection('w'); foreach (new LiskMigrationIterator($table) as $proj) { $id = $proj->getID(); - echo "Project {$id}: "; + echo pht('Project %d: ', $id); $members = queryfx_all( $proj->establishConnection('w'), @@ -29,7 +29,7 @@ $user_phid); } $editor->save(); - echo "OKAY\n"; + echo pht('OKAY')."\n"; } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/resources/sql/patches/ponder-mailkey-populate.php b/resources/sql/patches/ponder-mailkey-populate.php --- a/resources/sql/patches/ponder-mailkey-populate.php +++ b/resources/sql/patches/ponder-mailkey-populate.php @@ -1,13 +1,13 @@ openTransaction(); foreach (new LiskMigrationIterator($table) as $question) { $id = $question->getID(); - echo "Question {$id}: "; + echo pht('Question %d: ', $id); if (!$question->getMailKey()) { queryfx( $question->establishConnection('w'), @@ -15,11 +15,11 @@ $question->getTableName(), Filesystem::readRandomCharacters(20), $id); - echo "Generated Key\n"; + echo pht('Generated Key')."\n"; } else { echo "-\n"; } } $table->saveTransaction(); -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/scripts/__init_script__.php b/scripts/__init_script__.php --- a/scripts/__init_script__.php +++ b/scripts/__init_script__.php @@ -11,7 +11,7 @@ @include_once 'libphutil/scripts/__init_script__.php'; if (!@constant('__LIBPHUTIL__')) { echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to ". - "include the parent directory of libphutil/.\n"; + "include the parent directory of libphutil/.\n"; exit(1); } diff --git a/scripts/almanac/manage_almanac.php b/scripts/almanac/manage_almanac.php --- a/scripts/almanac/manage_almanac.php +++ b/scripts/almanac/manage_almanac.php @@ -5,7 +5,7 @@ require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage host directory'); +$args->setTagline(pht('manage host directory')); $args->setSynopsis(<<\n"; - echo "Purpose: Print controller which will process passed .\n"; + echo pht('Usage: %s', 'aphrontpath.php ')."\n"; + echo pht( + "Purpose: Print controller which will process passed %s.\n", + ''); exit(1); } diff --git a/scripts/cache/manage_cache.php b/scripts/cache/manage_cache.php --- a/scripts/cache/manage_cache.php +++ b/scripts/cache/manage_cache.php @@ -5,7 +5,7 @@ require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage cache'); +$args->setTagline(pht('manage cache')); $args->setSynopsis(<<setTagline('regenerate CSS sprite sheets'); +$args->setTagline(pht('regenerate CSS sprite sheets')); $args->setSynopsis(<< 'force', - 'help' => 'Force regeneration even if sources have not changed.', + 'help' => pht('Force regeneration even if sources have not changed.'), ), )); @@ -39,8 +39,10 @@ if ($err) { $have_optipng = false; echo phutil_console_format( - " WARNING `optipng` not found in PATH.\n". - "Sprites will not be optimized! Install `optipng`!\n"); + " %s %s\n%s\n", + pht('WARNING'), + pht('`%s` not found in PATH.', 'optipng'), + pht('Sprites will not be optimized! Install `%s`!', 'optipng')); } else { $have_optipng = true; } @@ -75,10 +77,10 @@ $sheet->generateImage($full_path, $scale); if ($have_optipng) { - echo "Optimizing...\n"; + echo pht('Optimizing...')."\n"; phutil_passthru('optipng -o7 -clobber %s', $full_path); } } } -echo "Done.\n"; +echo pht('Done.')."\n"; diff --git a/scripts/daemon/manage_daemons.php b/scripts/daemon/manage_daemons.php --- a/scripts/daemon/manage_daemons.php +++ b/scripts/daemon/manage_daemons.php @@ -7,7 +7,7 @@ PhabricatorDaemonManagementWorkflow::requireExtensions(); $args = new PhutilArgumentParser($argv); -$args->setTagline('manage daemons'); +$args->setTagline(pht('manage daemons')); $args->setSynopsis(<<setTagline('documentation generator'); +$args->setTagline(pht('documentation generator')); $args->setSynopsis(<<setTagline('manage drydock software resources'); +$args->setTagline(pht('manage drydock software resources')); $args->setSynopsis(<<setTagline('manage fact configuration'); +$args->setTagline(pht('manage fact configuration')); $args->setSynopsis(<<setTagline('manage files'); +$args->setTagline(pht('manage files')); $args->setSynopsis(<<setTagline('manage lipsum'); +$args->setTagline(pht('manage lipsum')); $args->setSynopsis(<<processReceivedMail(); } catch (Exception $e) { $received - ->setMessage('EXCEPTION: '.$e->getMessage()) + ->setMessage(pht('EXCEPTION: %s', $e->getMessage())) ->save(); throw $e; diff --git a/scripts/mail/manage_mail.php b/scripts/mail/manage_mail.php --- a/scripts/mail/manage_mail.php +++ b/scripts/mail/manage_mail.php @@ -5,7 +5,7 @@ require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage mail'); +$args->setTagline(pht('manage mail')); $args->setSynopsis(<<isHg()) { diff --git a/scripts/repository/manage_repositories.php b/scripts/repository/manage_repositories.php --- a/scripts/repository/manage_repositories.php +++ b/scripts/repository/manage_repositories.php @@ -5,7 +5,7 @@ require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage repositories'); +$args->setTagline(pht('manage repositories')); $args->setSynopsis(<<setTagline('save lint errors to database') + ->setTagline(pht('save lint errors to database')) ->setSynopsis($synopsis) ->parseStandardArguments() ->parse(array( diff --git a/scripts/search/manage_search.php b/scripts/search/manage_search.php --- a/scripts/search/manage_search.php +++ b/scripts/search/manage_search.php @@ -5,7 +5,7 @@ require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('manage search'); +$args->setTagline(pht('manage search')); $args->setSynopsis(<<setTagline('manage audits'); +$args->setTagline(pht('manage audits')); $args->setSynopsis(<<setTagline('manage authentication'); +$args->setTagline(pht('manage authentication')); $args->setSynopsis(<<setTagline('manage celerity'); +$args->setTagline(pht('manage celerity')); $args->setSynopsis(<<setTagline('manage configuration'); +$args->setTagline(pht('manage configuration')); $args->setSynopsis(<<setTagline('manage feed'); +$args->setTagline(pht('manage feed')); $args->setSynopsis(<<setTagline('manage Harbormaster'); +$args->setTagline(pht('manage Harbormaster')); $args->setSynopsis(<<setTagline('manage hunks'); +$args->setTagline(pht('manage hunks')); $args->setSynopsis(<<setTagline('manage internationalization'); +$args->setTagline(pht('manage internationalization')); $args->setSynopsis(<<setTagline('manage billing'); +$args->setTagline(pht('manage billing')); $args->setSynopsis(<<setTagline('manage policies'); +$args->setTagline(pht('manage policies')); $args->setSynopsis(<<setTagline('remove objects'); +$args->setTagline(pht('remove objects')); $args->setSynopsis(<<setTagline('manage triggers'); +$args->setTagline(pht('manage triggers')); $args->setSynopsis(<<setTagline('manage task queue'); +$args->setTagline(pht('manage task queue')); $args->setSynopsis(<<setTagline('manage SMS'); +$args->setTagline(pht('manage SMS')); $args->setSynopsis(<<setTagline('manage Phabricator storage and schemata'); +$args->setTagline(pht('manage Phabricator storage and schemata')); $args->setSynopsis(<< 'force', 'short' => 'f', - 'help' => 'Do not prompt before performing dangerous operations.', + 'help' => pht( + 'Do not prompt before performing dangerous operations.'), ), array( 'name' => 'user', 'short' => 'u', 'param' => 'username', 'default' => $default_user, - 'help' => "Connect with __username__ instead of the configured ". - "default ('{$default_user}').", + 'help' => pht( + "Connect with __username__ instead of the configured default ('%s').", + $default_user), ), array( 'name' => 'password', 'short' => 'p', 'param' => 'password', - 'help' => 'Use __password__ instead of the configured default.', + 'help' => pht('Use __password__ instead of the configured default.'), ), array( 'name' => 'namespace', 'param' => 'name', 'default' => $default_namespace, - 'help' => "Use namespace __namespace__ instead of the configured ". - "default ('{$default_namespace}'). This is an advanced ". - "feature used by unit tests; you should not normally ". - "use this flag.", + 'help' => pht( + "Use namespace __namespace__ instead of the configured ". + "default ('%s'). This is an advanced feature used by unit tests; ". + "you should not normally use this flag.", + $default_namespace), ), array( 'name' => 'dryrun', - 'help' => 'Do not actually change anything, just show what would be '. - 'changed.', + 'help' => pht( + 'Do not actually change anything, just show what would be changed.'), ), array( 'name' => 'disable-utf8mb4', @@ -93,23 +96,23 @@ 'SELECT 1'); } catch (AphrontQueryException $ex) { $message = phutil_console_format( + "**%s**\n\n%s\n\n%s\n\n%s\n\n**%s**: %s\n", + pht('MySQL Credentials Not Configured'), pht( - "**MySQL Credentials Not Configured**\n\n". - "Unable to connect to MySQL using the configured credentials. ". - "You must configure standard credentials before you can upgrade ". - "storage. Run these commands to set up credentials:\n". - "\n". - " phabricator/ $ ./bin/config set mysql.host __host__\n". - " phabricator/ $ ./bin/config set mysql.user __username__\n". - " phabricator/ $ ./bin/config set mysql.pass __password__\n". - "\n". - "These standard credentials are separate from any administrative ". - "credentials provided to this command with __--user__ or ". - "__--password__, and must be configured correctly before you can ". - "proceed.\n". - "\n". - "**Raw MySQL Error**: %s\n", - $ex->getMessage())); + 'Unable to connect to MySQL using the configured credentials. '. + 'You must configure standard credentials before you can upgrade '. + 'storage. Run these commands to set up credentials:'), + " phabricator/ $ ./bin/config set mysql.host __host__\n". + " phabricator/ $ ./bin/config set mysql.user __username__\n". + " phabricator/ $ ./bin/config set mysql.pass __password__", + pht( + 'These standard credentials are separate from any administrative '. + 'credentials provided to this command with __%s__ or '. + '__%s__, and must be configured correctly before you can proceed.', + '--user', + '--password'), + pht('Raw MySQL Error'), + $ex->getMessage()); echo phutil_console_wrap($message); @@ -141,14 +144,16 @@ 'SELECT 1'); } catch (AphrontQueryException $ex) { $message = phutil_console_format( + "**%s**\n\n%s\n\n**%s**: %s\n", + pht('Bad Administrative Credentials'), pht( - "**Bad Administrative Credentials**\n\n". - "Unable to connnect to MySQL using the administrative credentials ". - "provided with the __--user__ and __--password__ flags. Check that ". - "you have entered them correctly.\n". - "\n". - "**Raw MySQL Error**: %s\n", - $ex->getMessage())); + 'Unable to connect to MySQL using the administrative credentials '. + 'provided with the __%s__ and __%s__ flags. Check that '. + 'you have entered them correctly.', + '--user', + '--password'), + pht('Raw MySQL Error'), + $ex->getMessage()); echo phutil_console_wrap($message); diff --git a/scripts/ssh/ssh-exec.php b/scripts/ssh/ssh-exec.php --- a/scripts/ssh/ssh-exec.php +++ b/scripts/ssh/ssh-exec.php @@ -9,7 +9,7 @@ $ssh_log = PhabricatorSSHLog::getLog(); $args = new PhutilArgumentParser($argv); -$args->setTagline('execute SSH requests'); +$args->setTagline(pht('execute SSH requests')); $args->setSynopsis(<< pht( 'Provide a command to execute. This makes testing this script '. 'easier. When running normally, the command is read from the '. - 'environment (SSH_ORIGINAL_COMMAND), which is populated by sshd.'), + 'environment (%s), which is populated by sshd.', + 'SSH_ORIGINAL_COMMAND'), ), )); @@ -84,9 +85,11 @@ if ($user_name && $device_name) { throw new Exception( pht( - 'The --phabricator-ssh-user and --phabricator-ssh-device flags are '. - 'mutually exclusive. You can not authenticate as both a user ("%s") '. - 'and a device ("%s"). Specify one or the other, but not both.', + 'The %s and %s flags are mutually exclusive. You can not '. + 'authenticate as both a user ("%s") and a device ("%s"). '. + 'Specify one or the other, but not both.', + '--phabricator-ssh-user', + '--phabricator-ssh-device', $user_name, $device_name)); } else if (strlen($user_name)) { @@ -104,9 +107,10 @@ if (!$remote_address) { throw new Exception( pht( - 'Unable to identify remote address from the SSH_CLIENT environment '. + 'Unable to identify remote address from the %s environment '. 'variable. Device authentication is accepted only from trusted '. - 'sources.')); + 'sources.', + 'SSH_CLIENT')); } if (!PhabricatorEnv::isClusterAddress($remote_address)) { @@ -134,8 +138,9 @@ } else { throw new Exception( pht( - 'This script must be invoked with either the --phabricator-ssh-user '. - 'or --phabricator-ssh-device flag.')); + 'This script must be invoked with either the %s or %s flag.', + '--phabricator-ssh-user', + '--phabricator-ssh-device')); } if ($args->getArg('ssh-command')) { @@ -199,10 +204,12 @@ "You haven't specified a command to run. This means you're requesting ". "an interactive shell, but Phabricator does not provide an ". "interactive shell over SSH.\n\n". - "Usually, you should run a command like `git clone` or `hg push` ". + "Usually, you should run a command like `%s` or `%s` ". "rather than connecting directly with SSH.\n\n". "Supported commands are: %s.", $user->getUsername(), + 'git clone', + 'hg push', implode(', ', $workflow_names))); } @@ -225,7 +232,7 @@ $parsed_args = new PhutilArgumentParser($parseable_argv); if (empty($workflow_names[$command])) { - throw new Exception('Invalid command.'); + throw new Exception(pht('Invalid command.')); } $workflow = $parsed_args->parseWorkflows($workflows); @@ -235,17 +242,17 @@ $sock_stdin = fopen('php://stdin', 'r'); if (!$sock_stdin) { - throw new Exception('Unable to open stdin.'); + throw new Exception(pht('Unable to open stdin.')); } $sock_stdout = fopen('php://stdout', 'w'); if (!$sock_stdout) { - throw new Exception('Unable to open stdout.'); + throw new Exception(pht('Unable to open stdout.')); } $sock_stderr = fopen('php://stderr', 'w'); if (!$sock_stderr) { - throw new Exception('Unable to open stderr.'); + throw new Exception(pht('Unable to open stderr.')); } $socket_channel = new PhutilSocketChannel( diff --git a/scripts/symbols/import_repository_symbols.php b/scripts/symbols/import_repository_symbols.php --- a/scripts/symbols/import_repository_symbols.php +++ b/scripts/symbols/import_repository_symbols.php @@ -170,11 +170,11 @@ $line_number = $matches['line']; $path = $matches['path']; - check_string_value($context, 'Symbol context', $line_no, 128); - check_string_value($name, 'Symbol name', $line_no, 128); - check_string_value($type, 'Symbol type', $line_no, 12); - check_string_value($lang, 'Symbol language', $line_no, 32); - check_string_value($path, 'Path', $line_no, 512); + check_string_value($context, pht('Symbol context'), $line_no, 128); + check_string_value($name, pht('Symbol name'), $line_no, 128); + check_string_value($type, pht('Symbol type'), $line_no, 12); + check_string_value($lang, pht('Symbol language'), $line_no, 32); + check_string_value($path, pht('Path'), $line_no, 512); if (!strlen($path) || $path[0] != '/') { throw new Exception( @@ -226,4 +226,4 @@ commit_symbols($symbols, $repository, $no_purge); } -echo pht('Done.'), "\n"; +echo pht('Done.')."\n"; diff --git a/scripts/user/account_admin.php b/scripts/user/account_admin.php --- a/scripts/user/account_admin.php +++ b/scripts/user/account_admin.php @@ -13,31 +13,32 @@ if ($is_first_user) { echo pht( - "WARNING\n\n". - "You're about to create the first account on this install. Normally, you ". - "should use the web interface to create the first account, not this ". - "script.\n\n". - "If you use the web interface, it will drop you into a nice UI workflow ". - "which gives you more help setting up your install. If you create an ". - "account with this script instead, you will skip the setup help and you ". - "will not be able to access it later."); + "WARNING\n\n". + "You're about to create the first account on this install. Normally, ". + "you should use the web interface to create the first account, not ". + "this script.\n\n". + "If you use the web interface, it will drop you into a nice UI workflow ". + "which gives you more help setting up your install. If you create an ". + "account with this script instead, you will skip the setup help and you ". + "will not be able to access it later."); if (!phutil_console_confirm(pht('Skip easy setup and create account?'))) { echo pht('Cancelled.')."\n"; exit(1); } } -echo 'Enter a username to create a new account or edit an existing account.'; +echo pht( + 'Enter a username to create a new account or edit an existing account.'); -$username = phutil_console_prompt('Enter a username:'); +$username = phutil_console_prompt(pht('Enter a username:')); if (!strlen($username)) { - echo "Cancelled.\n"; + echo pht('Cancelled.')."\n"; exit(1); } if (!PhabricatorUser::validateUsername($username)) { $valid = PhabricatorUser::describeValidUsername(); - echo "The username '{$username}' is invalid. {$valid}\n"; + echo pht("The username '%s' is invalid. %s", $username, $valid)."\n"; exit(1); } @@ -49,12 +50,12 @@ if (!$user) { $original = new PhabricatorUser(); - echo "There is no existing user account '{$username}'.\n"; + echo pht("There is no existing user account '%s'.", $username)."\n"; $ok = phutil_console_confirm( - "Do you want to create a new '{$username}' account?", + pht("Do you want to create a new '%s' account?", $username), $default_no = false); if (!$ok) { - echo "Cancelled.\n"; + echo pht('Cancelled.')."\n"; exit(1); } $user = new PhabricatorUser(); @@ -64,12 +65,12 @@ } else { $original = clone $user; - echo "There is an existing user account '{$username}'.\n"; + echo pht("There is an existing user account '%s'.", $username)."\n"; $ok = phutil_console_confirm( - "Do you want to edit the existing '{$username}' account?", + pht("Do you want to edit the existing '%s' account?", $username), $default_no = false); if (!$ok) { - echo "Cancelled.\n"; + echo pht('Cancelled.')."\n"; exit(1); } @@ -78,12 +79,12 @@ $user_realname = $user->getRealName(); if (strlen($user_realname)) { - $realname_prompt = ' ['.$user_realname.']'; + $realname_prompt = ' ['.$user_realname.']:'; } else { - $realname_prompt = ''; + $realname_prompt = ':'; } $realname = nonempty( - phutil_console_prompt("Enter user real name{$realname_prompt}:"), + phutil_console_prompt(pht('Enter user real name').$realname_prompt), $user_realname); $user->setRealName($realname); @@ -95,13 +96,14 @@ $create_email = null; if ($is_new) { do { - $email = phutil_console_prompt('Enter user email address:'); + $email = phutil_console_prompt(pht('Enter user email address:')); $duplicate = id(new PhabricatorUserEmail())->loadOneWhere( 'address = %s', $email); if ($duplicate) { - echo "ERROR: There is already a user with that email address. ". - "Each user must have a unique email address.\n"; + echo pht( + "ERROR: There is already a user with that email address. ". + "Each user must have a unique email address.\n"); } else { break; } @@ -115,7 +117,7 @@ // it. phutil_passthru('stty -echo'); $password = phutil_console_prompt( - 'Enter a password for this user [blank to leave unchanged]:'); + pht('Enter a password for this user [blank to leave unchanged]:')); phutil_passthru('stty echo'); if (strlen($password)) { $changed_pass = $password; @@ -123,7 +125,7 @@ $is_system_agent = $user->getIsSystemAgent(); $set_system_agent = phutil_console_confirm( - 'Is this user a bot/script?', + pht('Is this user a bot/script?'), $default_no = !$is_system_agent); $verify_email = null; @@ -135,56 +137,56 @@ $verify_email = $user->loadPrimaryEmail(); if (!$verify_email->getIsVerified()) { $set_verified = phutil_console_confirm( - 'Should the primary email address be verified?', + pht('Should the primary email address be verified?'), $default_no = true); } else { - // already verified so let's not make a fuss + // Already verified so let's not make a fuss. $verify_email = null; } } $is_admin = $user->getIsAdmin(); $set_admin = phutil_console_confirm( - 'Should this user be an administrator?', + pht('Should this user be an administrator?'), $default_no = !$is_admin); -echo "\n\nACCOUNT SUMMARY\n\n"; +echo "\n\n".pht('ACCOUNT SUMMARY')."\n\n"; $tpl = "%12s %-30s %-30s\n"; -printf($tpl, null, 'OLD VALUE', 'NEW VALUE'); -printf($tpl, 'Username', $original->getUsername(), $user->getUsername()); -printf($tpl, 'Real Name', $original->getRealName(), $user->getRealName()); +printf($tpl, null, pht('OLD VALUE'), pht('NEW VALUE')); +printf($tpl, pht('Username'), $original->getUsername(), $user->getUsername()); +printf($tpl, pht('Real Name'), $original->getRealName(), $user->getRealName()); if ($is_new) { - printf($tpl, 'Email', '', $create_email); + printf($tpl, pht('Email'), '', $create_email); } -printf($tpl, 'Password', null, +printf($tpl, pht('Password'), null, ($changed_pass !== false) - ? 'Updated' - : 'Unchanged'); + ? pht('Updated') + : pht('Unchanged')); printf( $tpl, - 'Bot/Script', + pht('Bot/Script'), $original->getIsSystemAgent() ? 'Y' : 'N', $set_system_agent ? 'Y' : 'N'); if ($verify_email) { printf( $tpl, - 'Verify Email', + pht('Verify Email'), $verify_email->getIsVerified() ? 'Y' : 'N', $set_verified ? 'Y' : 'N'); } printf( $tpl, - 'Admin', + pht('Admin'), $original->getIsAdmin() ? 'Y' : 'N', $set_admin ? 'Y' : 'N'); echo "\n"; -if (!phutil_console_confirm('Save these changes?', $default_no = false)) { - echo "Cancelled.\n"; +if (!phutil_console_confirm(pht('Save these changes?'), $default_no = false)) { + echo pht('Cancelled.')."\n"; exit(1); } @@ -223,4 +225,4 @@ $user->saveTransaction(); -echo "Saved changes.\n"; +echo pht('Saved changes.')."\n"; diff --git a/scripts/user/add_user.php b/scripts/user/add_user.php --- a/scripts/user/add_user.php +++ b/scripts/user/add_user.php @@ -5,7 +5,9 @@ require_once $root.'/scripts/__init_script__.php'; if ($argc !== 5) { - echo "usage: add_user.php \n"; + echo pht( + "Usage: %s\n", + 'add_user.php '); exit(1); } @@ -19,8 +21,9 @@ $argv[4]); if (!$admin) { throw new Exception( - 'Admin user must be the username of a valid Phabricator account, used '. - 'to send the new user a welcome email.'); + pht( + 'Admin user must be the username of a valid Phabricator account, used '. + 'to send the new user a welcome email.')); } $existing_user = id(new PhabricatorUser())->loadOneWhere( @@ -28,7 +31,9 @@ $username); if ($existing_user) { throw new Exception( - "There is already a user with the username '{$username}'!"); + pht( + "There is already a user with the username '%s'!", + $username)); } $existing_email = id(new PhabricatorUserEmail())->loadOneWhere( @@ -36,7 +41,9 @@ $email); if ($existing_email) { throw new Exception( - "There is already a user with the email '{$email}'!"); + pht( + "There is already a user with the email '%s'!", + $email)); } $user = new PhabricatorUser(); @@ -54,4 +61,8 @@ $user->sendWelcomeEmail($admin); -echo "Created user '{$username}' (realname='{$realname}', email='{$email}').\n"; +echo pht( + "Created user '%s' (realname='%s', email='%s').\n", + $username, + $realname, + $email); diff --git a/scripts/util/add_macro.php b/scripts/util/add_macro.php --- a/scripts/util/add_macro.php +++ b/scripts/util/add_macro.php @@ -5,7 +5,7 @@ require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('load files as image macros'); +$args->setTagline(pht('load files as image macros')); $args->setSynopsis(<< 'as', 'param' => 'name', - 'help' => 'Use a specific name instead of the first part of the image '. - 'name.', + 'help' => pht( + 'Use a specific name instead of the first part of the image name.'), ), array( 'name' => 'more', @@ -45,7 +45,7 @@ 'name = %s', $name); if ($existing) { - throw new Exception("A macro already exists with the name '{$name}'!"); + throw new Exception(pht("A macro already exists with the name '%s'!", $name)); } $file = PhabricatorFile::newFromFileData( @@ -62,4 +62,4 @@ $id = $file->getID(); -echo "Added macro '{$name}' (F{$id}).\n"; +echo pht("Added macro '%s' (%s).", $name, "F{$id}")."\n"; diff --git a/scripts/util/emit_test_event.php b/scripts/util/emit_test_event.php --- a/scripts/util/emit_test_event.php +++ b/scripts/util/emit_test_event.php @@ -5,7 +5,7 @@ require_once $root.'/scripts/__init_script__.php'; $args = new PhutilArgumentParser($argv); -$args->setTagline('emit a test event'); +$args->setTagline(pht('emit a test event')); $args->setSynopsis(<<getArg('listen') as $listener) { - $console->writeOut("Installing '%s'...\n", $listener); + $console->writeOut("%s\n", pht("Installing '%s'...", $listener)); newv($listener, array())->register(); } -$console->writeOut("Emitting event...\n"); +$console->writeOut("%s\n", pht('Emitting event...')); PhutilEventEngine::dispatchEvent( new PhabricatorEvent( @@ -37,5 +37,5 @@ 'time' => time(), ))); -$console->writeOut("Done.\n"); +$console->writeOut("%s\n", pht('Done.')); exit(0); diff --git a/src/__tests__/PhabricatorCelerityTestCase.php b/src/__tests__/PhabricatorCelerityTestCase.php --- a/src/__tests__/PhabricatorCelerityTestCase.php +++ b/src/__tests__/PhabricatorCelerityTestCase.php @@ -28,7 +28,8 @@ $maps_are_identical, pht( 'When this test fails, it means the Celerity resource map is out '. - 'of date. Run `bin/celerity map` to rebuild it.')); + 'of date. Run `%s` to rebuild it.', + 'bin/celerity map')); } } diff --git a/src/__tests__/PhabricatorInfrastructureTestCase.php b/src/__tests__/PhabricatorInfrastructureTestCase.php --- a/src/__tests__/PhabricatorInfrastructureTestCase.php +++ b/src/__tests__/PhabricatorInfrastructureTestCase.php @@ -15,7 +15,7 @@ $this->assertEqual( count($all), count($installed), - 'In test cases, all applications should default to installed.'); + pht('In test cases, all applications should default to installed.')); } public function testRejectMySQLNonUTF8Queries() { diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php --- a/src/aphront/AphrontRequest.php +++ b/src/aphront/AphrontRequest.php @@ -249,21 +249,24 @@ // in developer mode. if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) { // TODO: Clean this up, see T1921. - $more_info[] = - "To avoid this error, use phabricator_form() to construct forms. ". - "If you are already using phabricator_form(), make sure the form ". - "'action' uses a relative URI (i.e., begins with a '/'). Forms ". - "using absolute URIs do not include CSRF tokens, to prevent ". - "leaking tokens to external sites.\n\n". - "If this page performs writes which do not require CSRF ". - "protection (usually, filling caches or logging), you can use ". - "AphrontWriteGuard::beginScopedUnguardedWrites() to temporarily ". - "bypass CSRF protection while writing. You should use this only ". - "for writes which can not be protected with normal CSRF ". + $more_info[] = pht( + "To avoid this error, use %s to construct forms. If you are already ". + "using %s, make sure the form 'action' uses a relative URI (i.e., ". + "begins with a '%s'). Forms using absolute URIs do not include CSRF ". + "tokens, to prevent leaking tokens to external sites.\n\n". + "If this page performs writes which do not require CSRF protection ". + "(usually, filling caches or logging), you can use %s to ". + "temporarily bypass CSRF protection while writing. You should use ". + "this only for writes which can not be protected with normal CSRF ". "mechanisms.\n\n". - "Some UI elements (like PhabricatorActionListView) also have ". - "methods which will allow you to render links as forms (like ". - "setRenderAsForm(true))."; + "Some UI elements (like %s) also have methods which will allow you ". + "to render links as forms (like %s).", + 'phabricator_form()', + 'phabricator_form()', + '/', + 'AphrontWriteGuard::beginScopedUnguardedWrites()', + 'PhabricatorActionListView', + 'setRenderAsForm(true)'); } // This should only be able to happen if you load a form, pull your @@ -272,10 +275,10 @@ // is incredibly confusing otherwise. throw new AphrontCSRFException( pht( - "You are trying to save some data to Phabricator, but the request ". - "your browser made included an incorrect token. Reload the page ". - "and try again. You may need to clear your cookies.\n\n%s", - implode("\n", $more_info))); + 'You are trying to save some data to Phabricator, but the request '. + 'your browser made included an incorrect token. Reload the page '. + 'and try again. You may need to clear your cookies.')."\n\n". + implode("\n", $more_info)); } return true; diff --git a/src/aphront/__tests__/AphrontRequestTestCase.php b/src/aphront/__tests__/AphrontRequestTestCase.php --- a/src/aphront/__tests__/AphrontRequestTestCase.php +++ b/src/aphront/__tests__/AphrontRequestTestCase.php @@ -75,7 +75,7 @@ $this->assertEqual( $expect, $r->getHost(), - 'Host: '.$input); + pht('Host: %s', $input)); } } diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php --- a/src/aphront/configuration/AphrontApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontApplicationConfiguration.php @@ -328,13 +328,14 @@ // test) so it's fine that we don't have SERVER_ADDR defined. } else { throw new AphrontUsageException( - pht('No SERVER_ADDR'), + pht('No %s', 'SERVER_ADDR'), pht( 'Phabricator is configured to operate in cluster mode, but '. - 'SERVER_ADDR is not defined in the request context. Your '. - 'webserver configuration needs to forward SERVER_ADDR to '. - 'PHP so Phabricator can reject requests received on '. - 'external interfaces.')); + '%s is not defined in the request context. Your webserver '. + 'configuration needs to forward %s to PHP so Phabricator can '. + 'reject requests received on external interfaces.', + 'SERVER_ADDR', + 'SERVER_ADDR')); } } else { if (!PhabricatorEnv::isClusterAddress($server_addr)) { @@ -413,20 +414,23 @@ ->executeOne(); } catch (PhabricatorPolicyException $ex) { throw new Exception( - 'This blog is not visible to logged out users, so it can not be '. - 'visited from a custom domain.'); + pht( + 'This blog is not visible to logged out users, so it can not be '. + 'visited from a custom domain.')); } if (!$blog) { if ($prod_uri && $prod_uri != $base_uri) { - $prod_str = ' or '.$prod_uri; + $prod_str = pht('%s or %s', $base_uri, $prod_uri); } else { - $prod_str = ''; + $prod_str = $base_uri; } throw new Exception( - 'Specified domain '.$host.' is not configured for Phabricator '. - 'requests. Please use '.$base_uri.$prod_str.' to visit this instance.' - ); + pht( + 'Specified domain %s is not configured for Phabricator '. + 'requests. Please use %s to visit this instance.', + $host, + $prod_str)); } // TODO: Make this more flexible and modular so any application can diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -229,11 +229,10 @@ $message = $ex->getMessage(); if ($ex instanceof AphrontSchemaQueryException) { - $message .= - "\n\n". + $message .= "\n\n".pht( "NOTE: This usually indicates that the MySQL schema has not been ". - "properly upgraded. Run 'bin/storage upgrade' to ensure your ". - "schema is up to date."; + "properly upgraded. Run '%s' to ensure your schema is up to date.", + 'bin/storage upgrade'); } if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) { @@ -254,13 +253,13 @@ $dialog = new AphrontDialogView(); $dialog - ->setTitle('Unhandled Exception ("'.$class.'")') + ->setTitle(pht('Unhandled Exception ("%s")', $class)) ->setClass('aphront-exception-dialog') ->setUser($user) ->appendChild($content); if ($this->getRequest()->isAjax()) { - $dialog->addCancelButton('/', 'Close'); + $dialog->addCancelButton('/', pht('Close')); } $response = new AphrontDialogResponse(); diff --git a/src/aphront/response/Aphront404Response.php b/src/aphront/response/Aphront404Response.php --- a/src/aphront/response/Aphront404Response.php +++ b/src/aphront/response/Aphront404Response.php @@ -14,12 +14,13 @@ ->setUser($user) ->setTitle(pht('404 Not Found')) ->addCancelButton('/', pht('Focus')) - ->appendParagraph(pht( - 'Do not dwell in the past, do not dream of the future, '. - 'concentrate the mind on the present moment.')); + ->appendParagraph( + pht( + 'Do not dwell in the past, do not dream of the future, '. + 'concentrate the mind on the present moment.')); $view = id(new PhabricatorStandardPageView()) - ->setTitle('404 Not Found') + ->setTitle(pht('404 Not Found')) ->setRequest($request) ->setDeviceReady(true) ->appendChild($dialog); diff --git a/src/aphront/sink/AphrontHTTPSink.php b/src/aphront/sink/AphrontHTTPSink.php --- a/src/aphront/sink/AphrontHTTPSink.php +++ b/src/aphront/sink/AphrontHTTPSink.php @@ -25,7 +25,7 @@ */ final public function writeHTTPStatus($code, $message = '') { if (!preg_match('/^\d{3}$/', $code)) { - throw new Exception("Malformed HTTP status code '{$code}'!"); + throw new Exception(pht("Malformed HTTP status code '%s'!", $code)); } $code = (int)$code; @@ -42,14 +42,15 @@ final public function writeHeaders(array $headers) { foreach ($headers as $header) { if (!is_array($header) || count($header) !== 2) { - throw new Exception('Malformed header.'); + throw new Exception(pht('Malformed header.')); } list($name, $value) = $header; if (strpos($name, ':') !== false) { throw new Exception( - 'Declining to emit response with malformed HTTP header name: '. - $name); + pht( + 'Declining to emit response with malformed HTTP header name: %s', + $name)); } // Attackers may perform an "HTTP response splitting" attack by making @@ -64,8 +65,9 @@ if (preg_match('/[\r\n\0]/', $name.$value)) { throw new Exception( - "Declining to emit response with unsafe HTTP header: ". - "<'".$name."', '".$value."'>."); + pht( + 'Declining to emit response with unsafe HTTP header: %s', + "<'".$name."', '".$value."'>.")); } } diff --git a/src/applications/almanac/controller/AlmanacConsoleController.php b/src/applications/almanac/controller/AlmanacConsoleController.php --- a/src/applications/almanac/controller/AlmanacConsoleController.php +++ b/src/applications/almanac/controller/AlmanacConsoleController.php @@ -18,27 +18,21 @@ ->setHeader(pht('Services')) ->setHref($this->getApplicationURI('service/')) ->setFontIcon('fa-plug') - ->addAttribute( - pht( - 'Manage Almanac services.'))); + ->addAttribute(pht('Manage Almanac services.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Devices')) ->setHref($this->getApplicationURI('device/')) ->setFontIcon('fa-server') - ->addAttribute( - pht( - 'Manage Almanac devices.'))); + ->addAttribute(pht('Manage Almanac devices.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Networks')) ->setHref($this->getApplicationURI('network/')) ->setFontIcon('fa-globe') - ->addAttribute( - pht( - 'Manage Almanac networks.'))); + ->addAttribute(pht('Manage Almanac networks.'))); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Console')); diff --git a/src/applications/almanac/controller/AlmanacServiceEditController.php b/src/applications/almanac/controller/AlmanacServiceEditController.php --- a/src/applications/almanac/controller/AlmanacServiceEditController.php +++ b/src/applications/almanac/controller/AlmanacServiceEditController.php @@ -250,8 +250,4 @@ )); } - - - - } diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php --- a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php @@ -15,11 +15,11 @@ $pid = $this->getPID(); if (!$pid) { - $console->writeErr(pht("Aphlict is not running.\n")); + $console->writeErr("%s\n", pht('Aphlict is not running.')); return 1; } - $console->writeOut(pht("Aphlict (%s) is running.\n", $pid)); + $console->writeOut("%s\n", pht('Aphlict (%s) is running.', $pid)); return 0; } diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php --- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php +++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php @@ -97,8 +97,10 @@ private static function mustHaveExtension($ext) { if (!extension_loaded($ext)) { - echo "ERROR: The PHP extension '{$ext}' is not installed. You must ". - "install it to run aphlict on this machine.\n"; + echo pht( + "ERROR: The PHP extension '%s' is not installed. You must ". + "install it to run Aphlict on this machine.", + $ext)."\n"; exit(1); } @@ -106,8 +108,10 @@ foreach ($extension->getFunctions() as $function) { $function = $function->name; if (!function_exists($function)) { - echo "ERROR: The PHP function {$function}() is disabled. You must ". - "enable it to run aphlict on this machine.\n"; + echo pht( + 'ERROR: The PHP function %s is disabled. You must '. + 'enable it to run Aphlict on this machine.', + $function.'()')."\n"; exit(1); } } @@ -121,7 +125,8 @@ throw new PhutilArgumentUsageException( pht( 'Unable to start notifications server because it is already '. - 'running. Use `aphlict restart` to restart it.')); + 'running. Use `%s` to restart it.', + 'aphlict restart')); } if (posix_getuid() == 0) { @@ -195,7 +200,9 @@ $console = PhutilConsole::getConsole(); if ($this->debug) { - $console->writeOut(pht("Starting Aphlict server in foreground...\n")); + $console->writeOut( + "%s\n", + pht('Starting Aphlict server in foreground...')); } else { Filesystem::writeFile($this->getPIDPath(), getmypid()); } @@ -214,10 +221,13 @@ register_shutdown_function(array($this, 'cleanup')); if ($this->debug) { - $console->writeOut("Launching server:\n\n $ ".$command."\n\n"); + $console->writeOut( + "%s\n\n $ %s\n\n", + pht('Launching server:'), + $command); $err = phutil_passthru('%C', $command); - $console->writeOut(">>> Server exited!\n"); + $console->writeOut(">>> %s\n", pht('Server exited!')); exit($err); } else { while (true) { @@ -242,9 +252,12 @@ $pid = pcntl_fork(); if ($pid < 0) { - throw new Exception('Failed to fork()!'); + throw new Exception( + pht( + 'Failed to %s!', + 'fork()')); } else if ($pid) { - $console->writeErr(pht("Aphlict Server started.\n")); + $console->writeErr("%s\n", pht('Aphlict Server started.')); exit(0); } @@ -267,11 +280,11 @@ $pid = $this->getPID(); if (!$pid) { - $console->writeErr(pht("Aphlict is not running.\n")); + $console->writeErr("%s\n", pht('Aphlict is not running.')); return 0; } - $console->writeErr(pht("Stopping Aphlict Server (%s)...\n", $pid)); + $console->writeErr("%s\n", pht('Stopping Aphlict Server (%s)...', $pid)); posix_kill($pid, SIGINT); $start = time(); @@ -287,7 +300,7 @@ } while (time() < $start + 5); if ($pid) { - $console->writeErr(pht('Sending %s a SIGKILL.', $pid)."\n"); + $console->writeErr("%s\n", pht('Sending %s a SIGKILL.', $pid)); posix_kill($pid, SIGKILL); unset($pid); } @@ -307,8 +320,11 @@ throw new PhutilArgumentUsageException( pht( - 'No `nodejs` or `node` binary was found in $PATH. You must install '. - 'Node.js to start the Aphlict server.')); + 'No `%s` or `%s` binary was found in %s. You must install '. + 'Node.js to start the Aphlict server.', + 'nodejs', + 'node', + '$PATH')); } } diff --git a/src/applications/aphlict/query/AphlictDropdownDataQuery.php b/src/applications/aphlict/query/AphlictDropdownDataQuery.php --- a/src/applications/aphlict/query/AphlictDropdownDataQuery.php +++ b/src/applications/aphlict/query/AphlictDropdownDataQuery.php @@ -22,7 +22,7 @@ public function getNotificationData() { if ($this->notificationData === null) { - throw new Exception('You must execute() first!'); + throw new Exception(pht('You must %s first!', 'execute()')); } return $this->notificationData; } @@ -34,7 +34,7 @@ public function getConpherenceData() { if ($this->conpherenceData === null) { - throw new Exception('You must execute() first!'); + throw new Exception(pht('You must %s first!', 'execute()')); } return $this->conpherenceData; } diff --git a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php b/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php --- a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php +++ b/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Get information about Arcanist projects.'; + return pht('Get information about Arcanist projects.'); } protected function defineParamTypes() { @@ -23,7 +23,7 @@ protected function defineErrorTypes() { return array( - 'ERR-BAD-ARCANIST-PROJECT' => 'No such project exists.', + 'ERR-BAD-ARCANIST-PROJECT' => pht('No such project exists.'), ); } diff --git a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php --- a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php +++ b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php @@ -7,7 +7,7 @@ } public function getMethodDescription() { - return 'Query audit requests.'; + return pht('Query audit requests.'); } protected function defineParamTypes() { diff --git a/src/applications/audit/constants/PhabricatorAuditActionConstants.php b/src/applications/audit/constants/PhabricatorAuditActionConstants.php --- a/src/applications/audit/constants/PhabricatorAuditActionConstants.php +++ b/src/applications/audit/constants/PhabricatorAuditActionConstants.php @@ -14,12 +14,12 @@ public static function getActionNameMap() { $map = array( - self::COMMENT => pht('Comment'), - self::CONCERN => pht("Raise Concern \xE2\x9C\x98"), - self::ACCEPT => pht("Accept Commit \xE2\x9C\x94"), - self::RESIGN => pht('Resign from Audit'), - self::CLOSE => pht('Close Audit'), - self::ADD_CCS => pht('Add CCs'), + self::COMMENT => pht('Comment'), + self::CONCERN => pht("Raise Concern \xE2\x9C\x98"), + self::ACCEPT => pht("Accept Commit \xE2\x9C\x94"), + self::RESIGN => pht('Resign from Audit'), + self::CLOSE => pht('Close Audit'), + self::ADD_CCS => pht('Add CCs'), self::ADD_AUDITORS => pht('Add Auditors'), ); @@ -28,20 +28,20 @@ public static function getActionName($constant) { $map = self::getActionNameMap(); - return idx($map, $constant, 'Unknown'); + return idx($map, $constant, pht('Unknown')); } public static function getActionPastTenseVerb($action) { - static $map = array( - self::COMMENT => 'commented on', - self::CONCERN => 'raised a concern with', - self::ACCEPT => 'accepted', - self::RESIGN => 'resigned from', - self::CLOSE => 'closed', - self::ADD_CCS => 'added CCs to', - self::ADD_AUDITORS => 'added auditors to', + $map = array( + self::COMMENT => pht('commented on'), + self::CONCERN => pht('raised a concern with'), + self::ACCEPT => pht('accepted'), + self::RESIGN => pht('resigned from'), + self::CLOSE => pht('closed'), + self::ADD_CCS => pht('added CCs to'), + self::ADD_AUDITORS => pht('added auditors to'), ); - return idx($map, $action, 'updated'); + return idx($map, $action, pht('updated')); } } diff --git a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php --- a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php +++ b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php @@ -21,7 +21,7 @@ } public static function getStatusName($code) { - return idx(self::getStatusNameMap(), $code, 'Unknown'); + return idx(self::getStatusNameMap(), $code, pht('Unknown')); } public static function getOpenStatusConstants() { diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php --- a/src/applications/audit/editor/PhabricatorAuditEditor.php +++ b/src/applications/audit/editor/PhabricatorAuditEditor.php @@ -28,7 +28,7 @@ } else { $name = $this->getActor()->getUsername(); } - return array('Added by '.$name.'.'); + return array(pht('Added by %s.', $name)); } public function setRawPatch($patch) { @@ -432,7 +432,7 @@ } foreach ($phids as $phid) { - $this->addAuditReason($phid, 'Requested by Author'); + $this->addAuditReason($phid, pht('Requested by Author')); } return id(new PhabricatorAuditTransaction()) ->setTransactionType(PhabricatorAuditActionConstants::ADD_AUDITORS) diff --git a/src/applications/audit/mail/PhabricatorAuditMailReceiver.php b/src/applications/audit/mail/PhabricatorAuditMailReceiver.php --- a/src/applications/audit/mail/PhabricatorAuditMailReceiver.php +++ b/src/applications/audit/mail/PhabricatorAuditMailReceiver.php @@ -3,8 +3,8 @@ final class PhabricatorAuditMailReceiver extends PhabricatorObjectMailReceiver { public function isEnabled() { - $app_class = 'PhabricatorAuditApplication'; - return PhabricatorApplication::isClassInstalled($app_class); + return PhabricatorApplication::isClassInstalled( + 'PhabricatorAuditApplication'); } protected function getObjectPattern() { diff --git a/src/applications/audit/mail/PhabricatorAuditReplyHandler.php b/src/applications/audit/mail/PhabricatorAuditReplyHandler.php --- a/src/applications/audit/mail/PhabricatorAuditReplyHandler.php +++ b/src/applications/audit/mail/PhabricatorAuditReplyHandler.php @@ -5,7 +5,10 @@ public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof PhabricatorRepositoryCommit)) { - throw new Exception('Mail receiver is not a commit!'); + throw new Exception( + pht( + 'Mail receiver is not a %s!', + 'PhabricatorRepositoryCommit')); } } diff --git a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php --- a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php +++ b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php @@ -7,51 +7,54 @@ $this ->setName('delete') ->setExamples('**delete** [--dry-run] ...') - ->setSynopsis('Delete audit requests matching parameters.') + ->setSynopsis(pht('Delete audit requests matching parameters.')) ->setArguments( array( array( 'name' => 'dry-run', - 'help' => 'Show what would be deleted, but do not actually delete '. - 'anything.', + 'help' => pht( + 'Show what would be deleted, but do not actually delete '. + 'anything.'), ), array( 'name' => 'users', 'param' => 'names', - 'help' => 'Select only audits by a given list of users.', + 'help' => pht('Select only audits by a given list of users.'), ), array( 'name' => 'repositories', 'param' => 'repos', - 'help' => 'Select only audits in a given list of repositories.', + 'help' => pht( + 'Select only audits in a given list of repositories.'), ), array( 'name' => 'commits', 'param' => 'commits', - 'help' => 'Select only audits for the given commits.', + 'help' => pht('Select only audits for the given commits.'), ), array( 'name' => 'min-commit-date', 'param' => 'date', - 'help' => 'Select only audits for commits on or after the given '. - 'date.', + 'help' => pht( + 'Select only audits for commits on or after the given date.'), ), array( 'name' => 'max-commit-date', 'param' => 'date', - 'help' => 'Select only audits for commits on or before the given '. - 'date.', + 'help' => pht( + 'Select only audits for commits on or before the given date.'), ), array( 'name' => 'status', 'param' => 'status', - 'help' => 'Select only audits in the given status. By default, '. - 'only open audits are selected.', + 'help' => pht( + 'Select only audits in the given status. By default, '. + 'only open audits are selected.'), ), array( 'name' => 'ids', 'param' => 'ids', - 'help' => 'Select only audits with the given IDs.', + 'help' => pht('Select only audits with the given IDs.'), ), )); } @@ -72,7 +75,7 @@ $max_date = $this->loadDate($args->getArg('max-commit-date')); if ($min_date && $max_date && ($min_date > $max_date)) { throw new PhutilArgumentUsageException( - 'Specified max date must come after specified min date.'); + pht('Specified maximum date must come after specified minimum date.')); } $is_dry_run = $args->getArg('dry-run'); @@ -250,8 +253,9 @@ if (!$epoch || $epoch < 1) { throw new PhutilArgumentUsageException( pht( - 'Unable to parse date "%s". Use a format like "2000-01-01".', - $date)); + 'Unable to parse date "%s". Use a format like "%s".', + $date, + '2000-01-01')); } return $epoch; diff --git a/src/applications/audit/view/PhabricatorAuditListView.php b/src/applications/audit/view/PhabricatorAuditListView.php --- a/src/applications/audit/view/PhabricatorAuditListView.php +++ b/src/applications/audit/view/PhabricatorAuditListView.php @@ -59,7 +59,7 @@ private function getHandle($phid) { $handle = idx($this->handles, $phid); if (!$handle) { - throw new Exception("No handle for '{$phid}'!"); + throw new Exception(pht("No handle for '%s'!", $phid)); } return $handle; } @@ -98,7 +98,11 @@ public function buildList() { $user = $this->getUser(); if (!$user) { - throw new Exception('you must setUser() before buildList()!'); + throw new Exception( + pht( + 'You must %s before %s!', + 'setUser()', + __FUNCTION__.'()')); } $rowc = array(); diff --git a/src/applications/audit/view/PhabricatorAuditTransactionView.php b/src/applications/audit/view/PhabricatorAuditTransactionView.php --- a/src/applications/audit/view/PhabricatorAuditTransactionView.php +++ b/src/applications/audit/view/PhabricatorAuditTransactionView.php @@ -72,7 +72,7 @@ $inlines[] = $xaction; break; default: - throw new Exception('Unknown grouped transaction type!'); + throw new Exception(pht('Unknown grouped transaction type!')); } } diff --git a/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php b/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php --- a/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php +++ b/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php @@ -3,8 +3,7 @@ abstract class PhabricatorAuthConduitAPIMethod extends ConduitAPIMethod { final public function getApplication() { - return PhabricatorApplication::getByClass( - 'PhabricatorAuthApplication'); + return PhabricatorApplication::getByClass('PhabricatorAuthApplication'); } public function getMethodStatus() { @@ -12,8 +11,7 @@ } public function getMethodStatusDescription() { - return pht( - 'These methods are recently introduced and subject to change.'); + return pht('These methods are recently introduced and subject to change.'); } } diff --git a/src/applications/auth/controller/PhabricatorAuthLoginController.php b/src/applications/auth/controller/PhabricatorAuthLoginController.php --- a/src/applications/auth/controller/PhabricatorAuthLoginController.php +++ b/src/applications/auth/controller/PhabricatorAuthLoginController.php @@ -68,7 +68,9 @@ if (!$account) { throw new Exception( - 'Auth provider failed to load an account from processLoginRequest()!'); + pht( + 'Auth provider failed to load an account from %s!', + 'processLoginRequest()')); } if ($account->getUserPHID()) { @@ -164,7 +166,7 @@ $next_uri) { if ($account->getUserPHID()) { - throw new Exception('Account is already registered or linked.'); + throw new Exception(pht('Account is already registered or linked.')); } // Regenerate the registration secret key, set it on the external account, diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php --- a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php +++ b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php @@ -40,7 +40,7 @@ pht( 'Multi-factor authentication helps secure your account by '. 'making it more difficult for attackers to gain access or '. - 'take senstive actions.'), + 'take sensitive actions.'), pht( 'To learn more about multi-factor authentication, click the '. '%s button below.', diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php --- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php +++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php @@ -560,8 +560,7 @@ return array($account, $provider, $response); } else if (count($providers) > 1) { $response = $this->renderError( - pht( - 'There are too many configured default registration providers.')); + pht('There are too many configured default registration providers.')); return array($account, $provider, $response); } diff --git a/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php b/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php --- a/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php +++ b/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php @@ -55,9 +55,9 @@ ->setSubmitURI($file->getDownloadURI()) ->appendParagraph( pht( - 'A keypair has been generated, and the public key has been '. - 'added as a recognized key. Use the button below to download '. - 'the private key.')) + 'A keypair has been generated, and the public key has been '. + 'added as a recognized key. Use the button below to download '. + 'the private key.')) ->appendParagraph( pht( 'After you download the private key, it will be destroyed. '. @@ -77,8 +77,7 @@ 'This workflow will generate a new SSH keypair, add the public '. 'key, and let you download the private key.')) ->appendParagraph( - pht( - 'Phabricator will not retain a copy of the private key.')) + pht('Phabricator will not retain a copy of the private key.')) ->addSubmitButton(pht('Generate New Keypair')) ->addCancelButton($cancel_uri); } catch (Exception $ex) { diff --git a/src/applications/auth/controller/PhabricatorAuthStartController.php b/src/applications/auth/controller/PhabricatorAuthStartController.php --- a/src/applications/auth/controller/PhabricatorAuthStartController.php +++ b/src/applications/auth/controller/PhabricatorAuthStartController.php @@ -71,8 +71,8 @@ 'This Phabricator install is not configured with any enabled '. 'authentication providers which can be used to log in. If you '. 'have accidentally locked yourself out by disabling all providers, '. - 'you can use `phabricator/bin/auth recover ` to '. - 'recover access to an administrative account.')); + 'you can use `%s` to recover access to an administrative account.'. + 'phabricator/bin/auth recover ')); } $next_uri = $request->getStr('next'); diff --git a/src/applications/auth/controller/PhabricatorEmailLoginController.php b/src/applications/auth/controller/PhabricatorEmailLoginController.php --- a/src/applications/auth/controller/PhabricatorEmailLoginController.php +++ b/src/applications/auth/controller/PhabricatorEmailLoginController.php @@ -72,7 +72,7 @@ $target_email->getUserPHID()); if ($verified_addresses) { $errors[] = pht( - 'That email addess is not verified. You can only send '. + 'That email address is not verified. You can only send '. 'password reset links to a verified address.'); $e_email = pht('Unverified'); } @@ -86,26 +86,22 @@ PhabricatorAuthSessionEngine::ONETIME_RESET); if ($is_serious) { - $body = <<addCancelButton('/', pht('Done')); } } - } $error_view = null; @@ -153,8 +148,7 @@ $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); - $dialog->setTitle(pht( - 'Forgot Password / Email Login')); + $dialog->setTitle(pht('Forgot Password / Email Login')); $dialog->appendChild($email_auth); $dialog->addSubmitButton(pht('Send Email')); $dialog->setSubmitURI('/login/email/'); diff --git a/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php b/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php --- a/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php +++ b/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php @@ -39,6 +39,4 @@ } - - } diff --git a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php @@ -11,8 +11,8 @@ pht( 'Cache the PKCS8 format of a public key. When developing on OSX, '. 'this can be used to work around issues with ssh-keygen. Use '. - '`ssh-keygen -e -m PKCS8 -f key.pub` to generate a PKCS8 key to '. - 'feed to this command.')) + '`%s` to generate a PKCS8 key to feed to this command.', + 'ssh-keygen -e -m PKCS8 -f key.pub')) ->setArguments( array( array( @@ -35,7 +35,8 @@ if (!strlen($public_keyfile)) { throw new PhutilArgumentUsageException( pht( - 'You must specify the path to a public keyfile with --public.')); + 'You must specify the path to a public keyfile with %s.', + '--public')); } if (!Filesystem::pathExists($public_keyfile)) { @@ -51,7 +52,8 @@ if (!strlen($pkcs8_keyfile)) { throw new PhutilArgumentUsageException( pht( - 'You must specify the path to a pkcs8 keyfile with --pkc8s.')); + 'You must specify the path to a pkcs8 keyfile with %s.', + '--pkc8s')); } if (!Filesystem::pathExists($pkcs8_keyfile)) { diff --git a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php @@ -21,28 +21,28 @@ if (!$provider) { $console->writeOut( "%s\n", - 'The LDAP authentication provider is not enabled.'); + pht('The LDAP authentication provider is not enabled.')); exit(1); } if (!function_exists('ldap_connect')) { $console->writeOut( "%s\n", - 'The LDAP extension is not enabled.'); + pht('The LDAP extension is not enabled.')); exit(1); } $adapter = $provider->getAdapter(); $console->writeOut("%s\n", pht('Enter LDAP Credentials')); - $username = phutil_console_prompt('LDAP Username: '); + $username = phutil_console_prompt(pht('LDAP Username: ')); if (!strlen($username)) { throw new PhutilArgumentUsageException( pht('You must enter an LDAP username.')); } phutil_passthru('stty -echo'); - $password = phutil_console_prompt('LDAP Password: '); + $password = phutil_console_prompt(pht('LDAP Password: ')); phutil_passthru('stty echo'); if (!strlen($password)) { diff --git a/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php @@ -8,8 +8,9 @@ ->setName('recover') ->setExamples('**recover** __username__') ->setSynopsis( - 'Recover access to an administrative account if you have locked '. - 'yourself out of Phabricator.') + pht( + 'Recover access to an administrative account if you have locked '. + 'yourself out of Phabricator.')) ->setArguments( array( 'username' => array( @@ -29,8 +30,9 @@ throw new PhutilArgumentUsageException( pht( 'This Phabricator installation has no recoverable administrator '. - 'accounts. You can use `bin/accountadmin` to create a new '. - 'administrator account or make an existing user an administrator.')); + 'accounts. You can use `%s` to create a new administrator '. + 'account or make an existing user an administrator.', + 'bin/accountadmin')); } $can_recover = mpull($can_recover, 'getUsername'); sort($can_recover); @@ -85,10 +87,11 @@ $console->writeOut(' %s', $onetime_uri); $console->writeOut("\n\n"); $console->writeOut( + "%s\n", pht( 'After logging in, you can use the "Auth" application to add or '. 'restore authentication providers and allow normal logins to '. - 'succeed.')."\n"); + 'succeed.')); return 0; } diff --git a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php @@ -16,17 +16,17 @@ array( 'name' => 'user', 'param' => 'user', - 'help' => 'Refresh tokens for a given user.', + 'help' => pht('Refresh tokens for a given user.'), ), array( 'name' => 'type', 'param' => 'provider', - 'help' => 'Refresh tokens for a given provider type.', + 'help' => pht('Refresh tokens for a given provider type.'), ), array( 'name' => 'domain', 'param' => 'domain', - 'help' => 'Refresh tokens for a given domain.', + 'help' => pht('Refresh tokens for a given domain.'), ), )); } diff --git a/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php @@ -7,9 +7,7 @@ $this ->setName('strip') ->setExamples('**strip** [--user username] [--type type]') - ->setSynopsis( - pht( - 'Remove multi-factor authentication from an account.')) + ->setSynopsis(pht('Remove multi-factor authentication from an account.')) ->setArguments( array( array( @@ -50,13 +48,17 @@ if ($usernames && $all_users) { throw new PhutilArgumentUsageException( pht( - 'Specify either specific users with --user, or all users with '. - '--all-users, but not both.')); + 'Specify either specific users with %s, or all users with '. + '%s, but not both.', + '--user', + '--all-users')); } else if (!$usernames && !$all_users) { throw new PhutilArgumentUsageException( pht( - 'Use --user to specify which user to strip factors from, or '. - '--all-users to strip factors from all users.')); + 'Use %s to specify which user to strip factors from, or '. + '%s to strip factors from all users.', + '--user', + '--all-users')); } else if ($usernames) { $users = id(new PhabricatorPeopleQuery()) ->setViewer($this->getViewer()) diff --git a/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php @@ -28,7 +28,8 @@ if (!$id) { throw new PhutilArgumentUsageException( pht( - 'Specify an OAuth client id with --id.')); + 'Specify an OAuth client id with %s.', + '--id')); } $client = id(new PhabricatorOAuthServerClientQuery()) diff --git a/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php --- a/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php @@ -28,7 +28,8 @@ if (!$id) { throw new PhutilArgumentUsageException( pht( - 'Specify an OAuth client id with --id.')); + 'Specify an OAuth client ID with %s.', + '--id')); } $client = id(new PhabricatorOAuthServerClientQuery()) @@ -39,7 +40,7 @@ if (!$client) { throw new PhutilArgumentUsageException( pht( - 'Failed to find an OAuth client with id %s.', $id)); + 'Failed to find an OAuth client with ID %s.', $id)); } if (!$client->getIsTrusted()) { diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php --- a/src/applications/auth/provider/PhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAuthProvider.php @@ -195,7 +195,7 @@ protected function loadOrCreateAccount($account_id) { if (!strlen($account_id)) { - throw new Exception('loadOrCreateAccount(...): empty account ID!'); + throw new Exception(pht('Empty account ID!')); } $adapter = $this->getAdapter(); @@ -203,14 +203,18 @@ if (!strlen($adapter->getAdapterType())) { throw new Exception( - "AuthAdapter (of class '{$adapter_class}') has an invalid ". - "implementation: no adapter type."); + pht( + "AuthAdapter (of class '%s') has an invalid implementation: ". + "no adapter type.", + $adapter_class)); } if (!strlen($adapter->getAdapterDomain())) { throw new Exception( - "AuthAdapter (of class '{$adapter_class}') has an invalid ". - "implementation: no adapter domain."); + pht( + "AuthAdapter (of class '%s') has an invalid implementation: ". + "no adapter domain.", + $adapter_class)); } $account = id(new PhabricatorExternalAccount())->loadOneWhere( diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php --- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php @@ -110,13 +110,13 @@ ->setFullWidth(true) ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('LDAP Username') + ->setLabel(pht('LDAP Username')) ->setName('ldap_username') ->setValue($v_user) ->setError($e_user)) ->appendChild( id(new AphrontFormPasswordControl()) - ->setLabel('LDAP Password') + ->setLabel(pht('LDAP Password')) ->setName('ldap_password') ->setError($e_pass)); @@ -166,7 +166,7 @@ $account_id = $adapter->getAccountID(); DarkConsoleErrorLogPluginAPI::disableDiscardMode(); } else { - throw new Exception('Username and password are required!'); + throw new Exception(pht('Username and password are required!')); } } catch (PhutilAuthCredentialException $ex) { $response = $controller->buildProviderPageResponse( @@ -258,8 +258,9 @@ 'Before you can set up or use LDAP, you need to install the PHP '. 'LDAP extension. It is not currently installed, so PHP can not '. 'talk to LDAP. Usually you can install it with '. - '`yum install php-ldap`, `apt-get install php5-ldap`, or a '. - 'similar package manager command.')); + '`%s`, `%s`, or a similar package manager command.', + 'yum install php-ldap', + 'apt-get install php5-ldap')); } } diff --git a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php --- a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php @@ -84,11 +84,11 @@ $verifier = $request->getStr('oauth_verifier'); if (!$token) { - throw new Exception("Expected 'oauth_token' in request!"); + throw new Exception(pht("Expected '%s' in request!", 'oauth_token')); } if (!$verifier) { - throw new Exception("Expected 'oauth_verifier' in request!"); + throw new Exception(pht("Expected '%s' in request!", 'oauth_verifier')); } $adapter->setToken($token); diff --git a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php --- a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php @@ -198,7 +198,7 @@ $force_refresh = false) { if ($account->getProviderKey() !== $this->getProviderKey()) { - throw new Exception('Account does not match provider!'); + throw new Exception(pht('Account does not match provider!')); } if (!$force_refresh) { @@ -262,8 +262,7 @@ phabricator_datetime($oauth_expires, $viewer))); } else { $item->addAttribute( - pht( - 'Active OAuth Token')); + pht('Active OAuth Token')); } } else if ($is_invalid) { $item->addAttribute(pht('Invalid OAuth Access Token')); diff --git a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php --- a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php @@ -82,8 +82,9 @@ $help = $this->getProviderConfigurationHelp(); return $help."\n\n". - pht('Use the **OAuth App Notes** field to record details about which '. - 'account the external application is registered under.'); + pht( + 'Use the **OAuth App Notes** field to record details about which '. + 'account the external application is registered under.'); } abstract protected function getProviderConfigurationHelp(); diff --git a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php --- a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php @@ -13,7 +13,8 @@ "(WARNING) Examine the table below for information on how password ". "hashes will be stored in the database.\n\n". "(NOTE) You can select a minimum password length by setting ". - "`account.minimum-password-length` in configuration."); + "`%s` in configuration.", + 'account.minimum-password-length'); } public function renderConfigurationFooter() { @@ -160,7 +161,7 @@ public function buildLinkForm( PhabricatorAuthLinkController $controller) { - throw new Exception("Password providers can't be linked."); + throw new Exception(pht("Password providers can't be linked.")); } private function renderPasswordLoginForm( @@ -205,8 +206,9 @@ $errors[] = pht('CAPTCHA was not entered correctly.'); } else { $e_captcha = pht('Required'); - $errors[] = pht('Too many login failures recently. You must '. - 'submit a CAPTCHA with your login request.'); + $errors[] = pht( + 'Too many login failures recently. You must '. + 'submit a CAPTCHA with your login request.'); } } else if ($request->isHTTPPost()) { // NOTE: This is intentionally vague so as not to disclose whether a @@ -225,13 +227,13 @@ ->appendChild($errors) ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('Username or Email') + ->setLabel(pht('Username or Email')) ->setName('username') ->setValue($v_user) ->setError($e_user)) ->appendChild( id(new AphrontFormPasswordControl()) - ->setLabel('Password') + ->setLabel(pht('Password')) ->setName('password') ->setError($e_pass)); diff --git a/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php b/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php --- a/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php @@ -9,8 +9,7 @@ } public function getDescriptionForCreate() { - return pht( - 'Allow users to login or register using Mozilla Persona.'); + return pht('Allow users to login or register using Mozilla Persona.'); } public function getAdapter() { @@ -54,12 +53,12 @@ $response = null; if (!$request->isAjax()) { - throw new Exception('Expected this request to come via Ajax.'); + throw new Exception(pht('Expected this request to come via Ajax.')); } $assertion = $request->getStr('assertion'); if (!$assertion) { - throw new Exception('Expected identity assertion.'); + throw new Exception(pht('Expected identity assertion.')); } $adapter->setAssertion($assertion); diff --git a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php --- a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php @@ -122,7 +122,8 @@ $uri = new PhutilURI($values[$key_uri]); if (!$uri->getProtocol()) { $errors[] = pht( - 'Phabricator base URI should include protocol (like "https://").'); + 'Phabricator base URI should include protocol (like "%s").', + 'https://'); $issues[$key_uri] = pht('Invalid'); } } diff --git a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php --- a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php +++ b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php @@ -88,7 +88,7 @@ 'isEnabled = 1'); break; default: - throw new Exception("Unknown status '{$status}'!"); + throw new Exception(pht("Unknown status '%s'!", $status)); } $where[] = $this->buildPagingClause($conn_r); diff --git a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php --- a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php +++ b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php @@ -129,8 +129,9 @@ throw new PhutilProxyException( pht( 'Failed to convert public key into PKCS8 format. If you are '. - 'developing on OSX, you may be able to use `bin/auth cache-pkcs8` '. + 'developing on OSX, you may be able to use `%s` '. 'to work around this issue. %s', + 'bin/auth cache-pkcs8', $ex->getMessage()), $ex); } diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php --- a/src/applications/base/PhabricatorApplication.php +++ b/src/applications/base/PhabricatorApplication.php @@ -32,7 +32,7 @@ public abstract function getName(); public function getShortDescription() { - return $this->getName().' Application'; + return pht('%s Application', $this->getName()); } public function isInstalled() { @@ -254,7 +254,7 @@ } public function getAppEmailBlurb() { - throw new Exception('Not Implemented.'); + throw new PhutilMethodNotImplementedException(); } @@ -371,7 +371,7 @@ } if (!$selected) { - throw new Exception("No application '{$class_name}'!"); + throw new Exception(pht("No application '%s'!", $class_name)); } return $selected; @@ -531,7 +531,7 @@ private function getCustomCapabilitySpecification($capability) { $custom = $this->getCustomCapabilities(); if (!isset($custom[$capability])) { - throw new Exception("Unknown capability '{$capability}'!"); + throw new Exception(pht("Unknown capability '%s'!", $capability)); } return $custom[$capability]; } diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -316,7 +316,7 @@ public function getApplicationURI($path = '') { if (!$this->getCurrentApplication()) { - throw new Exception('No application!'); + throw new Exception(pht('No application!')); } return $this->getCurrentApplication()->getApplicationURI($path); } @@ -388,8 +388,8 @@ if (isset($seen[$hash])) { $seen[] = get_class($response); throw new Exception( - 'Cycle while reducing proxy responses: '. - implode(' -> ', $seen)); + pht('Cycle while reducing proxy responses: %s', + implode(' -> ', $seen))); } $seen[$hash] = get_class($response); diff --git a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php --- a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php +++ b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php @@ -63,7 +63,7 @@ // Test standard defaults. $this->checkAccess( - 'Default', + pht('Default'), id(clone $controller), $request, array( @@ -82,7 +82,7 @@ $env->overrideEnvConfig('auth.require-email-verification', true); $this->checkAccess( - 'Email Verification Required', + pht('Email Verification Required'), id(clone $controller), $request, array( @@ -97,7 +97,7 @@ )); $this->checkAccess( - 'Email Verification Required, With Exception', + pht('Email Verification Required, With Exception'), id(clone $controller)->setConfig('email', false), $request, array( @@ -116,7 +116,7 @@ // Test admin access. $this->checkAccess( - 'Admin Required', + pht('Admin Required'), id(clone $controller)->setConfig('admin', true), $request, array( @@ -134,7 +134,7 @@ // Test disabled access. $this->checkAccess( - 'Allow Disabled', + pht('Allow Disabled'), id(clone $controller)->setConfig('enabled', false), $request, array( @@ -152,7 +152,7 @@ // Test no login required. $this->checkAccess( - 'No Login Required', + pht('No Login Required'), id(clone $controller)->setConfig('login', false), $request, array( @@ -170,7 +170,7 @@ // Test public access. $this->checkAccess( - 'Public Access', + pht('Public Access'), id(clone $controller)->setConfig('public', true), $request, array( @@ -185,7 +185,7 @@ $env->overrideEnvConfig('policy.allow-public', true); $this->checkAccess( - 'Public + configured', + pht('Public + configured'), id(clone $controller)->setConfig('public', true), $request, array( @@ -210,7 +210,7 @@ $app_controller = id(clone $controller)->setCurrentApplication($app); $this->checkAccess( - 'Application Controller', + pht('Application Controller'), $app_controller, $request, array( @@ -225,7 +225,7 @@ )); $this->checkAccess( - 'Application Controller', + pht('Application Controller'), id(clone $app_controller)->setConfig('login', false), $request, array( @@ -259,7 +259,7 @@ $this->assertTrue( ($result === null), - "Expect user '{$uname}' to be allowed access to '{$label}'."); + pht("Expect user '%s' to be allowed access to '%s'.", $uname, $label)); } foreach ($no as $user) { @@ -274,7 +274,7 @@ $this->assertFalse( ($result === null), - "Expect user '{$uname}' to be denied access to '{$label}'."); + pht("Expect user '%s' to be denied access to '%s'.", $uname, $label)); } } diff --git a/src/applications/cache/PhabricatorCaches.php b/src/applications/cache/PhabricatorCaches.php --- a/src/applications/cache/PhabricatorCaches.php +++ b/src/applications/cache/PhabricatorCaches.php @@ -332,7 +332,9 @@ public static function inflateData($value) { if (!function_exists('gzinflate')) { throw new Exception( - pht('gzinflate() is not available; unable to read deflated data!')); + pht( + '%s is not available; unable to read deflated data!', + 'gzinflate()')); } $value = gzinflate($value); diff --git a/src/applications/cache/PhabricatorKeyValueDatabaseCache.php b/src/applications/cache/PhabricatorKeyValueDatabaseCache.php --- a/src/applications/cache/PhabricatorKeyValueDatabaseCache.php +++ b/src/applications/cache/PhabricatorKeyValueDatabaseCache.php @@ -136,7 +136,7 @@ private function willWriteValue($key, $value) { if (!is_string($value)) { - throw new Exception('Only strings may be written to the DB cache!'); + throw new Exception(pht('Only strings may be written to the DB cache!')); } static $can_deflate; @@ -162,7 +162,7 @@ case self::CACHE_FORMAT_DEFLATE: return PhabricatorCaches::inflateData($value); default: - throw new Exception('Unknown cache format.'); + throw new Exception(pht('Unknown cache format.')); } } diff --git a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php --- a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php +++ b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php @@ -6,24 +6,24 @@ protected function didConstruct() { $this ->setName('purge') - ->setSynopsis('Drop data from caches.') + ->setSynopsis(pht('Drop data from caches.')) ->setArguments( array( array( 'name' => 'purge-all', - 'help' => 'Purge all caches.', + 'help' => pht('Purge all caches.'), ), array( 'name' => 'purge-remarkup', - 'help' => 'Purge the remarkup cache.', + 'help' => pht('Purge the remarkup cache.'), ), array( 'name' => 'purge-changeset', - 'help' => 'Purge the Differential changeset cache.', + 'help' => pht('Purge the Differential changeset cache.'), ), array( 'name' => 'purge-general', - 'help' => 'Purge the general cache.', + 'help' => pht('Purge the general cache.'), ), )); } @@ -46,27 +46,30 @@ } throw new PhutilArgumentUsageException( - "Specify which cache or caches to purge, or use '--purge-all'. ". - "Available caches are: ".implode(', ', $list).". Use '--help' ". - "for more information."); + pht( + "Specify which cache or caches to purge, or use '%s'. Available ". + "caches are: %s. Use '%s' for more information.", + '--purge-all', + implode(', ', $list), + '--help')); } if ($purge['remarkup']) { - $console->writeOut('Purging remarkup cache...'); + $console->writeOut(pht('Purging remarkup cache...')); $this->purgeRemarkupCache(); - $console->writeOut("done.\n"); + $console->writeOut("%s\n", pht('Done.')); } if ($purge['changeset']) { - $console->writeOut('Purging changeset cache...'); + $console->writeOut(pht('Purging changeset cache...')); $this->purgeChangesetCache(); - $console->writeOut("done.\n"); + $console->writeOut("%s\n", pht('Done.')); } if ($purge['general']) { - $console->writeOut('Purging general cache...'); + $console->writeOut(pht('Purging general cache...')); $this->purgeGeneralCache(); - $console->writeOut("done.\n"); + $console->writeOut("%s\n", pht('Done.')); } } diff --git a/src/applications/cache/spec/PhabricatorCacheSpec.php b/src/applications/cache/spec/PhabricatorCacheSpec.php --- a/src/applications/cache/spec/PhabricatorCacheSpec.php +++ b/src/applications/cache/spec/PhabricatorCacheSpec.php @@ -96,8 +96,8 @@ $message = pht( 'The APC or APCu PHP extensions are installed, but not enabled in your '. 'PHP configuration. Enabling these extensions will improve Phabricator '. - 'performance. Edit the "apc.enabled" setting to enable these '. - 'extensions.'); + 'performance. Edit the "%s" setting to enable these extensions.', + 'apc.enabled'); return $this ->newIssue('extension.apc.enabled') diff --git a/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php b/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php --- a/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php +++ b/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php @@ -35,14 +35,14 @@ $slam_defense = ini_get('apc.slam_defense'); if (!$write_lock || $slam_defense) { - $summary = pht( - 'Adjust APC settings to quiet unnecessary errors.'); + $summary = pht('Adjust APC settings to quiet unnecessary errors.'); $message = pht( 'Some versions of APC may emit unnecessary errors into the '. 'error log under the current APC settings. To resolve this, '. - 'enable "apc.write_lock" and disable "apc.slam_defense" in '. - 'your PHP configuration.'); + 'enable "%s" and disable "%s" in your PHP configuration.', + 'apc.write_lock', + 'apc.slam_defense'); $this ->newIssue('extension.apc.write-lock') @@ -58,36 +58,40 @@ $is_stat_enabled = ini_get('apc.stat'); if ($is_stat_enabled && !$is_dev) { $summary = pht( - '"apc.stat" is currently enabled, but should probably be disabled.'); + '"%s" is currently enabled, but should probably be disabled.', + 'apc.stat'); $message = pht( - 'The "apc.stat" setting is currently enabled in your PHP '. - 'configuration. In production mode, "apc.stat" should be '. - 'disabled. This will improve performance slightly.'); + 'The "%s" setting is currently enabled in your PHP configuration. '. + 'In production mode, "%s" should be disabled. '. + 'This will improve performance slightly.', + 'apc.stat', + 'apc.stat'); $this ->newIssue('extension.apc.stat-enabled') - ->setShortName(pht('"apc.stat" Enabled')) - ->setName(pht('"apc.stat" Enabled in Production')) + ->setShortName(pht('"%s" Enabled', 'apc.stat')) + ->setName(pht('"%s" Enabled in Production', 'apc.stat')) ->setSummary($summary) ->setMessage($message) ->addPHPConfig('apc.stat') ->addPhabricatorConfig('phabricator.developer-mode'); } else if (!$is_stat_enabled && $is_dev) { $summary = pht( - '"apc.stat" is currently disabled, but should probably be enabled.'); + '"%s" is currently disabled, but should probably be enabled.', + 'apc.stat'); $message = pht( - 'The "apc.stat" setting is currently disabled in your PHP '. - 'configuration, but Phabricator is running in development mode. '. - 'This option should normally be enabled in development so you do '. - 'not need to restart your webserver after making changes to the '. - 'code.'); + 'The "%s" setting is currently disabled in your PHP configuration, '. + 'but Phabricator is running in development mode. This option should '. + 'normally be enabled in development so you do not need to restart '. + 'your webserver after making changes to the code.', + 'apc.stat'); $this ->newIssue('extension.apc.stat-disabled') - ->setShortName(pht('"apc.stat" Disabled')) - ->setName(pht('"apc.stat" Disabled in Development')) + ->setShortName(pht('"%s" Disabled', 'apc.stat')) + ->setName(pht('"%s" Disabled in Development', 'apc.stat')) ->setSummary($summary) ->setMessage($message) ->addPHPConfig('apc.stat') @@ -128,8 +132,9 @@ $message = pht( 'In development, OPcache should be configured to always reload '. 'code so the webserver does not need to be restarted after making '. - 'changes. To do this, enable "opcache.validate_timestamps" and '. - 'set "opcache.revalidate_freq" to 0.'); + 'changes. To do this, enable "%s" and set "%s" to 0.', + 'opcache.validate_timestamps', + 'opcache.revalidate_freq'); $this ->newIssue('extension.opcache.devmode') @@ -141,14 +146,13 @@ ->addPHPConfig('opcache.revalidate_freq') ->addPhabricatorConfig('phabricator.developer-mode'); } else if (!$is_dev && $validate) { - $summary = pht( - 'OPcache is not configured ideally for production.'); + $summary = pht('OPcache is not configured ideally for production.'); $message = pht( 'In production, OPcache should be configured to never '. 'revalidate code. This will slightly improve performance. '. - 'To do this, disable "opcache.validate_timestamps" in your PHP '. - 'configuration.'); + 'To do this, disable "%s" in your PHP configuration.', + 'opcache.validate_timestamps'); $this ->newIssue('extension.opcache.production') @@ -166,8 +170,9 @@ $message = pht( 'The PHP "Zend OPcache" extension is installed, but not enabled in '. 'your PHP configuration. Enabling it will dramatically improve '. - 'Phabricator performance. Edit the "opcache.enable" setting to '. - 'enable the extension.'); + 'Phabricator performance. Edit the "%s" setting to '. + 'enable the extension.', + 'opcache.enable'); $this->newIssue('extension.opcache.enable') ->setShortName(pht('OPcache Disabled')) diff --git a/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php b/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php --- a/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php +++ b/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php @@ -5,7 +5,10 @@ public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof PhabricatorCalendarEvent)) { - throw new Exception('Mail receiver is not a PhabricatorCalendarEvent!'); + throw new Exception( + pht( + 'Mail receiver is not a %s!', + 'PhabricatorCalendarEvent')); } } diff --git a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php b/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php --- a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php +++ b/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php @@ -12,7 +12,7 @@ parent::willRunTests(); id(new PhabricatorCalendarHoliday()) ->setDay('2012-01-02') - ->setName('International Testing Day') + ->setName(pht('International Testing Day')) ->save(); } @@ -32,7 +32,7 @@ $this->assertEqual( $expect, date('Y-m-d', $actual), - "{$n} business days since '{$date}'"); + pht("%d business days since '%s'", $n, $date)); } } diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php --- a/src/applications/calendar/view/AphrontCalendarEventView.php +++ b/src/applications/calendar/view/AphrontCalendarEventView.php @@ -107,7 +107,7 @@ } public function render() { - throw new Exception('Events are only rendered indirectly.'); + throw new Exception(pht('Events are only rendered indirectly.')); } } diff --git a/src/applications/celerity/CelerityResourceMap.php b/src/applications/celerity/CelerityResourceMap.php --- a/src/applications/celerity/CelerityResourceMap.php +++ b/src/applications/celerity/CelerityResourceMap.php @@ -43,7 +43,8 @@ if (empty($resources_list[$name])) { throw new Exception( pht( - 'No resource source exists with name "%s"!', $name)); + 'No resource source exists with name "%s"!', + $name)); } $instance = new CelerityResourceMap($resources_list[$name]); diff --git a/src/applications/celerity/CelerityResourceMapGenerator.php b/src/applications/celerity/CelerityResourceMapGenerator.php --- a/src/applications/celerity/CelerityResourceMapGenerator.php +++ b/src/applications/celerity/CelerityResourceMapGenerator.php @@ -244,7 +244,10 @@ if (count($provides) > 1) { throw new Exception( - pht('Resource "%s" must @provide at most one Celerity target.', $name)); + pht( + 'Resource "%s" must %s at most one Celerity target.', + $name, + '@provide')); } return array(head($provides), $requires); @@ -268,7 +271,9 @@ $cycle = $graph->detectCycles($provides); if ($cycle) { throw new Exception( - pht('Cycle detected in resource graph: %s', implode(' > ', $cycle))); + pht( + 'Cycle detected in resource graph: %s', + implode(' > ', $cycle))); } } } @@ -298,9 +303,10 @@ throw new Exception( pht( 'Package specification for "%s" includes "%s", but that symbol '. - 'is not @provided by any resource.', + 'is not %s by any resource.', $package_name, - $symbol)); + $symbol, + '@provided')); } $resource_name = $reverse_map[$symbol_hash]; diff --git a/src/applications/celerity/CelerityResourceTransformer.php b/src/applications/celerity/CelerityResourceTransformer.php --- a/src/applications/celerity/CelerityResourceTransformer.php +++ b/src/applications/celerity/CelerityResourceTransformer.php @@ -332,7 +332,10 @@ if (empty($map[$var_name])) { $path = $this->currentPath; throw new Exception( - "CSS file '{$path}' has unknown variable '{$var_name}'."); + pht( + "CSS file '%s' has unknown variable '%s'.", + $path, + $var_name)); } return $map[$var_name]; diff --git a/src/applications/celerity/CeleritySpriteGenerator.php b/src/applications/celerity/CeleritySpriteGenerator.php --- a/src/applications/celerity/CeleritySpriteGenerator.php +++ b/src/applications/celerity/CeleritySpriteGenerator.php @@ -223,8 +223,11 @@ foreach ($images as $image) { if (!preg_match('/\.png$/', $image)) { throw new Exception( - "Expected file '{$image}' in '{$path}' to be a sprite source ". - "ending in '.png'."); + pht( + "Expected file '%s' in '%s' to be a sprite source ending in '%s'.", + $image, + $path, + '.png')); } $result[] = substr($image, 0, -4); } diff --git a/src/applications/celerity/CelerityStaticResourceResponse.php b/src/applications/celerity/CelerityStaticResourceResponse.php --- a/src/applications/celerity/CelerityStaticResourceResponse.php +++ b/src/applications/celerity/CelerityStaticResourceResponse.php @@ -244,10 +244,15 @@ public static function renderInlineScript($data) { if (stripos($data, '') !== false) { throw new Exception( - 'Literal is not allowed inside inline script.'); + pht( + 'Literal %s is not allowed inside inline script.', + '')); } if (strpos($data, ' because it is ignored by HTML parsers. We // would need to send the document with XHTML content type. diff --git a/src/applications/celerity/controller/CelerityResourceController.php b/src/applications/celerity/controller/CelerityResourceController.php --- a/src/applications/celerity/controller/CelerityResourceController.php +++ b/src/applications/celerity/controller/CelerityResourceController.php @@ -35,7 +35,7 @@ $type_map = self::getSupportedResourceTypes(); if (empty($type_map[$type])) { - throw new Exception('Only static resources may be served.'); + throw new Exception(pht('Only static resources may be served.')); } $dev_mode = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); diff --git a/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php b/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php --- a/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php +++ b/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php @@ -11,7 +11,7 @@ } public function getMethodDescription() { - return 'Retrieve chatter.'; + return pht('Retrieve chatter.'); } protected function defineParamTypes() { diff --git a/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php b/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php --- a/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php +++ b/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php @@ -11,7 +11,7 @@ } public function getMethodDescription() { - return 'Record chatter.'; + return pht('Record chatter.'); } protected function defineParamTypes() { diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php @@ -12,8 +12,8 @@ $user = $request->getUser(); $channels = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) - ->execute(); + ->setViewer($user) + ->execute(); $list = new PHUIObjectItemListView(); foreach ($channels as $channel) { diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php @@ -29,9 +29,9 @@ ->withChannelIDs(array($this->channelID)); $channel = id(new PhabricatorChatLogChannelQuery()) - ->setViewer($user) - ->withIDs(array($this->channelID)) - ->executeOne(); + ->setViewer($user) + ->withIDs(array($this->channelID)) + ->executeOne(); if (!$channel) { return new Aphront404Response(); diff --git a/src/applications/conduit/call/__tests__/ConduitCallTestCase.php b/src/applications/conduit/call/__tests__/ConduitCallTestCase.php --- a/src/applications/conduit/call/__tests__/ConduitCallTestCase.php +++ b/src/applications/conduit/call/__tests__/ConduitCallTestCase.php @@ -21,6 +21,8 @@ $this->assertTrue( ($caught instanceof ConduitException), - 'user.whoami should require authentication'); + pht( + '%s should require authentication.', + 'user.whoami')); } } diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -176,11 +176,14 @@ $config_key = 'security.allow-conduit-act-as-user'; if (!PhabricatorEnv::getEnvConfig($config_key)) { - throw new Exception('security.allow-conduit-act-as-user is disabled'); + throw new Exception(pht('%s is disabled.', $config_key)); } if (!$api_request->getUser()->getIsAdmin()) { - throw new Exception('Only administrators can use actAsUser'); + throw new Exception( + pht( + 'Only administrators can use %s.', + __FUNCTION__)); } $user = id(new PhabricatorUser())->loadOneWhere( @@ -189,8 +192,10 @@ if (!$user) { throw new Exception( - "The actAsUser username '{$user_name}' is not a valid user." - ); + pht( + "The %s username '%s' is not a valid user.", + __FUNCTION__, + $user_name)); } $api_request->setUser($user); @@ -224,7 +229,8 @@ return array( 'ERR-INVALID-AUTH', pht( - 'Request is missing required "auth.host" parameter.'), + 'Request is missing required "%s" parameter.', + 'auth.host'), ); } @@ -266,8 +272,7 @@ if (!$stored_key) { return array( 'ERR-INVALID-AUTH', - pht( - 'No user or device is associated with that public key.'), + pht('No user or device is associated with that public key.'), ); } @@ -311,7 +316,8 @@ return array( 'ERR-INVALID-AUTH', pht( - 'Provided "auth.type" ("%s") is not recognized.', + 'Provided "%s" ("%s") is not recognized.', + 'auth.type', $auth_type), ); } @@ -405,8 +411,7 @@ if (!($user instanceof PhabricatorUser)) { return array( 'ERR-INVALID-AUTH', - pht( - 'API token is not associated with a valid user.'), + pht('API token is not associated with a valid user.'), ); } @@ -421,12 +426,11 @@ if ($access_token && $method_scope != PhabricatorOAuthServerScope::SCOPE_NOT_ACCESSIBLE) { $token = id(new PhabricatorOAuthServerAccessToken()) - ->loadOneWhere('token = %s', - $access_token); + ->loadOneWhere('token = %s', $access_token); if (!$token) { return array( 'ERR-INVALID-AUTH', - 'Access token does not exist.', + pht('Access token does not exist.'), ); } @@ -436,19 +440,18 @@ if (!$valid) { return array( 'ERR-INVALID-AUTH', - 'Access token is invalid.', + pht('Access token is invalid.'), ); } // valid token, so let's log in the user! $user_phid = $token->getUserPHID(); $user = id(new PhabricatorUser()) - ->loadOneWhere('phid = %s', - $user_phid); + ->loadOneWhere('phid = %s', $user_phid); if (!$user) { return array( 'ERR-INVALID-AUTH', - 'Access token is for invalid user.', + pht('Access token is for invalid user.'), ); } return $this->validateAuthenticatedUser( @@ -467,7 +470,7 @@ if (!$user) { return array( 'ERR-INVALID-AUTH', - 'Authentication is invalid.', + pht('Authentication is invalid.'), ); } $token = idx($metadata, 'authToken'); @@ -476,7 +479,7 @@ if (sha1($token.$certificate) !== $signature) { return array( 'ERR-INVALID-AUTH', - 'Authentication is invalid.', + pht('Authentication is invalid.'), ); } return $this->validateAuthenticatedUser( @@ -491,7 +494,7 @@ if (!$session_key) { return array( 'ERR-INVALID-SESSION', - 'Session key is not present.', + pht('Session key is not present.'), ); } @@ -501,7 +504,7 @@ if (!$user) { return array( 'ERR-INVALID-SESSION', - 'Session key is invalid.', + pht('Session key is invalid.'), ); } @@ -642,10 +645,13 @@ // actually do type checking, it might be reasonable to treat it as // a string if the parameter type is string. throw new Exception( - "The value for parameter '{$key}' is not valid JSON. All ". - "parameters must be encoded as JSON values, including strings ". - "(which means you need to surround them in double quotes). ". - "Check your syntax. Value was: {$value}"); + pht( + "The value for parameter '%s' is not valid JSON. All ". + "parameters must be encoded as JSON values, including strings ". + "(which means you need to surround them in double quotes). ". + "Check your syntax. Value was: %s.", + $key, + $value)); } $params[$key] = $decoded_value; } @@ -666,7 +672,7 @@ } catch (PhutilJSONParserException $ex) { throw new PhutilProxyException( pht( - "Invalid parameter information was passed to method '%s'", + "Invalid parameter information was passed to method '%s'.", $method), $ex); } diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -46,7 +46,8 @@ ->appendRemarkupInstructions( pht( 'Enter parameters using **JSON**. For instance, to enter a '. - 'list, type: `["apple", "banana", "cherry"]`')); + 'list, type: `%s`', + '["apple", "banana", "cherry"]')); $params = $method->getParamTypes(); foreach ($params as $param => $desc) { @@ -67,12 +68,12 @@ $form ->appendChild( id(new AphrontFormSelectControl()) - ->setLabel('Output Format') + ->setLabel(pht('Output Format')) ->setName('output') ->setOptions( array( - 'human' => 'Human Readable', - 'json' => 'JSON', + 'human' => pht('Human Readable'), + 'json' => pht('JSON'), ))) ->appendChild( id(new AphrontFormSubmitControl()) diff --git a/src/applications/conduit/controller/PhabricatorConduitLogController.php b/src/applications/conduit/controller/PhabricatorConduitLogController.php --- a/src/applications/conduit/controller/PhabricatorConduitLogController.php +++ b/src/applications/conduit/controller/PhabricatorConduitLogController.php @@ -69,7 +69,7 @@ $conn = idx($conns, $call->getConnectionID()); if ($conn) { $name = $conn->getUserName(); - $client = ' (via '.$conn->getClient().')'; + $client = ' '.pht('(via %s)', $conn->getClient()); } else { $name = null; $client = null; @@ -98,7 +98,7 @@ array($call->getMethod(), $client), $status, $call->getError(), - number_format($call->getDuration()).' us', + pht('%d us', number_format($call->getDuration())), phabricator_datetime($call->getDateCreated(), $viewer), ); } diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php --- a/src/applications/conduit/method/ConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitAPIMethod.php @@ -78,7 +78,7 @@ } public function getErrorDescription($error_code) { - return idx($this->getErrorTypes(), $error_code, 'Unknown Error'); + return idx($this->getErrorTypes(), $error_code, pht('Unknown Error')); } public function getRequiredScope() { @@ -134,9 +134,12 @@ $orig_class = get_class($method_map[$name]); $this_class = get_class($method); throw new Exception( - "Two Conduit API method classes ({$orig_class}, {$this_class}) ". - "both have the same method name ({$name}). API methods ". - "must have unique method names."); + pht( + 'Two Conduit API method classes (%s, %s) both have the same '. + 'method name (%s). API methods must have unique method names.', + $orig_class, + $this_class, + $name)); } } diff --git a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php --- a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php @@ -15,7 +15,7 @@ } public function getMethodDescription() { - return 'Connect a session-based client.'; + return pht('Connect a session-based client.'); } protected function defineParamTypes() { @@ -36,22 +36,21 @@ protected function defineErrorTypes() { return array( - 'ERR-BAD-VERSION' => + 'ERR-BAD-VERSION' => pht( 'Client/server version mismatch. Upgrade your server or downgrade '. - 'your client.', - 'NEW-ARC-VERSION' => - 'Client/server version mismatch. Upgrade your client.', - 'ERR-UNKNOWN-CLIENT' => - 'Client is unknown.', - 'ERR-INVALID-USER' => - 'The username you are attempting to authenticate with is not valid.', - 'ERR-INVALID-CERTIFICATE' => - 'Your authentication certificate for this server is invalid.', - 'ERR-INVALID-TOKEN' => + 'your client.'), + 'NEW-ARC-VERSION' => pht( + 'Client/server version mismatch. Upgrade your client.'), + 'ERR-UNKNOWN-CLIENT' => pht('Client is unknown.'), + 'ERR-INVALID-USER' => pht( + 'The username you are attempting to authenticate with is not valid.'), + 'ERR-INVALID-CERTIFICATE' => pht( + 'Your authentication certificate for this server is invalid.'), + 'ERR-INVALID-TOKEN' => pht( "The challenge token you are authenticating with is outside of the ". "allowed time range. Either your system clock is out of whack or ". - "you're executing a replay attack.", - 'ERR-NO-CERTIFICATE' => 'This server requires authentication.', + "you're executing a replay attack."), + 'ERR-NO-CERTIFICATE' => pht('This server requires authentication.'), ); } @@ -87,16 +86,21 @@ if ($server_version < $client_version) { $ex = new ConduitException('ERR-BAD-VERSION'); $ex->setErrorDescription( - "Your 'arc' client version is '{$client_version}', which ". - "is newer than the server version, '{$server_version}'. ". - "Upgrade your Phabricator install."); + pht( + "Your '%s' client version is '%d', which is newer than the ". + "server version, '%d'. Upgrade your Phabricator install.", + 'arc', + $client_version, + $server_version)); } else { $ex = new ConduitException('NEW-ARC-VERSION'); $ex->setErrorDescription( - "A new version of arc is available! You need to upgrade ". - "to connect to this server (you are running version ". - "{$client_version}, the server is running version ". - "{$server_version})."); + pht( + 'A new version of arc is available! You need to upgrade '. + 'to connect to this server (you are running version '. + '%d, the server is running version %d).', + $client_version, + $server_version)); } throw $ex; } diff --git a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php --- a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php @@ -16,7 +16,7 @@ } public function getMethodDescription() { - return 'Retrieve certificate information for a user.'; + return pht('Retrieve certificate information for a user.'); } protected function defineParamTypes() { @@ -32,10 +32,10 @@ protected function defineErrorTypes() { return array( - 'ERR-BAD-TOKEN' => 'Token does not exist or has expired.', - 'ERR-RATE-LIMIT' => + 'ERR-BAD-TOKEN' => pht('Token does not exist or has expired.'), + 'ERR-RATE-LIMIT' => pht( 'You have made too many invalid token requests recently. Wait before '. - 'making more.', + 'making more.'), ); } @@ -69,7 +69,7 @@ 'phid = %s', $info->getUserPHID()); if (!$user) { - throw new Exception('Certificate token points to an invalid user!'); + throw new Exception(pht('Certificate token points to an invalid user!')); } return array( diff --git a/src/applications/conduit/method/ConduitPingConduitAPIMethod.php b/src/applications/conduit/method/ConduitPingConduitAPIMethod.php --- a/src/applications/conduit/method/ConduitPingConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitPingConduitAPIMethod.php @@ -11,7 +11,7 @@ } public function getMethodDescription() { - return 'Basic ping for monitoring or a health-check.'; + return pht('Basic ping for monitoring or a health-check.'); } protected function defineParamTypes() { diff --git a/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php b/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php --- a/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php +++ b/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php @@ -7,7 +7,7 @@ } public function getMethodDescription() { - return 'Returns the parameters of the Conduit methods.'; + return pht('Returns the parameters of the Conduit methods.'); } protected function defineParamTypes() { diff --git a/src/applications/conduit/protocol/ConduitAPIRequest.php b/src/applications/conduit/protocol/ConduitAPIRequest.php --- a/src/applications/conduit/protocol/ConduitAPIRequest.php +++ b/src/applications/conduit/protocol/ConduitAPIRequest.php @@ -36,9 +36,10 @@ public function getUser() { if (!$this->user) { throw new Exception( - 'You can not access the user inside the implementation of a Conduit '. - 'method which does not require authentication (as per '. - 'shouldRequireAuthentication()).'); + pht( + 'You can not access the user inside the implementation of a Conduit '. + 'method which does not require authentication (as per %s).', + 'shouldRequireAuthentication()')); } return $this->user; } diff --git a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php --- a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php +++ b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php @@ -58,7 +58,7 @@ $form ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('Name Contains') + ->setLabel(pht('Name Contains')) ->setName('nameContains') ->setValue($saved->getParameter('nameContains'))); @@ -66,12 +66,13 @@ $form ->appendChild( id(new AphrontFormTextControl()) - ->setLabel('Applications') + ->setLabel(pht('Applications')) ->setName('applicationNames') ->setValue(implode(', ', $names)) - ->setCaption(pht( - 'Example: %s', - phutil_tag('tt', array(), 'differential, paste')))); + ->setCaption( + pht( + 'Example: %s', + phutil_tag('tt', array(), 'differential, paste')))); $is_stable = $saved->getParameter('isStable'); $is_unstable = $saved->getParameter('isUnstable'); diff --git a/src/applications/conduit/ssh/ConduitSSHWorkflow.php b/src/applications/conduit/ssh/ConduitSSHWorkflow.php --- a/src/applications/conduit/ssh/ConduitSSHWorkflow.php +++ b/src/applications/conduit/ssh/ConduitSSHWorkflow.php @@ -18,9 +18,9 @@ $methodv = $args->getArg('method'); if (!$methodv) { - throw new Exception('No Conduit method provided.'); + throw new Exception(pht('No Conduit method provided.')); } else if (count($methodv) > 1) { - throw new Exception('Too many Conduit methods provided.'); + throw new Exception(pht('Too many Conduit methods provided.')); } $method = head($methodv); diff --git a/src/applications/config/check/PhabricatorAuthSetupCheck.php b/src/applications/config/check/PhabricatorAuthSetupCheck.php --- a/src/applications/config/check/PhabricatorAuthSetupCheck.php +++ b/src/applications/config/check/PhabricatorAuthSetupCheck.php @@ -27,13 +27,8 @@ 'You have not configured any authentication providers yet. You '. 'should add a provider (like username/password, LDAP, or GitHub '. 'OAuth) so users can register and log in. You can add and configure '. - 'providers %s.', - phutil_tag( - 'a', - array( - 'href' => '/auth/', - ), - pht('using the "Auth" application'))); + 'providers using the [[%s | "Auth" application]].', + '/auth/'); $this ->newIssue('auth.noproviders') diff --git a/src/applications/config/check/PhabricatorBinariesSetupCheck.php b/src/applications/config/check/PhabricatorBinariesSetupCheck.php --- a/src/applications/config/check/PhabricatorBinariesSetupCheck.php +++ b/src/applications/config/check/PhabricatorBinariesSetupCheck.php @@ -7,7 +7,6 @@ } protected function executeChecks() { - if (phutil_is_windows()) { $bin_name = 'where'; } else { @@ -28,8 +27,9 @@ if (!Filesystem::binaryExists('diff')) { $message = pht( - "Without 'diff', Phabricator will not be able to generate or render ". - "diffs in multiple applications."); + "Without '%s', Phabricator will not be able to generate or render ". + "diffs in multiple applications.", + 'diff'); $this->raiseWarning('diff', $message); } else { $tmp_a = new TempFile(); @@ -43,12 +43,13 @@ list($err) = exec_manual('diff %s %s', $tmp_a, $tmp_b); if ($err) { $this->newIssue('bin.diff.same') - ->setName(pht("Unexpected 'diff' Behavior")) + ->setName(pht("Unexpected '%s' Behavior", 'diff')) ->setMessage( pht( - "The 'diff' binary on this system has unexpected behavior: ". + "The '%s' binary on this system has unexpected behavior: ". "it was expected to exit without an error code when passed ". "identical files, but exited with code %d.", + 'diff', $err)); } @@ -58,9 +59,10 @@ ->setName(pht("Unexpected 'diff' Behavior")) ->setMessage( pht( - "The 'diff' binary on this system has unexpected behavior: ". + "The '%s' binary on this system has unexpected behavior: ". "it was expected to exit with a nonzero error code when passed ". - "differing files, but did not.")); + "differing files, but did not.", + 'diff')); } } @@ -249,7 +251,6 @@ } private function raiseBadVersionWarning($binary, $bad_version) { - switch ($binary) { case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: break; diff --git a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php --- a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php +++ b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php @@ -16,8 +16,7 @@ ->execute(); if (!$task_daemon) { - $doc_href = PhabricatorEnv::getDocLink( - 'Managing Daemons with phd'); + $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd'); $summary = pht( 'You must start the Phabricator daemons to send email, rebuild '. @@ -57,24 +56,29 @@ if ($phd_user) { if ($daemon->getRunningAsUser() != $phd_user) { - $doc_href = PhabricatorEnv::getDocLink( - 'Managing Daemons with phd'); + $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd'); $summary = pht( 'At least one daemon is currently running as a different '. - 'user than configured in the Phabricator phd.user setting'); + 'user than configured in the Phabricator %s setting', + 'phd.user'); $message = pht( 'A daemon is running as user %s while the Phabricator config '. - 'specifies phd.user to be %s.'. + 'specifies %s to be %s.'. "\n\n". - 'Either adjust phd.user to match %s or start '. + 'Either adjust %s to match %s or start '. 'the daemons as the correct user. '. "\n\n". - 'phd Daemons will try to '. - 'use sudo to start as the configured user. '. - 'Make sure that the user who starts phd has the correct '. - 'sudo permissions to start phd daemons as %s', + '%s Daemons will try to use %s to start as the configured user. '. + 'Make sure that the user who starts %s has the correct '. + 'sudo permissions to start %s daemons as %s', + 'phd.user', + 'phd.user', + 'phd', + 'sudo', + 'phd', + 'phd', phutil_tag('tt', array(), $daemon->getRunningAsUser()), phutil_tag('tt', array(), $phd_user), phutil_tag('tt', array(), $daemon->getRunningAsUser()), diff --git a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php --- a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php +++ b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php @@ -79,8 +79,8 @@ if (empty($databases[$namespace.'_meta_data'])) { $message = pht( - 'Run the storage upgrade script to setup Phabricator\'s database '. - 'schema.'); + "Run the storage upgrade script to setup Phabricator's database ". + "schema."); $this->newIssue('storage.upgrade') ->setName(pht('Setup MySQL Schema')) @@ -103,10 +103,11 @@ if ($diff) { $this->newIssue('storage.patch') ->setName(pht('Upgrade MySQL Schema')) - ->setMessage(pht( - "Run the storage upgrade script to upgrade Phabricator's database ". - "schema. Missing patches:
%s
", - phutil_implode_html(phutil_tag('br'), array_keys($diff)))) + ->setMessage( + pht( + "Run the storage upgrade script to upgrade Phabricator's ". + "database schema. Missing patches:
%s
", + phutil_implode_html(phutil_tag('br'), array_keys($diff)))) ->addCommand( hsprintf('phabricator/ $ ./bin/storage upgrade')); } @@ -123,13 +124,15 @@ ->setName(pht('Deprecated mysql.host Format')) ->setSummary( pht( - 'Move port information from `mysql.host` to `mysql.port` in your '. - 'config.')) + 'Move port information from `%s` to `%s` in your config.', + 'mysql.host', + 'mysql.port')) ->setMessage( pht( - 'Your `mysql.host` configuration contains a port number, but '. - 'this usage is deprecated. Instead, put the port number in '. - '`mysql.port`.')) + 'Your `%s` configuration contains a port number, but this usage '. + 'is deprecated. Instead, put the port number in `%s`.', + 'mysql.host', + 'mysql.port')) ->addPhabricatorConfig('mysql.host') ->addPhabricatorConfig('mysql.port') ->addCommand( diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php --- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php @@ -147,8 +147,9 @@ $markup_reason = pht( 'Custom remarkup rules are now added by subclassing '. - 'PhabricatorRemarkupCustomInlineRule or '. - 'PhabricatorRemarkupCustomBlockRule.'); + '%s or %s.', + 'PhabricatorRemarkupCustomInlineRule', + 'PhabricatorRemarkupCustomBlockRule'); $session_reason = pht( 'Sessions now expire and are garbage collected rather than having an '. @@ -178,24 +179,26 @@ $ancient_config += array( 'phid.external-loaders' => pht( - 'External loaders have been replaced. Extend `PhabricatorPHIDType` '. - 'to implement new PHID and handle types.'), + 'External loaders have been replaced. Extend `%s` '. + 'to implement new PHID and handle types.', + 'PhabricatorPHIDType'), 'maniphest.custom-task-extensions-class' => pht( - 'Maniphest fields are now loaded automatically. You can configure '. - 'them with `maniphest.fields`.'), + 'Maniphest fields are now loaded automatically. '. + 'You can configure them with `%s`.', + 'maniphest.fields'), 'maniphest.custom-fields' => pht( - 'Maniphest fields are now defined in '. - '`maniphest.custom-field-definitions`. Existing definitions have '. - 'been migrated.'), + 'Maniphest fields are now defined in `%s`. '. + 'Existing definitions have been migrated.', + 'maniphest.custom-field-definitions'), 'differential.custom-remarkup-rules' => $markup_reason, 'differential.custom-remarkup-block-rules' => $markup_reason, 'auth.sshkeys.enabled' => pht( 'SSH keys are now actually useful, so they are always enabled.'), 'differential.anonymous-access' => pht( - 'Phabricator now has meaningful global access controls. See '. - '`policy.allow-public`.'), + 'Phabricator now has meaningful global access controls. See `%s`.', + 'policy.allow-public'), 'celerity.resource-path' => pht( 'An alternate resource map is no longer supported. Instead, use '. 'multiple maps. See T4222.'), @@ -211,9 +214,10 @@ 'differential.show-test-plan-field' => $differential_field_reason, 'differential.field-selector' => $differential_field_reason, 'phabricator.show-beta-applications' => pht( - 'This option has been renamed to `phabricator.show-prototypes` '. - 'to emphasize the unfinished nature of many prototype applications. '. - 'Your existing setting has been migrated.'), + 'This option has been renamed to `%s` to emphasize the '. + 'unfinished nature of many prototype applications. '. + 'Your existing setting has been migrated.', + 'phabricator.show-prototypes'), 'notification.user' => pht( 'The notification server no longer requires root permissions. Start '. 'the server as the user you want it to run under.'), @@ -223,10 +227,12 @@ 'The translation implementation has changed and providers are no '. 'longer used or supported.'), 'config.mask' => pht( - 'Use `config.hide` instead of this option.'), + 'Use `%s` instead of this option.', + 'config.hide'), 'phd.start-taskmasters' => pht( 'Taskmasters now use an autoscaling pool. You can configure the '. - 'pool size with `phd.taskmasters`.'), + 'pool size with `%s`.', + 'phd.taskmasters'), 'storage.engine-selector' => pht( 'Phabricator now automatically discovers available storage engines '. 'at runtime.'), @@ -234,8 +240,8 @@ 'Phabricator now supports arbitrarily large files. Consult the '. 'documentation for configuration details.'), 'security.allow-outbound-http' => pht( - 'This option has been replaced with the more granular option '. - '`security.outbound-blacklist`.'), + 'This option has been replaced with the more granular option `%s`.', + 'security.outbound-blacklist'), 'metamta.reply.show-hints' => pht( 'Phabricator no longer shows reply hints in mail.'), diff --git a/src/applications/config/check/PhabricatorFileinfoSetupCheck.php b/src/applications/config/check/PhabricatorFileinfoSetupCheck.php --- a/src/applications/config/check/PhabricatorFileinfoSetupCheck.php +++ b/src/applications/config/check/PhabricatorFileinfoSetupCheck.php @@ -9,12 +9,14 @@ protected function executeChecks() { if (!extension_loaded('fileinfo')) { $message = pht( - "The 'fileinfo' extension is not installed. Without 'fileinfo', ". + "The '%s' extension is not installed. Without '%s', ". "support, Phabricator may not be able to determine the MIME types ". - "of uploaded files."); + "of uploaded files.", + 'fileinfo', + 'fileinfo'); $this->newIssue('extension.fileinfo') - ->setName(pht("Missing 'fileinfo' Extension")) + ->setName(pht("Missing '%s' Extension", 'fileinfo')) ->setMessage($message); } } diff --git a/src/applications/config/check/PhabricatorGDSetupCheck.php b/src/applications/config/check/PhabricatorGDSetupCheck.php --- a/src/applications/config/check/PhabricatorGDSetupCheck.php +++ b/src/applications/config/check/PhabricatorGDSetupCheck.php @@ -9,12 +9,15 @@ protected function executeChecks() { if (!extension_loaded('gd')) { $message = pht( - "The 'gd' extension is not installed. Without 'gd', support, ". + "The '%s' extension is not installed. Without '%s', support, ". "Phabricator will not be able to process or resize images ". - "(for example, to generate thumbnails). Install or enable 'gd'."); + "(for example, to generate thumbnails). Install or enable '%s'.", + 'gd', + 'gd', + 'gd'); $this->newIssue('extension.gd') - ->setName(pht("Missing 'gd' Extension")) + ->setName(pht("Missing '%s' Extension", 'gd')) ->setMessage($message); } else { $image_type_map = array( @@ -36,15 +39,17 @@ $have = implode(', ', $have); $message = pht( - "The 'gd' extension has support for only some image types. ". + "The '%s' extension has support for only some image types. ". "Phabricator will be unable to process images of the missing ". - "types until you build 'gd' with support for them. ". + "types until you build '%s' with support for them. ". "Supported types: %s. Missing types: %s.", + 'gd', + 'gd', $have, $missing); $this->newIssue('extension.gd.support') - ->setName(pht("Partial 'gd' Support")) + ->setName(pht("Partial '%s' Support", 'gd')) ->setMessage($message); } } diff --git a/src/applications/config/check/PhabricatorImagemagickSetupCheck.php b/src/applications/config/check/PhabricatorImagemagickSetupCheck.php --- a/src/applications/config/check/PhabricatorImagemagickSetupCheck.php +++ b/src/applications/config/check/PhabricatorImagemagickSetupCheck.php @@ -11,13 +11,15 @@ if ($imagemagick) { if (!Filesystem::binaryExists('convert')) { $message = pht( - 'You have enabled Imagemagick in your config, but the \'convert\' '. - 'binary is not in the webserver\'s $PATH. Disable imagemagick '. - 'or make it available to the webserver.'); + "You have enabled Imagemagick in your config, but the '%s' ". + "binary is not in the webserver's %s. Disable imagemagick ". + "or make it available to the webserver.", + 'convert', + '$PATH'); $this->newIssue('files.enable-imagemagick') ->setName(pht( - "'convert' binary not found or Imagemagick is not installed.")) + "'%s' binary not found or Imagemagick is not installed.", 'convert')) ->setMessage($message) ->addRelatedPhabricatorConfig('files.enable-imagemagick') ->addPhabricatorConfig('environment.append-paths'); diff --git a/src/applications/config/check/PhabricatorMySQLSetupCheck.php b/src/applications/config/check/PhabricatorMySQLSetupCheck.php --- a/src/applications/config/check/PhabricatorMySQLSetupCheck.php +++ b/src/applications/config/check/PhabricatorMySQLSetupCheck.php @@ -27,14 +27,15 @@ $recommended_minimum = (32 * 1024 * 1024); if ($max_allowed_packet < $recommended_minimum) { $message = pht( - "MySQL is configured with a small 'max_allowed_packet' (%d), ". + "MySQL is configured with a small '%s' (%d), ". "which may cause some large writes to fail. Strongly consider raising ". "this to at least %d in your MySQL configuration.", + 'max_allowed_packet', $max_allowed_packet, $recommended_minimum); $this->newIssue('mysql.max_allowed_packet') - ->setName(pht('Small MySQL "max_allowed_packet"')) + ->setName(pht('Small MySQL "%s"', 'max_allowed_packet')) ->setMessage($message) ->addMySQLConfig('max_allowed_packet'); } @@ -70,7 +71,7 @@ phutil_tag('pre', array(), 'sql_mode=STRICT_ALL_TABLES')); $this->newIssue('mysql.mode') - ->setName(pht('MySQL STRICT_ALL_TABLES Mode Not Set')) + ->setName(pht('MySQL %s Mode Not Set', 'STRICT_ALL_TABLES')) ->setSummary($summary) ->setMessage($message) ->addMySQLConfig('sql_mode'); @@ -109,7 +110,7 @@ phutil_tag('tt', array(), 'ONLY_FULL_GROUP_BY')); $this->newIssue('mysql.mode') - ->setName(pht('MySQL ONLY_FULL_GROUP_BY Mode Set')) + ->setName(pht('MySQL %s Mode Set', 'ONLY_FULL_GROUP_BY')) ->setSummary($summary) ->setMessage($message) ->addMySQLConfig('sql_mode'); @@ -134,7 +135,7 @@ phutil_tag('tt', array(), 'ft_stopword_file')); $this->newIssue('mysql.ft_stopword_file') - ->setName(pht('MySQL ft_stopword_file Not Supported')) + ->setName(pht('MySQL %s Not Supported', 'ft_stopword_file')) ->setSummary($summary) ->setMessage($message) ->addMySQLConfig('ft_stopword_file'); diff --git a/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php b/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php --- a/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php +++ b/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php @@ -14,15 +14,14 @@ $safe_mode = ini_get('safe_mode'); if ($safe_mode) { $message = pht( - "You have 'safe_mode' enabled in your PHP configuration, but ". - "Phabricator will not run in safe mode. Safe mode has been deprecated ". - "in PHP 5.3 and removed in PHP 5.4.". - "\n\n". - "Disable safe mode to continue."); + "You have '%s' enabled in your PHP configuration, but Phabricator ". + "will not run in safe mode. Safe mode has been deprecated in PHP 5.3 ". + "and removed in PHP 5.4.\n\nDisable safe mode to continue.", + 'safe_mode'); $this->newIssue('php.safe_mode') ->setIsFatal(true) - ->setName(pht('Disable PHP safe_mode')) + ->setName(pht('Disable PHP %s', 'safe_mode')) ->setMessage($message) ->addPHPConfig('safe_mode'); return; @@ -146,17 +145,15 @@ } $issue = $this->newIssue('php.open_basedir') - ->setName(pht('Disable PHP open_basedir')) + ->setName(pht('Disable PHP %s', 'open_basedir')) ->addPHPConfig('open_basedir'); if ($failures) { $message = pht( - "Your server is configured with 'open_basedir', which prevents ". - "Phabricator from opening files it requires access to.". - "\n\n". - "Disable this setting to continue.". - "\n\n". - "Failures:\n\n%s", + "Your server is configured with '%s', which prevents Phabricator ". + "from opening files it requires access to.\n\n". + "Disable this setting to continue.\n\nFailures:\n\n%s", + 'open_basedir', implode("\n\n", $failures)); $issue @@ -166,15 +163,17 @@ return; } else { $summary = pht( - "You have 'open_basedir' configured in your PHP settings, which ". - "may cause some features to fail."); + "You have '%s' configured in your PHP settings, which ". + "may cause some features to fail.", + 'open_basedir'); $message = pht( - "You have 'open_basedir' configured in your PHP settings. Although ". - "this setting appears permissive enough that Phabricator will ". - "work properly, you may still run into problems because of it.". - "\n\n". - "Consider disabling 'open_basedir'."); + "You have '%s' configured in your PHP settings. Although this ". + "setting appears permissive enough that Phabricator will work ". + "properly, you may still run into problems because of it.\n\n". + "Consider disabling '%s'.", + 'open_basedir', + 'open_basedir'); $issue ->setSummary($summary) diff --git a/src/applications/config/check/PhabricatorPathSetupCheck.php b/src/applications/config/check/PhabricatorPathSetupCheck.php --- a/src/applications/config/check/PhabricatorPathSetupCheck.php +++ b/src/applications/config/check/PhabricatorPathSetupCheck.php @@ -13,19 +13,25 @@ if (!$path) { $summary = pht( - 'The environmental variable $PATH is empty. Phabricator will not '. - 'be able to execute some commands.'); + 'The environmental variable %s is empty. Phabricator will not '. + 'be able to execute some commands.', + '$PATH'); $message = pht( - 'The environmental variable $PATH is empty. Phabricator needs to '. - 'execute some system commands, like `svn`, `git`, `hg`, and `diff`. '. - 'To execute these commands, the binaries must be available in the '. - 'webserver\'s $PATH. You can set additional paths in Phabricator '. - 'configuration.'); + "The environmental variable %s is empty. Phabricator needs to execute ". + "some system commands, like `%s`, `%s`, `%s`, and `%s`. To execute ". + "these commands, the binaries must be available in the webserver's ". + "%s. You can set additional paths in Phabricator configuration.", + '$PATH', + 'svn', + 'git', + 'hg', + 'diff', + '$PATH'); $this ->newIssue('config.environment.append-paths') - ->setName(pht('$PATH Not Set')) + ->setName(pht('%s Not Set', '$PATH')) ->setSummary($summary) ->setMessage($message) ->addPhabricatorConfig('environment.append-paths'); @@ -86,10 +92,11 @@ if (!phutil_is_windows() && !@file_exists($path_part.'/.')) { $message = pht( "The PATH component '%s' (which resolves as the absolute path ". - "'%s') is not usable because it is not traversable (its '+x' ". + "'%s') is not usable because it is not traversable (its '%s' ". "permission bit is not set).", $path_part, - Filesystem::resolvePath($path_part)); + Filesystem::resolvePath($path_part), + '+x'); } } diff --git a/src/applications/config/check/PhabricatorPygmentSetupCheck.php b/src/applications/config/check/PhabricatorPygmentSetupCheck.php --- a/src/applications/config/check/PhabricatorPygmentSetupCheck.php +++ b/src/applications/config/check/PhabricatorPygmentSetupCheck.php @@ -12,17 +12,23 @@ if ($pygment) { if (!Filesystem::binaryExists('pygmentize')) { $summary = pht( - 'You enabled pygments but the pygmentize script is not '. - 'actually available, your $PATH is probably broken.'); + 'You enabled pygments but the %s script is not '. + 'actually available, your %s is probably broken.', + 'pygmentize', + '$PATH'); $message = pht( - 'The environmental variable $PATH does not contain '. - 'pygmentize. You have enabled pygments, which requires '. - 'pygmentize to be available in your $PATH variable.'); + 'The environmental variable %s does not contain %s. '. + 'You have enabled pygments, which requires '. + '%s to be available in your %s variable.', + '$PATH', + 'pygmentize', + 'pygmentize', + '$PATH'); $this ->newIssue('pygments.enabled') - ->setName(pht('pygmentize Not Found')) + ->setName(pht('%s Not Found', 'pygmentize')) ->setSummary($summary) ->setMessage($message) ->addRelatedPhabricatorConfig('pygments.enabled') @@ -31,19 +37,21 @@ list($err) = exec_manual('pygmentize -h'); if ($err) { $summary = pht( - 'You have enabled pygments and the pygmentize script is '. - 'available, but does not seem to work.'); + 'You have enabled pygments and the %s script is '. + 'available, but does not seem to work.', + 'pygmentize'); $message = pht( - 'Phabricator has %s available in $PATH, but the binary '. + 'Phabricator has %s available in %s, but the binary '. 'exited with an error code when run as %s. Check that it is '. 'installed correctly.', + phutil_tag('tt', array(), '$PATH'), phutil_tag('tt', array(), 'pygmentize'), phutil_tag('tt', array(), 'pygmentize -h')); $this ->newIssue('pygments.failed') - ->setName(pht('pygmentize Not Working')) + ->setName(pht('%s Not Working', 'pygmentize')) ->setSummary($summary) ->setMessage($message) ->addRelatedPhabricatorConfig('pygments.enabled') @@ -51,12 +59,14 @@ } } } else { - $summary = pht('Pygments should be installed and enabled '. + $summary = pht( + 'Pygments should be installed and enabled '. 'to provide advanced syntax highlighting.'); - $message = pht('Phabricator can highlight a few languages by default, '. + $message = pht( + 'Phabricator can highlight a few languages by default, '. 'but installing and enabling Pygments (a third-party highlighting '. - 'tool) will add syntax highlighting for many more languages. '."\n\n". + "tool) will add syntax highlighting for many more languages. \n\n". 'For instructions on installing and enabling Pygments, see the '. '%s configuration option.'."\n\n". 'If you do not want to install Pygments, you can ignore this issue.', diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php --- a/src/applications/config/check/PhabricatorSetupCheck.php +++ b/src/applications/config/check/PhabricatorSetupCheck.php @@ -130,7 +130,9 @@ foreach ($check->getIssues() as $key => $issue) { if (isset($issues[$key])) { throw new Exception( - "Two setup checks raised an issue with key '{$key}'!"); + pht( + "Two setup checks raised an issue with key '%s'!", + $key)); } $issues[$key] = $issue; if ($issue->getIsFatal()) { @@ -139,8 +141,8 @@ } } - foreach (PhabricatorEnv::getEnvConfig('config.ignore-issues') - as $ignorable => $derp) { + $ignore_issues = PhabricatorEnv::getEnvConfig('config.ignore-issues'); + foreach ($ignore_issues as $ignorable => $derp) { if (isset($issues[$ignorable])) { $issues[$ignorable]->setIsIgnored(true); } diff --git a/src/applications/config/check/PhabricatorTimezoneSetupCheck.php b/src/applications/config/check/PhabricatorTimezoneSetupCheck.php --- a/src/applications/config/check/PhabricatorTimezoneSetupCheck.php +++ b/src/applications/config/check/PhabricatorTimezoneSetupCheck.php @@ -40,8 +40,10 @@ $message = pht( "Your configuration fails to specify a server timezone. You can either ". - "set the PHP configuration value 'date.timezone' or the Phabricator ". - "configuration value 'phabricator.timezone' to specify one."); + "set the PHP configuration value '%s' or the Phabricator ". + "configuration value '%s' to specify one.", + 'date.timezone', + 'phabricator.timezone'); $this ->newIssue('config.timezone') diff --git a/src/applications/config/controller/PhabricatorConfigIgnoreController.php b/src/applications/config/controller/PhabricatorConfigIgnoreController.php --- a/src/applications/config/controller/PhabricatorConfigIgnoreController.php +++ b/src/applications/config/controller/PhabricatorConfigIgnoreController.php @@ -34,7 +34,7 @@ 'This issue will no longer be suppressed, and will return to its '. 'rightful place as a global setup warning.'); } else { - throw new Exception('Unrecognized verb: '.$this->verb); + throw new Exception(pht('Unrecognized verb: %s', $this->verb)); } $dialog = id(new AphrontDialogView()) diff --git a/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php b/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php --- a/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php +++ b/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php @@ -5,8 +5,10 @@ public function validateOption(PhabricatorConfigOption $option, $value) { if (phid_get_type($value) != PhabricatorFileFilePHIDType::TYPECONST) { - throw new Exception(pht( - '%s is not a valid file phid.', $value)); + throw new Exception( + pht( + '%s is not a valid file PHID.', + $value)); } $file = id(new PhabricatorFileQuery()) @@ -14,23 +16,27 @@ ->withPHIDs(array($value)) ->executeOne(); if (!$file) { - throw new Exception(pht( - '%s is not a valid file phid.', $value)); + throw new Exception( + pht( + '%s is not a valid file PHID.', + $value)); } $most_open_policy = PhabricatorPolicies::getMostOpenPolicy(); if ($file->getViewPolicy() != $most_open_policy) { - throw new Exception(pht( - 'Specified file %s has policy "%s" but should have policy "%s".', - $value, - $file->getViewPolicy(), - $most_open_policy)); + throw new Exception( + pht( + 'Specified file %s has policy "%s" but should have policy "%s".', + $value, + $file->getViewPolicy(), + $most_open_policy)); } if (!$file->isViewableImage()) { - throw new Exception(pht( - 'Specified file %s is not a viewable image.', - $value)); + throw new Exception( + pht( + 'Specified file %s is not a viewable image.', + $value)); } } diff --git a/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php --- a/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php @@ -12,8 +12,9 @@ array( array( 'name' => 'database', - 'help' => pht('Delete configuration in the database instead of '. - 'in local configuration.'), + 'help' => pht( + 'Delete configuration in the database instead of '. + 'in local configuration.'), ), array( 'name' => 'args', @@ -27,15 +28,15 @@ $argv = $args->getArg('args'); if (count($argv) == 0) { - throw new PhutilArgumentUsageException(pht( - 'Specify a configuration key to delete.')); + throw new PhutilArgumentUsageException( + pht('Specify a configuration key to delete.')); } $key = $argv[0]; if (count($argv) > 1) { - throw new PhutilArgumentUsageException(pht( - 'Too many arguments: expected one key.')); + throw new PhutilArgumentUsageException( + pht('Too many arguments: expected one key.')); } @@ -49,10 +50,11 @@ } $values = $config->getKeys(array($key)); if (!$values) { - throw new PhutilArgumentUsageException(pht( - "Configuration key '%s' is not set in %s configuration!", - $key, - $config_type)); + throw new PhutilArgumentUsageException( + pht( + "Configuration key '%s' is not set in %s configuration!", + $key, + $config_type)); } if ($use_database) { @@ -64,7 +66,8 @@ } $console->writeOut( - pht("Deleted '%s' from %s configuration.", $key, $config_type)."\n"); + "%s\n", + pht("Deleted '%s' from %s configuration.", $key, $config_type)); } } diff --git a/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php --- a/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php @@ -7,7 +7,7 @@ $this ->setName('get') ->setExamples('**get** __key__') - ->setSynopsis('Get a local configuration value.') + ->setSynopsis(pht('Get a local configuration value.')) ->setArguments( array( array( @@ -23,21 +23,23 @@ $argv = $args->getArg('args'); if (count($argv) == 0) { throw new PhutilArgumentUsageException( - 'Specify a configuration key to get.'); + pht('Specify a configuration key to get.')); } $key = $argv[0]; if (count($argv) > 1) { throw new PhutilArgumentUsageException( - 'Too many arguments: expected one key.'); + pht('Too many arguments: expected one key.')); } $options = PhabricatorApplicationConfigOptions::loadAllOptions(); if (empty($options[$key])) { throw new PhutilArgumentUsageException( - "No such configuration key '{$key}'! Use `config list` to list all ". - "keys."); + pht( + "No such configuration key '%s'! Use `%s` to list all keys.", + $key, + 'config list')); } $values = array(); diff --git a/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php --- a/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php @@ -7,7 +7,7 @@ $this ->setName('list') ->setExamples('**list**') - ->setSynopsis('List all configuration keys.'); + ->setSynopsis(pht('List all configuration keys.')); } public function execute(PhutilArgumentParser $args) { diff --git a/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php --- a/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php @@ -20,54 +20,60 @@ $database_config = new PhabricatorConfigDatabaseSource('default'); $config_sources = PhabricatorEnv::getConfigSourceStack()->getStack(); $console->writeOut( - pht('Migrating file-based config to more modern config...')."\n"); + "%s\n", + pht('Migrating file-based config to more modern config...')); foreach ($config_sources as $config_source) { if (!($config_source instanceof PhabricatorConfigFileSource)) { $console->writeOut( - pht('Skipping config of source type %s...', - get_class($config_source))."\n"); + "%s\n", + pht( + 'Skipping config of source type %s...', + get_class($config_source))); continue; } - $console->writeOut(pht('Migrating file source...')."\n"); + $console->writeOut("%s\n", pht('Migrating file source...')); $all_keys = $config_source->getAllKeys(); foreach ($all_keys as $key => $value) { $option = idx($options, $key); if (!$option) { - $console->writeOut(pht('Skipping obsolete option: %s', $key)."\n"); + $console->writeOut("%s\n", pht('Skipping obsolete option: %s', $key)); continue; } $in_local = $local_config->getKeys(array($option->getKey())); if ($in_local) { - $console->writeOut(pht( - 'Skipping option "%s"; already in local config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Skipping option "%s"; already in local config.', $key)); continue; } $is_locked = $option->getLocked(); if ($is_locked) { $local_config->setKeys(array($option->getKey() => $value)); $key_count++; - $console->writeOut(pht( - 'Migrated option "%s" from file to local config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Migrated option "%s" from file to local config.', $key)); } else { $in_database = $database_config->getKeys(array($option->getKey())); if ($in_database) { - $console->writeOut(pht( - 'Skipping option "%s"; already in database config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Skipping option "%s"; already in database config.', $key)); continue; } else { $config_entry = PhabricatorConfigEntry::loadConfigEntry($key); $config_entry->setValue($value); $config_entry->save(); $key_count++; - $console->writeOut(pht( - 'Migrated option "%s" from file to database config.', $key)."\n"); + $console->writeOut( + "%s\n", + pht('Migrated option "%s" from file to database config.', $key)); } } } } - $console->writeOut(pht( - 'Done. Migrated %d keys.', $key_count)."\n"); + $console->writeOut("%s\n", pht('Done. Migrated %d keys.', $key_count)); return 0; } diff --git a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php --- a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php +++ b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php @@ -12,8 +12,9 @@ array( array( 'name' => 'database', - 'help' => pht('Update configuration in the database instead of '. - 'in local configuration.'), + 'help' => pht( + 'Update configuration in the database instead of '. + 'in local configuration.'), ), array( 'name' => 'args', @@ -26,31 +27,34 @@ $console = PhutilConsole::getConsole(); $argv = $args->getArg('args'); if (count($argv) == 0) { - throw new PhutilArgumentUsageException(pht( - 'Specify a configuration key and a value to set it to.')); + throw new PhutilArgumentUsageException( + pht('Specify a configuration key and a value to set it to.')); } $key = $argv[0]; if (count($argv) == 1) { - throw new PhutilArgumentUsageException(pht( - "Specify a value to set the key '%s' to.", - $key)); + throw new PhutilArgumentUsageException( + pht( + "Specify a value to set the key '%s' to.", + $key)); } $value = $argv[1]; if (count($argv) > 2) { - throw new PhutilArgumentUsageException(pht( - 'Too many arguments: expected one key and one value.')); + throw new PhutilArgumentUsageException( + pht( + 'Too many arguments: expected one key and one value.')); } $options = PhabricatorApplicationConfigOptions::loadAllOptions(); if (empty($options[$key])) { - throw new PhutilArgumentUsageException(pht( - "No such configuration key '%s'! Use `config list` to list all ". - "keys.", - $key)); + throw new PhutilArgumentUsageException( + pht( + "No such configuration key '%s'! Use `%s` to list all keys.", + $key, + 'config list')); } $option = $options[$key]; @@ -64,10 +68,11 @@ break; case 'int': if (!ctype_digit($value)) { - throw new PhutilArgumentUsageException(pht( - "Config key '%s' is of type '%s'. Specify an integer.", - $key, - $type)); + throw new PhutilArgumentUsageException( + pht( + "Config key '%s' is of type '%s'. Specify an integer.", + $key, + $type)); } $value = (int)$value; break; @@ -77,11 +82,13 @@ } else if ($value == 'false') { $value = false; } else { - throw new PhutilArgumentUsageException(pht( - "Config key '%s' is of type '%s'. ". - "Specify 'true' or 'false'.", - $key, - $type)); + throw new PhutilArgumentUsageException( + pht( + "Config key '%s' is of type '%s'. Specify '%s' or '%s'.", + $key, + $type, + 'true', + 'false')); } break; default: @@ -89,23 +96,25 @@ if (!is_array($value)) { switch ($type) { case 'set': - $message = pht( - "Config key '%s' is of type '%s'. Specify it in JSON. ". - "For example:\n\n". - ' ./bin/config set \'{"value1": true, "value2": true}\''. - "\n", - $key, - $type); + $message = sprintf( + "%s%s\n\n %s\n", + pht( + "Config key '%s' is of type '%s'. Specify it in JSON.", + $key, + $type), + pht('For example:'), + './bin/config set \'{"value1": true, "value2": true}\''); break; default: if (preg_match('/^listgetArg('database'); if ($option->getLocked() && $use_database) { - throw new PhutilArgumentUsageException(pht( - "Config key '%s' is locked and can only be set in local ". - 'configuration.', - $key)); + throw new PhutilArgumentUsageException( + pht( + "Config key '%s' is locked and can only be set in local ". + "configuration.", + $key)); } try { @@ -145,7 +155,8 @@ } $console->writeOut( - pht("Set '%s' in %s configuration.", $key, $config_type)."\n"); + "%s\n", + pht("Set '%s' in %s configuration.", $key, $config_type)); } } diff --git a/src/applications/config/option/PhabricatorAWSConfigOptions.php b/src/applications/config/option/PhabricatorAWSConfigOptions.php --- a/src/applications/config/option/PhabricatorAWSConfigOptions.php +++ b/src/applications/config/option/PhabricatorAWSConfigOptions.php @@ -39,8 +39,8 @@ pht( 'Explicit S3 endpoint to use. Leave empty to have Phabricator '. 'select and endpoint. Normally, you do not need to set this.')) - ->addExample(null, 'Use default endpoint') - ->addExample('s3.amazon.com', 'Use specific endpoint'), + ->addExample(null, pht('Use default endpoint')) + ->addExample('s3.amazon.com', pht('Use specific endpoint')), $this->newOption('amazon-ec2.access-key', 'string', null) ->setLocked(true) ->setDescription(pht('Access key for Amazon EC2.')), diff --git a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php --- a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php +++ b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php @@ -49,14 +49,16 @@ ); $http_desc = pht( - 'Format for the HTTP access log. Use {{log.access.path}} to set the '. - 'path. Available variables are:'); + 'Format for the HTTP access log. Use `%s` to set the path. '. + 'Available variables are:', + 'log.access.path'); $http_desc .= "\n\n"; $http_desc .= $this->renderMapHelp($http_map); $ssh_desc = pht( - 'Format for the SSH access log. Use {{log.ssh.path}} to set the '. - 'path. Available variables are:'); + 'Format for the SSH access log. Use %s to set the path. '. + 'Available variables are:', + 'log.ssh.path'); $ssh_desc .= "\n\n"; $ssh_desc .= $this->renderMapHelp($ssh_map); @@ -67,7 +69,6 @@ ->setDescription( pht( "To enable the Phabricator access log, specify a path. The ". - "access log can provide more detailed information about ". "Phabricator access than normal HTTP access logs (for instance, ". "it can show logged-in users, controllers, and other application ". "data).\n\n". diff --git a/src/applications/config/option/PhabricatorApplicationConfigOptions.php b/src/applications/config/option/PhabricatorApplicationConfigOptions.php --- a/src/applications/config/option/PhabricatorApplicationConfigOptions.php +++ b/src/applications/config/option/PhabricatorApplicationConfigOptions.php @@ -227,7 +227,7 @@ if (isset($options[$key])) { throw new Exception( pht( - "Mulitple % subclasses contain an option named '%s'!", + "Mulitple %s subclasses contain an option named '%s'!", __CLASS__, $key)); } diff --git a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php --- a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php +++ b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php @@ -55,8 +55,8 @@ "registration, you can disable the queue to reduce administrative ". "overhead.\n\n". "NOTE: Before you disable the queue, make sure ". - "{{auth.email-domains}} is configured correctly for your ". - "install!")), + "{{auth.email-domains}} is configured correctly ". + "for your install!")), $this->newOption('auth.email-domains', 'list', array()) ->setSummary(pht('Only allow registration from particular domains.')) ->setDescription( @@ -89,8 +89,7 @@ )) ->setSummary( pht( - 'Determines whether or not basic account information is '. - 'editable.')) + 'Determines whether or not basic account information is editable.')) ->setDescription( pht( 'Is basic account information (email, real name, profile '. diff --git a/src/applications/config/option/PhabricatorClusterConfigOptions.php b/src/applications/config/option/PhabricatorClusterConfigOptions.php --- a/src/applications/config/option/PhabricatorClusterConfigOptions.php +++ b/src/applications/config/option/PhabricatorClusterConfigOptions.php @@ -69,9 +69,10 @@ 'hosting providers running multi-tenant clusters.'. "\n\n". 'If you provide an instance identifier here (normally by '. - 'injecting it with a `PhabricatorConfigSiteSource`), Phabricator '. - 'will pass it to subprocesses and commit hooks in the '. - '`PHABRICATOR_INSTANCE` environmental variable.')), + 'injecting it with a `%s`), Phabricator will pass it to '. + 'subprocesses and commit hooks in the `%s` environmental variable.', + 'PhabricatorConfigSiteSource', + 'PHABRICATOR_INSTANCE')), ); } diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php --- a/src/applications/config/option/PhabricatorConfigOption.php +++ b/src/applications/config/option/PhabricatorConfigOption.php @@ -76,7 +76,9 @@ } return pht( 'This configuration is locked and can not be edited from the web '. - 'interface. Use `./bin/config` in `phabricator/` to edit it.'); + 'interface. Use `%s` in `%s` to edit it.', + './bin/config', + 'phabricator/'); } public function addExample($value, $description) { @@ -180,7 +182,7 @@ public function getCustomObject() { if (!$this->customObject) { if (!$this->isCustomType()) { - throw new Exception('This option does not have a custom type!'); + throw new Exception(pht('This option does not have a custom type!')); } $this->customObject = newv(substr($this->getType(), 7), array()); } diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -58,9 +58,9 @@ 'Phabricator, and a production environment for deploying it), '. 'set the production environment URI here so that emails and other '. 'durable URIs will always generate with links pointing at the '. - 'production environment. If unset, defaults to '. - '{{phabricator.base-uri}}. Most installs do not need to set '. - 'this option.')) + 'production environment. If unset, defaults to `%s`. Most '. + 'installs do not need to set this option.', + 'phabricator.base-uri')) ->addExample('http://phabricator.example.com/', pht('Valid Setting')), $this->newOption('phabricator.allowed-uris', 'list', array()) ->setLocked(true) @@ -68,9 +68,9 @@ ->setDescription( pht( "These alternative URIs will be able to access 'normal' pages ". - "on your Phabricator install. Other features such as OAuth ". - "won't work. The major use case for this is moving installs ". - "across domains.")) + "on your Phabricator install. Other features such as OAuth ". + "won't work. The major use case for this is moving installs ". + "across domains.")) ->addExample( "http://phabricator2.example.com/\n". "http://phabricator3.example.com/", @@ -83,8 +83,9 @@ "PHP requires that you set a timezone in your php.ini before ". "using date functions, or it will emit a warning. If this isn't ". "possible (for instance, because you are using HPHP) you can set ". - "some valid constant for date_default_timezone_set() here and ". - "Phabricator will set it on your behalf, silencing the warning.")) + "some valid constant for %s here and Phabricator will set it on ". + "your behalf, silencing the warning.", + 'date_default_timezone_set()')) ->addExample('America/New_York', pht('US East (EDT)')) ->addExample('America/Chicago', pht('US Central (CDT)')) ->addExample('America/Boise', pht('US Mountain (MDT)')) @@ -92,14 +93,14 @@ $this->newOption('phabricator.cookie-prefix', 'string', null) ->setLocked(true) ->setSummary( - pht('Set a string Phabricator should use to prefix '. - 'cookie names.')) + pht( + 'Set a string Phabricator should use to prefix cookie names.')) ->setDescription( pht( 'Cookies set for x.com are also sent for y.x.com. Assuming '. 'Phabricator instances are running on both domains, this will '. 'create a collision preventing you from logging in.')) - ->addExample('dev', pht('Prefix cookie with "dev"')), + ->addExample('dev', pht('Prefix cookie with "%s"', 'dev')), $this->newOption('phabricator.show-prototypes', 'bool', false) ->setLocked(true) ->setBoolOptions( @@ -155,22 +156,29 @@ 'linked.')), $this->newOption('environment.append-paths', 'list', $paths) ->setSummary( - pht('These paths get appended to your \$PATH envrionment variable.')) + pht( + 'These paths get appended to your %s environment variable.', + '$PATH')) ->setDescription( pht( "Phabricator occasionally shells out to other binaries on the ". - "server. An example of this is the `pygmentize` command, used ". - "to syntax-highlight code written in languages other than PHP. ". - "By default, it is assumed that these binaries are in the \$PATH ". - "of the user running Phabricator (normally 'apache', 'httpd', or ". - "'nobody'). Here you can add extra directories to the \$PATH ". + "server. An example of this is the `%s` command, used to ". + "syntax-highlight code written in languages other than PHP. By ". + "default, it is assumed that these binaries are in the %s of the ". + "user running Phabricator (normally 'apache', 'httpd', or ". + "'nobody'). Here you can add extra directories to the %s ". "environment variable, for when these binaries are in ". "non-standard locations.\n\n". - "Note that you can also put binaries in ". - "`phabricator/support/bin/` (for example, by symlinking them).\n\n". + "Note that you can also put binaries in `%s` (for example, by ". + "symlinking them).\n\n". "The current value of PATH after configuration is applied is:\n\n". " lang=text\n". - " %s", $path)) + " %s", + '$PATH', + '$PATH', + 'phabricator/support/bin/', + $path, + 'pygmentize')) ->setLocked(true) ->addExample('/usr/local/bin', pht('Add One Path')) ->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')), @@ -200,7 +208,7 @@ ), pht('Applications application')))) ->setDescription( - pht('Array containing list of Uninstalled applications.')), + pht('Array containing list of uninstalled applications.')), $this->newOption('phabricator.application-settings', 'wild', array()) ->setLocked(true) ->setDescription( @@ -261,7 +269,9 @@ throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must start with ". - "'http://' or 'https://'.", + "%s' or '%s'.", + 'http://', + 'https://', $key)); } @@ -269,10 +279,12 @@ if (strpos($domain, '.') === false) { throw new PhabricatorConfigValidationException( pht( - "Config option '%s' is invalid. The URI must contain a dot ('.'), ". - "like 'http://example.com/', not just a bare name like ". - "'http://example/'. Some web browsers will not set cookies on ". - "domains with no TLD.", + "Config option '%s' is invalid. The URI must contain a dot ". + "('%s'), like '%s', not just a bare name like '%s'. Some web ". + "browsers will not set cookies on domains with no TLD.", + '.', + 'http://example.com/', + 'http://example/', $key)); } @@ -281,11 +293,11 @@ throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must NOT have a path, ". - "e.g. 'http://phabricator.example.com/' is OK, but ". - "'http://example.com/phabricator/' is not. Phabricator must be ". - "installed on an entire domain; it can not be installed on a ". - "path.", - $key)); + "e.g. '%s' is OK, but '%s' is not. Phabricator must be installed ". + "on an entire domain; it can not be installed on a path.", + $key, + 'http://phabricator.example.com/', + 'http://example.com/phabricator/')); } } @@ -299,16 +311,13 @@ throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The timezone identifier must ". - "be a valid timezone identifier recognized by PHP, like ". - "'America/Los_Angeles'. You can find a list of valid identifiers ". - "here: %s", + "be a valid timezone identifier recognized by PHP, like '%s'. "." + You can find a list of valid identifiers here: %s", $key, + 'America/Los_Angeles', 'http://php.net/manual/timezones.php')); } } - - - } diff --git a/src/applications/config/option/PhabricatorDeveloperConfigOptions.php b/src/applications/config/option/PhabricatorDeveloperConfigOptions.php --- a/src/applications/config/option/PhabricatorDeveloperConfigOptions.php +++ b/src/applications/config/option/PhabricatorDeveloperConfigOptions.php @@ -52,8 +52,9 @@ "even for logged-out users. This is only really useful if you ". "need to debug something on a logged-out page. You should not ". "enable this option in production.\n\n". - "You must enable DarkConsole by setting {{darkconsole.enabled}} ". - "before this option will have any effect.")), + "You must enable DarkConsole by setting '%s' ". + "before this option will have any effect.", + 'darkconsole.enabled')), $this->newOption('debug.time-limit', 'int', null) ->setSummary( pht( @@ -170,12 +171,13 @@ pht('Disable deflate compression'), )) ->setSummary( - pht('Toggle gzdeflate()-based compression for some caches.')) + pht('Toggle %s-based compression for some caches.', 'gzdeflate()')) ->setDescription( pht( - 'Set this to false to disable the use of gzdeflate()-based '. + 'Set this to false to disable the use of %s-based '. 'compression in some caches. This may give you less performant '. - '(but more debuggable) caching.')), + '(but more debuggable) caching.', + 'gzdeflate()')), ); } } diff --git a/src/applications/config/option/PhabricatorMailgunConfigOptions.php b/src/applications/config/option/PhabricatorMailgunConfigOptions.php --- a/src/applications/config/option/PhabricatorMailgunConfigOptions.php +++ b/src/applications/config/option/PhabricatorMailgunConfigOptions.php @@ -25,8 +25,9 @@ ->setLocked(true) ->setDescription( pht( - 'Mailgun domain name. See https://mailgun.com/cp/domains')) - ->addExample('mycompany.com', 'Use specific domain'), + 'Mailgun domain name. See %s.', + 'https://mailgun.com/cp/domains')) + ->addExample('mycompany.com', pht('Use specific domain')), $this->newOption('mailgun.api-key', 'string', null) ->setHidden(true) ->setDescription(pht('Mailgun API key.')), diff --git a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php --- a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php +++ b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php @@ -24,7 +24,7 @@ When a user takes an action which generates an email notification (like commenting on a Differential revision), Phabricator can either send that mail "From" the user's email address (like "alincoln@logcabin.com") or "From" the -'metamta.default-address' address. +'%s' address. The user experience is generally better if Phabricator uses the user's real address as the "From" since the messages are easier to organize when they appear @@ -43,7 +43,8 @@ initially, since the risk in turning it on is that your outgoing mail will never arrive. EODOC -)); + , + 'metamta.default-address')); $one_mail_per_recipient_desc = $this->deformat(pht(<<deformat(pht(<<deformat(pht(<<deformat(pht(<<newOption('storage.default-namespace', 'string', 'phabricator') ->setLocked(true) ->setSummary( diff --git a/src/applications/config/option/PhabricatorPHDConfigOptions.php b/src/applications/config/option/PhabricatorPHDConfigOptions.php --- a/src/applications/config/option/PhabricatorPHDConfigOptions.php +++ b/src/applications/config/option/PhabricatorPHDConfigOptions.php @@ -23,12 +23,10 @@ return array( $this->newOption('phd.pid-directory', 'string', '/var/tmp/phd/pid') ->setDescription( - pht( - 'Directory that phd should use to track running daemons.')), + pht('Directory that phd should use to track running daemons.')), $this->newOption('phd.log-directory', 'string', '/var/tmp/phd/log') ->setDescription( - pht( - 'Directory that the daemons should use to store log files.')), + pht('Directory that the daemons should use to store log files.')), $this->newOption('phd.taskmasters', 'int', 4) ->setSummary(pht('Maximum taskmaster daemon pool size.')) ->setDescription( @@ -47,8 +45,10 @@ pht( "Launch daemons in 'verbose' mode by default. This creates a lot ". "of output, but can help debug issues. Daemons launched in debug ". - "mode with 'phd debug' are always launched in verbose mode. See ". - "also 'phd.trace'.")), + "mode with '%s' are always launched in verbose mode. ". + "See also '%s'.", + 'phd debug', + 'phd.trace')), $this->newOption('phd.user', 'string', null) ->setLocked(true) ->setSummary(pht('System user to run daemons as.')) @@ -69,8 +69,10 @@ pht( "Launch daemons in 'trace' mode by default. This creates an ". "ENORMOUS amount of output, but can help debug issues. Daemons ". - "launched in debug mode with 'phd debug' are always launched in ". - "trace mode. See also 'phd.verbose'.")), + "launched in debug mode with '%s' are always launched in ". + "trace mode. See also '%s'.", + 'phd debug', + 'phd.verbose')), $this->newOption('phd.variant-config', 'list', array()) ->setDescription( pht( diff --git a/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php b/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php --- a/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php +++ b/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php @@ -43,9 +43,12 @@ ->setSummary(pht('Configure TLS or SSL for SMTP.')) ->setDescription( pht( - "Using PHPMailer with SMTP, you can set this to one of 'tls' or ". - "'ssl' to use TLS or SSL, respectively. Leave it blank for ". - "vanilla SMTP. If you're sending via Gmail, set it to 'ssl'.")), + "Using PHPMailer with SMTP, you can set this to one of '%s' or ". + "'%s' to use TLS or SSL, respectively. Leave it blank for ". + "vanilla SMTP. If you're sending via Gmail, set it to '%s'.", + 'tls', + 'ssl', + 'ssl')), $this->newOption('phpmailer.smtp-user', 'string', null) ->setLocked(true) ->setDescription(pht('Username for SMTP.')), diff --git a/src/applications/config/option/PhabricatorSMSConfigOptions.php b/src/applications/config/option/PhabricatorSMSConfigOptions.php --- a/src/applications/config/option/PhabricatorSMSConfigOptions.php +++ b/src/applications/config/option/PhabricatorSMSConfigOptions.php @@ -20,12 +20,10 @@ } public function getOptions() { - $adapter_description = $this->deformat(pht(<<newOption( @@ -40,7 +38,7 @@ 'class', null) ->setBaseClass('PhabricatorSMSImplementationAdapter') - ->setSummary(pht('Control how sms is sent.')) + ->setSummary(pht('Control how SMS is sent.')) ->setDescription($adapter_description), $this->newOption( 'twilio.account-sid', diff --git a/src/applications/config/option/PhabricatorSecurityConfigOptions.php b/src/applications/config/option/PhabricatorSecurityConfigOptions.php --- a/src/applications/config/option/PhabricatorSecurityConfigOptions.php +++ b/src/applications/config/option/PhabricatorSecurityConfigOptions.php @@ -92,12 +92,13 @@ "reasonably configure more granular behavior there.\n\n". "IMPORTANT: Phabricator determines if a request is HTTPS or not ". - "by examining the PHP \$_SERVER['HTTPS'] variable. If you run ". + "by examining the PHP `%s` variable. If you run ". "Apache/mod_php this will probably be set correctly for you ". "automatically, but if you run Phabricator as CGI/FCGI (e.g., ". "through nginx or lighttpd), you need to configure your web ". "server so that it passes the value correctly based on the ". - "connection type.")) + "connection type.", + "\$_SERVER['HTTPS']")) ->setBoolOptions( array( pht('Force HTTPS'), @@ -163,7 +164,8 @@ "When users write comments which have URIs, they'll be ". "automatically linked if the protocol appears in this set. This ". "whitelist is primarily to prevent security issues like ". - "javascript:// URIs.")) + "%s URIs.", + 'javascript://')) ->addExample("http\nhttps", pht('Valid Setting')) ->setLocked(true), $this->newOption( @@ -226,7 +228,7 @@ pht('Determines whether or not YouTube videos get embedded.')) ->setDescription( pht( - "If you enable this, linked YouTube videos will be embeded ". + "If you enable this, linked YouTube videos will be embedded ". "inline. This has mild security implications (you'll leak ". "referrers to YouTube) and is pretty silly (but sort of ". "awesome).")), @@ -308,8 +310,10 @@ throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must start with ". - "'http://' or 'https://'.", - $key)); + "'%s' or '%s'.", + $key, + 'http://', + 'https://')); } $domain = $uri->getDomain(); @@ -317,10 +321,11 @@ throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must contain a dot ('.'), ". - "like 'http://example.com/', not just a bare name like ". - "'http://example/'. Some web browsers will not set cookies on ". - "domains with no TLD.", - $key)); + "like '%s', not just a bare name like '%s'. ". + "Some web browsers will not set cookies on domains with no TLD.", + $key, + 'http://example.com/', + 'http://example/')); } $path = $uri->getPath(); @@ -328,11 +333,11 @@ throw new PhabricatorConfigValidationException( pht( "Config option '%s' is invalid. The URI must NOT have a path, ". - "e.g. 'http://phabricator.example.com/' is OK, but ". - "'http://example.com/phabricator/' is not. Phabricator must be ". - "installed on an entire domain; it can not be installed on a ". - "path.", - $key)); + "e.g. '%s' is OK, but '%s' is not. Phabricator must be installed ". + "on an entire domain; it can not be installed on a path.", + $key, + 'http://phabricator.example.com/', + 'http://example.com/phabricator/')); } } } diff --git a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php --- a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php +++ b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php @@ -34,8 +34,8 @@ pht( 'Phabricator can highlight PHP by default and use Pygments for '. 'other languages if enabled. You can provide a custom '. - 'highlighter engine by extending class '. - 'PhutilSyntaxHighlighterEngine.')), + 'highlighter engine by extending class %s.', + 'PhutilSyntaxHighlighterEngine')), $this->newOption('pygments.enabled', 'bool', false) ->setSummary( pht('Should Phabricator use Pygments to highlight code?')) @@ -128,7 +128,7 @@ 'be tested against the filename. They should map to either an '. 'explicit language as a string value, or a numeric index into '. 'the captured groups as an integer.')) - ->addExample('{"@\\.xyz$@": "php"}', pht('Highlight *.xyz as PHP.')) + ->addExample('{"@\\.xyz$@": "php"}', pht('Highlight %s as PHP.', '*.xyz')) ->addExample( '{"@/httpd\\.conf@": "apacheconf"}', pht('Highlight httpd.conf as "apacheconf".')) diff --git a/src/applications/config/option/PhabricatorTranslationsConfigOptions.php b/src/applications/config/option/PhabricatorTranslationsConfigOptions.php --- a/src/applications/config/option/PhabricatorTranslationsConfigOptions.php +++ b/src/applications/config/option/PhabricatorTranslationsConfigOptions.php @@ -25,10 +25,10 @@ ->setSummary(pht('Override translations.')) ->setDescription( pht( - "You can use 'translation.override' if you don't want to create ". - "a full translation to give users an option for switching to it ". - "and you just want to override some strings in the default ". - "translation.")) + "You can use '%s' if you don't want to create a full translation ". + "to give users an option for switching to it and you just want to ". + "override some strings in the default translation.", + 'translation.override')) ->addExample( '{"some string": "my alternative"}', pht('Valid Setting')), diff --git a/src/applications/config/option/PhabricatorUIConfigOptions.php b/src/applications/config/option/PhabricatorUIConfigOptions.php --- a/src/applications/config/option/PhabricatorUIConfigOptions.php +++ b/src/applications/config/option/PhabricatorUIConfigOptions.php @@ -50,8 +50,7 @@ return array( $this->newOption('ui.header-color', 'enum', 'dark') ->setDescription( - pht( - 'Sets the color of the main header.')) + pht('Sets the color of the main header.')) ->setEnumOptions($options), $this->newOption('ui.footer-items', 'list', array()) ->setSummary( diff --git a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php --- a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php +++ b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php @@ -9,10 +9,10 @@ public function getMethodDescription() { return pht( - 'Query for conpherence threads for the logged in user. '. - 'You can query by ids or phids for specific conpherence threads. '. - 'Otherwise, specify limit and offset to query the most recently '. - 'updated conpherences for the logged in user.'); + 'Query for Conpherence threads for the logged in user. You can query '. + 'by IDs or PHIDs for specific Conpherence threads. Otherwise, specify '. + 'limit and offset to query the most recently updated Conpherences for '. + 'the logged in user.'); } protected function defineParamTypes() { diff --git a/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php --- a/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php +++ b/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php @@ -10,9 +10,9 @@ public function getMethodDescription() { return pht( 'Query for transactions for the logged in user within a specific '. - 'conpherence thread. You can specify the thread by id or phid. '. + 'Conpherence thread. You can specify the thread by ID or PHID. '. 'Otherwise, specify limit and offset to query the most recent '. - 'transactions within the conpherence for the logged in user.'); + 'transactions within the Conpherence for the logged in user.'); } protected function defineParamTypes() { @@ -31,7 +31,7 @@ protected function defineErrorTypes() { return array( 'ERR_USAGE_NO_THREAD_ID' => pht( - 'You must specify a thread id or thread phid to query transactions '. + 'You must specify a thread id or thread PHID to query transactions '. 'from.'), ); } diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -208,7 +208,7 @@ $response_mode = 'ajax'; break; default: - throw new Exception('Unknown action: '.$action); + throw new Exception(pht('Unknown action: %s', $action)); break; } diff --git a/src/applications/conpherence/mail/ConpherenceReplyHandler.php b/src/applications/conpherence/mail/ConpherenceReplyHandler.php --- a/src/applications/conpherence/mail/ConpherenceReplyHandler.php +++ b/src/applications/conpherence/mail/ConpherenceReplyHandler.php @@ -14,7 +14,10 @@ public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof ConpherenceThread)) { - throw new Exception('Mail receiver is not a ConpherenceThread!'); + throw new Exception( + pht( + 'Mail receiver is not a %s!', ' + ConpherenceThread')); } } diff --git a/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php b/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php --- a/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php +++ b/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php @@ -84,8 +84,8 @@ $table = new AphrontTableView($rows); $table->setClassName('error-log'); - $table->setHeaders(array('Error')); - $table->setNoDataString('No errors.'); + $table->setHeaders(array(pht('Error'))); + $table->setNoDataString(pht('No errors.')); return phutil_tag( 'div', diff --git a/src/applications/console/plugin/DarkConsoleEventPlugin.php b/src/applications/console/plugin/DarkConsoleEventPlugin.php --- a/src/applications/console/plugin/DarkConsoleEventPlugin.php +++ b/src/applications/console/plugin/DarkConsoleEventPlugin.php @@ -3,11 +3,11 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { public function getName() { - return 'Events'; + return pht('Events'); } public function getDescription() { - return 'Information about Phabricator events and event listeners.'; + return pht('Information about Phabricator events and event listeners.'); } public function generateData() { @@ -51,8 +51,8 @@ $table = new AphrontTableView($rows); $table->setHeaders( array( - 'Internal ID', - 'Listener Class', + pht('Internal ID'), + pht('Listener Class'), )); $table->setColumnClasses( array( @@ -71,7 +71,7 @@ foreach ($data['events'] as $event) { $rows[] = array( $event['type'], - $event['stopped'] ? 'STOPPED' : null, + $event['stopped'] ? pht('STOPPED') : null, ); } @@ -82,8 +82,8 @@ )); $table->setHeaders( array( - 'Event Type', - 'Stopped', + pht('Event Type'), + pht('Stopped'), )); $out[] = $table->render(); diff --git a/src/applications/console/plugin/DarkConsoleRequestPlugin.php b/src/applications/console/plugin/DarkConsoleRequestPlugin.php --- a/src/applications/console/plugin/DarkConsoleRequestPlugin.php +++ b/src/applications/console/plugin/DarkConsoleRequestPlugin.php @@ -3,11 +3,14 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin { public function getName() { - return 'Request'; + return pht('Request'); } public function getDescription() { - return 'Information about $_REQUEST and $_SERVER.'; + return pht( + 'Information about %s and %s.', + '$_REQUEST', + '$_SERVER'); } public function generateData() { @@ -47,7 +50,7 @@ if (isset($mask[$key])) { $rows[] = array( $key, - phutil_tag('em', array(), '(Masked)'), + phutil_tag('em', array(), pht('(Masked)')), ); } else { $rows[] = array( diff --git a/src/applications/console/plugin/DarkConsoleServicesPlugin.php b/src/applications/console/plugin/DarkConsoleServicesPlugin.php --- a/src/applications/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/applications/console/plugin/DarkConsoleServicesPlugin.php @@ -5,11 +5,11 @@ protected $observations; public function getName() { - return 'Services'; + return pht('Services'); } public function getDescription() { - return 'Information about services.'; + return pht('Information about services.'); } public static function getQueryAnalyzerHeader() { @@ -44,7 +44,7 @@ $log[$key]['explain'] = array( 'sev' => 7, 'size' => null, - 'reason' => 'Disabled', + 'reason' => pht('Disabled'), ); // Query analysis is disabled for this request, so don't do any of it. continue; @@ -102,26 +102,26 @@ if (preg_match('/Using where/', $table['Extra'])) { if ($table['rows'] < 256 && !empty($table['possible_keys'])) { $cur_badness = 2; - $cur_reason = 'Small Table Scan'; + $cur_reason = pht('Small Table Scan'); } else { $cur_badness = 6; - $cur_reason = 'TABLE SCAN!'; + $cur_reason = pht('TABLE SCAN!'); } } else { $cur_badness = 3; - $cur_reason = 'Whole Table'; + $cur_reason = pht('Whole Table'); } break; default: if (preg_match('/No tables used/i', $table['Extra'])) { $cur_badness = 1; - $cur_reason = 'No Tables'; + $cur_reason = pht('No Tables'); } else if (preg_match('/Impossible/i', $table['Extra'])) { $cur_badness = 1; - $cur_reason = 'Empty'; + $cur_reason = pht('Empty'); } else { $cur_badness = 4; - $cur_reason = "Can't Analyze"; + $cur_reason = pht("Can't Analyze"); } break; } @@ -198,7 +198,7 @@ $summary[] = array( $type, number_format($counts[$type]), - number_format((int)(1000000 * $totals[$type])).' us', + pht('%d us', number_format((int)(1000000 * $totals[$type]))), sprintf('%.1f%%', 100 * $totals[$type] / $page_total), ); } @@ -212,10 +212,10 @@ )); $summary_table->setHeaders( array( - 'Type', - 'Count', - 'Total Cost', - 'Page Weight', + pht('Type'), + pht('Count'), + pht('Total Cost'), + pht('Page Weight'), )); $results[] = $summary_table->render(); @@ -260,8 +260,8 @@ $rows[] = array( $row['type'], - '+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms', - number_format(1000000 * $row['duration']).' us', + pht('+%d ms', number_format(1000 * ($row['begin'] - $data['start']))), + pht('%d us', number_format(1000000 * $row['duration'])), $info, $analysis, ); @@ -278,11 +278,11 @@ )); $table->setHeaders( array( - 'Event', - 'Start', - 'Duration', - 'Details', - 'Analysis', + pht('Event'), + pht('Start'), + pht('Duration'), + pht('Details'), + pht('Analysis'), )); $results[] = $table->render(); diff --git a/src/applications/console/plugin/DarkConsoleXHProfPlugin.php b/src/applications/console/plugin/DarkConsoleXHProfPlugin.php --- a/src/applications/console/plugin/DarkConsoleXHProfPlugin.php +++ b/src/applications/console/plugin/DarkConsoleXHProfPlugin.php @@ -5,7 +5,7 @@ protected $profileFilePHID; public function getName() { - return 'XHProf'; + return pht('XHProf'); } public function getColor() { @@ -17,7 +17,7 @@ } public function getDescription() { - return 'Provides detailed PHP profiling information through XHProf.'; + return pht('Provides detailed PHP profiling information through XHProf.'); } public function generateData() { @@ -47,14 +47,14 @@ 'href' => $href, 'class' => 'bright-link', ), - 'Installation Guide'); + pht('Installation Guide')); return hsprintf( - '
'. + '
%s
', + pht( 'The "xhprof" PHP extension is not available. Install xhprof '. 'to enable the XHProf console plugin. You can find instructions in '. - 'the %s.'. - '
', - $install_guide); + 'the %s.', + $install_guide)); } $result = array(); diff --git a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php --- a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php +++ b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php @@ -67,7 +67,7 @@ ); break; default: - error_log('Unknown event : '.$event); + error_log(pht('Unknown event: %s', $event)); break; } } diff --git a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php --- a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php @@ -33,8 +33,9 @@ ->setURI('/countdown/'); } - $inst = pht('Are you sure you want to delete the countdown %s?', - $countdown->getTitle()); + $inst = pht( + 'Are you sure you want to delete the countdown %s?', + $countdown->getTitle()); $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php --- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php @@ -50,7 +50,7 @@ $rows[] = array( $class, number_format($info['n']), - number_format((int)($info['duration'] / $info['n'])).' us', + pht('%d us', number_format((int)($info['duration'] / $info['n']))), ); } diff --git a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php --- a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php @@ -148,12 +148,10 @@ phutil_format_relative_time($wait_time)); break; case PhabricatorDaemonLog::STATUS_EXITING: - $details = pht( - 'This daemon is shutting down gracefully.'); + $details = pht('This daemon is shutting down gracefully.'); break; case PhabricatorDaemonLog::STATUS_EXITED: - $details = pht( - 'This daemon exited normally and is no longer running.'); + $details = pht('This daemon exited normally and is no longer running.'); break; } diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php --- a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php @@ -95,7 +95,7 @@ $status = pht('Cancelled'); break; default: - throw new Exception('Unknown task status!'); + throw new Exception(pht('Unknown task status!')); } } else { $status = pht('Queued'); @@ -141,7 +141,7 @@ $expires); if ($task->isArchived()) { - $duration = number_format($task->getDuration()).' us'; + $duration = pht('%d us', number_format($task->getDuration())); } else { $duration = phutil_tag('em', array(), pht('Not Completed')); } diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php @@ -23,8 +23,10 @@ ), array( 'name' => 'as-current-user', - 'help' => 'Run the daemon as the current user '. - 'instead of the configured phd.user', + 'help' => pht( + 'Run the daemon as the current user '. + 'instead of the configured %s', + 'phd.user'), ), array( 'name' => 'autoscale', diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php @@ -17,15 +17,15 @@ array( 'name' => 'id', 'param' => 'id', - 'help' => 'Show logs for daemon(s) with given ID(s).', + 'help' => pht('Show logs for daemon(s) with given ID(s).'), 'repeat' => true, ), array( 'name' => 'limit', 'param' => 'N', 'default' => 100, - 'help' => 'Show a specific number of log messages '. - '(default 100).', + 'help' => pht( + 'Show a specific number of log messages (default 100).'), ), )); } @@ -87,7 +87,7 @@ $console->writeOut( "%s\n", - sprintf( + pht( 'Daemon %d %s [%s] %s', $id, $type, diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php @@ -10,7 +10,8 @@ pht( 'Gracefully restart daemon processes in-place to pick up changes '. 'to source. This will not disrupt running jobs. This is an '. - 'advanced workflow; most installs should use __phd restart__.')) + 'advanced workflow; most installs should use __%s__.', + 'phd restart')) ->setArguments( array( array( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php @@ -6,9 +6,7 @@ protected function didConstruct() { $this ->setName('restart') - ->setSynopsis( - pht( - 'Stop, then start the standard daemon loadout.')) + ->setSynopsis(pht('Stop, then start the standard daemon loadout.')) ->setArguments( array( array( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php @@ -9,20 +9,21 @@ ->setSynopsis( pht( 'Start the standard configured collection of Phabricator daemons. '. - 'This is appropriate for most installs. Use **phd launch** to '. - 'customize which daemons are launched.')) + 'This is appropriate for most installs. Use **%s** to '. + 'customize which daemons are launched.', + 'phd launch')) ->setArguments( array( array( 'name' => 'keep-leases', 'help' => pht( - 'By default, **phd start** will free all task leases held by '. - 'the daemons. With this flag, this step will be skipped.'), + 'By default, **%s** will free all task leases held by '. + 'the daemons. With this flag, this step will be skipped.', + 'phd start'), ), array( 'name' => 'force', - 'help' => pht( - 'Start daemons even if daemons are already running.'), + 'help' => pht('Start daemons even if daemons are already running.'), ), $this->getAutoscaleReserveArgument(), )); diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php @@ -75,7 +75,7 @@ if (!$daemon->isRunning()) { $daemon->updateStatus(PhabricatorDaemonLog::STATUS_DEAD); $status = 2; - $name = ' '.$name; + $name = pht(' %s', $name); } $daemon_log = $daemon->getDaemonLog(); diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php @@ -9,7 +9,8 @@ ->setSynopsis( pht( 'Stop all running daemons, or specific daemons identified by PIDs. '. - 'Use **phd status** to find PIDs.')) + 'Use **%s** to find PIDs.', + 'phd status')) ->setArguments( array( array( diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php --- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php +++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php @@ -28,10 +28,15 @@ list($err) = exec_manual('mkdir -p %s', $path); if ($err) { throw new Exception( - "phd requires the directory '{$path}' to exist, but it does not ". - "exist and could not be created. Create this directory or update ". - "'phd.pid-directory' / 'phd.log-directory' in your configuration ". - "to point to an existing directory."); + pht( + "%s requires the directory '%s' to exist, but it does not exist ". + "and could not be created. Create this directory or update ". + "'%s' / '%s' in your configuration to point to an existing ". + "directory.", + 'phd', + $path, + 'phd.pid-directory', + 'phd.log-directory')); } } return $path; @@ -95,9 +100,9 @@ if (count($match) == 0) { throw new PhutilArgumentUsageException( pht( - "No daemons match '%s'! Use 'phd list' for a list of available ". - "daemons.", - $substring)); + "No daemons match '%s'! Use '%s' for a list of available daemons.", + $substring, + 'phd list')); } else if (count($match) > 1) { throw new PhutilArgumentUsageException( pht( @@ -130,14 +135,21 @@ $current_user = $current_user['name']; if ($phd_user && $phd_user != $current_user) { if ($debug) { - throw new PhutilArgumentUsageException(pht( - 'You are trying to run a daemon as a nonstandard user, '. - 'and `phd` was not able to `sudo` to the correct user. '."\n". - 'Phabricator is configured to run daemons as "%s", '. - 'but the current user is "%s". '."\n". - 'Use `sudo` to run as a different user, pass `--as-current-user` '. - 'to ignore this warning, or edit `phd.user` '. - 'to change the configuration.', $phd_user, $current_user)); + throw new PhutilArgumentUsageException( + pht( + "You are trying to run a daemon as a nonstandard user, ". + "and `%s` was not able to `%s` to the correct user. \n". + 'Phabricator is configured to run daemons as "%s", '. + 'but the current user is "%s". '."\n". + 'Use `%s` to run as a different user, pass `%s` to ignore this '. + 'warning, or edit `%s` to change the configuration.', + 'phd', + 'sudo', + $phd_user, + $current_user, + 'sudo', + '--as-current-user', + 'phd.user')); } else { $this->runDaemonsAsUser = $phd_user; $console->writeOut(pht('Starting daemons as %s', $phd_user)."\n"); @@ -213,8 +225,9 @@ $this->runDaemonsAsUser); } catch (Exception $e) { // Retry without sudo - $console->writeOut(pht( - "sudo command failed. Starting daemon as current user\n")); + $console->writeOut( + "%s\n", + pht('sudo command failed. Starting daemon as current user.')); $this->executeDaemonLaunchCommand( $command, $daemon_script_dir, @@ -270,8 +283,10 @@ private static function mustHaveExtension($ext) { if (!extension_loaded($ext)) { - echo "ERROR: The PHP extension '{$ext}' is not installed. You must ". - "install it to run daemons on this machine.\n"; + echo pht( + "ERROR: The PHP extension '%s' is not installed. You must ". + "install it to run daemons on this machine.\n", + $ext); exit(1); } @@ -279,8 +294,10 @@ foreach ($extension->getFunctions() as $function) { $function = $function->name; if (!function_exists($function)) { - echo "ERROR: The PHP function {$function}() is disabled. You must ". - "enable it to run daemons on this machine.\n"; + echo pht( + "ERROR: The PHP function %s is disabled. You must ". + "enable it to run daemons on this machine.\n", + $function.'()'); exit(1); } } @@ -311,11 +328,15 @@ $message = pht( "phd start: Unable to start daemons because daemons are already ". "running.\n\n". - "You can view running daemons with 'phd status'.\n". - "You can stop running daemons with 'phd stop'.\n". - "You can use 'phd restart' to stop all daemons before starting ". + "You can view running daemons with '%s'.\n". + "You can stop running daemons with '%s'.\n". + "You can use '%s' to stop all daemons before starting ". "new daemons.\n". - "You can force daemons to start anyway with --force."); + "You can force daemons to start anyway with %s.", + 'phd status', + 'phd stop', + 'phd restart', + '--force'); $console->writeErr("%s\n", $message); exit(1); @@ -352,7 +373,7 @@ $this->launchDaemons($daemons, $is_debug = false); - $console->writeErr(pht('Done.')."\n"); + $console->writeErr("%s\n", pht('Done.')); return 0; } @@ -369,8 +390,9 @@ if ($gently && $force) { throw new PhutilArgumentUsageException( pht( - 'You can not specify conflicting options --gently and --force '. - 'together.')); + 'You can not specify conflicting options %s and %s together.', + '--gently', + '--force')); } $daemons = $this->loadRunningDaemons(); @@ -383,8 +405,9 @@ $force); } if (!$survivors) { - $console->writeErr(pht( - 'There are no running Phabricator daemons.')."\n"); + $console->writeErr( + "%s\n", + pht('There are no running Phabricator daemons.')); } return 0; } @@ -392,7 +415,7 @@ $stop_pids = $this->selectDaemonPIDs($daemons, $pids); if (!$stop_pids) { - $console->writeErr(pht('No daemons to kill.')."\n"); + $console->writeErr("%s\n", pht('No daemons to kill.')); return 0; } @@ -470,12 +493,13 @@ $survivors = $this->sendStopSignals($rogue_pids, $grace_period); if ($survivors) { $console->writeErr( + "%s\n", pht( 'Unable to stop processes running without PID files. '. - 'Try running this command again with sudo.')."\n"); + 'Try running this command again with sudo.')); } } else if ($warn) { - $console->writeErr($this->getForceStopHint($rogue_daemons)."\n"); + $console->writeErr("%s\n", $this->getForceStopHint($rogue_daemons)); } } @@ -488,11 +512,11 @@ $debug_output .= $rogue['pid'].' '.$rogue['command']."\n"; } return pht( - 'There are processes running that look like Phabricator daemons but '. - 'have no corresponding PID files:'."\n\n".'%s'."\n\n". - 'Stop these processes by re-running this command with the --force '. - 'parameter.', - $debug_output); + "There are processes running that look like Phabricator daemons but ". + "have no corresponding PID files:\n\n%s\n\n". + "Stop these processes by re-running this command with the %s parameter.", + $debug_output, + '--force'); } private function sendStopSignals($pids, $grace_period) { diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php --- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php @@ -99,7 +99,7 @@ array( 'href' => '/daemon/log/'.$event->getLogID().'/', ), - 'Daemon '.$event->getLogID())); + pht('Daemon %s', $event->getLogID()))); } $rows[] = $row; diff --git a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php --- a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php @@ -56,7 +56,7 @@ $button = pht('Create Dashboard'); $cancel_uri = $this->getApplicationURI(); - $crumbs->addTextCrumb('Create Dashboard'); + $crumbs->addTextCrumb(pht('Create Dashboard')); } else { $id = $dashboard->getID(); $cancel_uri = $this->getApplicationURI('manage/'.$id.'/'); @@ -226,11 +226,9 @@ "This is a simple template dashboard. You can edit this panel ". "to change this text and replace it with a welcome message, or ". "leave this placeholder text as-is to give your dashboard a ". - "rustic, authentic feel.". - "\n\n". + "rustic, authentic feel.\n\n". "You can drag, remove, add, and edit panels to customize the ". - "rest of this dashboard to show the information you want.". - "\n\n". + "rest of this dashboard to show the information you want.\n\n". "To install this dashboard on the home page, use the ". "**Install Dashboard** action link above."), )); diff --git a/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php b/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php --- a/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php +++ b/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php @@ -124,10 +124,10 @@ ); break; case self::MODE_FULL: - throw new Exception('There is only one column in mode full.'); + throw new Exception(pht('There is only one column in mode full.')); break; default: - throw new Exception('Unknown layout mode!'); + throw new Exception(pht('Unknown layout mode!')); break; } diff --git a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php --- a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php +++ b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php @@ -109,8 +109,7 @@ } else if ($type == 'two') { $cparser->setRenderer(new DifferentialChangesetTwoUpTestRenderer()); } else { - throw new Exception( - pht('Unknown renderer type "%s"!', $type)); + throw new Exception(pht('Unknown renderer type "%s"!', $type)); } $parsers[] = $cparser; diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php --- a/src/applications/differential/application/PhabricatorDifferentialApplication.php +++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php @@ -50,11 +50,9 @@ } public function getOverview() { - return pht(<< 'Revision was not found.', + 'ERR_NOT_FOUND' => pht('Revision was not found.'), ); } diff --git a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php @@ -27,7 +27,7 @@ protected function defineErrorTypes() { return array( - 'ERR_BAD_REVISION' => 'Bad revision ID.', + 'ERR_BAD_REVISION' => pht('Bad revision ID.'), ); } diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Create a new Differential diff.'; + return pht('Create a new Differential diff.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Add an inline comment to a Differential revision.'; + return pht('Add an inline comment to a Differential revision.'); } protected function defineParamTypes() { @@ -29,11 +29,16 @@ protected function defineErrorTypes() { return array( - 'ERR-BAD-REVISION' => 'Bad revision ID.', - 'ERR-BAD-DIFF' => 'Bad diff ID, or diff does not belong to revision.', - 'ERR-NEED-DIFF' => 'Neither revision ID nor diff ID was provided.', - 'ERR-NEED-FILE' => 'A file path was not provided.', - 'ERR-BAD-FILE' => "Requested file doesn't exist in this revision.", + 'ERR-BAD-REVISION' => pht( + 'Bad revision ID.'), + 'ERR-BAD-DIFF' => pht( + 'Bad diff ID, or diff does not belong to revision.'), + 'ERR-NEED-DIFF' => pht( + 'Neither revision ID nor diff ID was provided.'), + 'ERR-NEED-FILE' => pht( + 'A file path was not provided.'), + 'ERR-BAD-FILE' => pht( + "Requested file doesn't exist in this revision."), ); } diff --git a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php @@ -27,7 +27,7 @@ protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'Bad diff ID.', + 'ERR_BAD_DIFF' => pht('Bad diff ID.'), ); } diff --git a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php @@ -12,11 +12,11 @@ } public function getMethodStatusDescription() { - return "Replaced by 'differential.query'."; + return pht("Replaced by '%s'.", 'differential.query'); } public function getMethodDescription() { - return 'Query Differential revisions which match certain criteria.'; + return pht('Query Differential revisions which match certain criteria.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php @@ -8,8 +8,9 @@ } public function getMethodDescription() { - return 'Update diff with new lint messages and mark postponed '. - 'linters as finished.'; + return pht( + 'Update diff with new lint messages and mark postponed '. + 'linters as finished.'); } protected function defineParamTypes() { @@ -25,14 +26,13 @@ protected function defineErrorTypes() { return array( - 'ERR-BAD-DIFF' => 'Bad diff ID.', - 'ERR-BAD-LINTER' => 'No postponed linter by the given name', - 'ERR-NO-LINT' => 'No postponed lint field available in diff', + 'ERR-BAD-DIFF' => pht('Bad diff ID.'), + 'ERR-BAD-LINTER' => pht('No postponed linter by the given name.'), + 'ERR-NO-LINT' => pht('No postponed lint field available in diff.'), ); } protected function execute(ConduitAPIRequest $request) { - $diff_id = $request->getValue('diffID'); $linter_map = $request->getValue('linters'); diff --git a/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php @@ -13,11 +13,12 @@ public function getMethodStatusDescription() { return pht( - 'This method has been deprecated in favor of differential.querydiffs.'); + 'This method has been deprecated in favor of %s.', + 'differential.querydiffs'); } public function getMethodDescription() { - return 'Load all diffs for given revisions from Differential.'; + return pht('Load all diffs for given revisions from Differential.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Retrieve Differential commit messages or message templates.'; + return pht('Retrieve Differential commit messages or message templates.'); } protected function defineParamTypes() { @@ -27,7 +27,7 @@ protected function defineErrorTypes() { return array( - 'ERR_NOT_FOUND' => 'Revision was not found.', + 'ERR_NOT_FOUND' => pht('Revision was not found.'), ); } diff --git a/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php @@ -8,8 +8,9 @@ } public function getMethodDescription() { - return 'Query which paths should be included when committing a '. - 'Differential revision.'; + return pht( + 'Query which paths should be included when committing a '. + 'Differential revision.'); } protected function defineParamTypes() { @@ -24,7 +25,7 @@ protected function defineErrorTypes() { return array( - 'ERR_NOT_FOUND' => 'No such revision exists.', + 'ERR_NOT_FOUND' => pht('No such revision exists.'), ); } diff --git a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php @@ -24,8 +24,8 @@ public function getMethodDescription() { return pht( - 'Load the content of a diff from Differential by revision id '. - 'or diff id.'); + 'Load the content of a diff from Differential by revision ID '. + 'or diff ID.'); } protected function defineParamTypes() { @@ -41,7 +41,7 @@ protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'No such diff exists.', + 'ERR_BAD_DIFF' => pht('No such diff exists.'), ); } diff --git a/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php @@ -16,7 +16,7 @@ } public function getMethodDescription() { - return 'Retrieve Differential Revision Comments.'; + return pht('Retrieve Differential Revision Comments.'); } protected function defineParamTypes() { diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Query Differential revisions which match certain criteria.'; + return pht('Query Differential revisions which match certain criteria.'); } protected function defineParamTypes() { @@ -53,7 +53,7 @@ protected function defineErrorTypes() { return array( - 'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.', + 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'), ); } @@ -103,7 +103,9 @@ } throw id(new ConduitException('ERR-INVALID-PARAMETER')) ->setErrorDescription( - 'Unknown paths: '.implode(', ', $unknown_paths)); + pht( + 'Unknown paths: %s', + implode(', ', $unknown_paths))); } $repos = array(); @@ -118,7 +120,9 @@ if (!$repos[$callsign]) { throw id(new ConduitException('ERR-INVALID-PARAMETER')) ->setErrorDescription( - 'Unknown repo callsign: '.$callsign); + pht( + 'Unknown repo callsign: %s', + $callsign)); } } $repo = $repos[$callsign]; diff --git a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Attach properties to Differential diffs.'; + return pht('Attach properties to Differential diffs.'); } protected function defineParamTypes() { @@ -25,7 +25,7 @@ protected function defineErrorTypes() { return array( - 'ERR_NOT_FOUND' => 'Diff was not found.', + 'ERR_NOT_FOUND' => pht('Diff was not found.'), ); } diff --git a/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php @@ -26,10 +26,10 @@ protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'Bad diff ID.', - 'ERR_BAD_REVISION' => 'Bad revision ID.', - 'ERR_WRONG_USER' => 'You are not the author of this revision.', - 'ERR_CLOSED' => 'This revision has already been closed.', + 'ERR_BAD_DIFF' => pht('Bad diff ID.'), + 'ERR_BAD_REVISION' => pht('Bad revision ID.'), + 'ERR_WRONG_USER' => pht('You are not the author of this revision.'), + 'ERR_CLOSED' => pht('This revision has already been closed.'), ); } diff --git a/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php --- a/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Update arc unit results for a postponed test.'; + return pht('Update arc unit results for a postponed test.'); } protected function defineParamTypes() { @@ -29,13 +29,12 @@ protected function defineErrorTypes() { return array( - 'ERR_BAD_DIFF' => 'Bad diff ID.', - 'ERR_NO_RESULTS' => 'Could not find the postponed test', + 'ERR_BAD_DIFF' => pht('Bad diff ID.'), + 'ERR_NO_RESULTS' => pht('Could not find the postponed test'), ); } protected function execute(ConduitAPIRequest $request) { - $diff_id = $request->getValue('diff_id'); if (!$diff_id) { throw new ConduitException('ERR_BAD_DIFF'); diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php --- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php +++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php @@ -201,11 +201,12 @@ )) ->setSummary(pht('Allows any user to reopen a closed revision.')) ->setDescription( - pht('If you set this to true, any user can reopen a revision so '. - 'long as it has been closed. This can be useful if a revision '. - 'is accidentally closed or if a developer changes his or her '. - 'mind after closing a revision. If it is false, reopening '. - 'is not allowed.')), + pht( + 'If you set this to true, any user can reopen a revision so '. + 'long as it has been closed. This can be useful if a revision '. + 'is accidentally closed or if a developer changes his or her '. + 'mind after closing a revision. If it is false, reopening '. + 'is not allowed.')), $this->newOption('differential.close-on-accept', 'bool', false) ->setBoolOptions( array( @@ -242,8 +243,9 @@ pht("After this many days, a revision will be considered 'stale'.")) ->setDescription( pht( - "Similar to `differential.days-fresh` but marks stale revisions. ". - "If the revision is even older than it is when marked as 'old'.")), + "Similar to `%s` but marks stale revisions. ". + "If the revision is even older than it is when marked as 'old'.", + 'differential.days-fresh')), $this->newOption( 'metamta.differential.subject-prefix', 'string', diff --git a/src/applications/differential/constants/DifferentialAction.php b/src/applications/differential/constants/DifferentialAction.php --- a/src/applications/differential/constants/DifferentialAction.php +++ b/src/applications/differential/constants/DifferentialAction.php @@ -23,71 +23,88 @@ public static function getBasicStoryText($action, $author_name) { switch ($action) { case self::ACTION_COMMENT: - $title = pht('%s commented on this revision.', + $title = pht( + '%s commented on this revision.', $author_name); break; case self::ACTION_ACCEPT: - $title = pht('%s accepted this revision.', + $title = pht( + '%s accepted this revision.', $author_name); break; case self::ACTION_REJECT: - $title = pht('%s requested changes to this revision.', + $title = pht( + '%s requested changes to this revision.', $author_name); break; case self::ACTION_RETHINK: - $title = pht('%s planned changes to this revision.', + $title = pht( + '%s planned changes to this revision.', $author_name); break; case self::ACTION_ABANDON: - $title = pht('%s abandoned this revision.', + $title = pht( + '%s abandoned this revision.', $author_name); break; case self::ACTION_CLOSE: - $title = pht('%s closed this revision.', + $title = pht( + '%s closed this revision.', $author_name); break; case self::ACTION_REQUEST: - $title = pht('%s requested a review of this revision.', + $title = pht( + '%s requested a review of this revision.', $author_name); break; case self::ACTION_RECLAIM: - $title = pht('%s reclaimed this revision.', + $title = pht( + '%s reclaimed this revision.', $author_name); break; case self::ACTION_UPDATE: - $title = pht('%s updated this revision.', + $title = pht( + '%s updated this revision.', $author_name); break; case self::ACTION_RESIGN: - $title = pht('%s resigned from this revision.', + $title = pht( + '%s resigned from this revision.', $author_name); break; case self::ACTION_SUMMARIZE: - $title = pht('%s summarized this revision.', + $title = pht( + '%s summarized this revision.', $author_name); break; case self::ACTION_TESTPLAN: - $title = pht('%s explained the test plan for this revision.', + $title = pht( + '%s explained the test plan for this revision.', $author_name); break; case self::ACTION_CREATE: - $title = pht('%s created this revision.', + $title = pht( + '%s created this revision.', $author_name); break; case self::ACTION_ADDREVIEWERS: - $title = pht('%s added reviewers to this revision.', + $title = pht( + '%s added reviewers to this revision.', $author_name); break; case self::ACTION_ADDCCS: - $title = pht('%s added CCs to this revision.', + $title = pht( + '%s added CCs to this revision.', $author_name); break; case self::ACTION_CLAIM: - $title = pht('%s commandeered this revision.', + $title = pht( + '%s commandeered this revision.', $author_name); break; case self::ACTION_REOPEN: - $title = pht('%s reopened this revision.', + $title = pht( + '%s reopened this revision.', $author_name); break; case DifferentialTransaction::TYPE_INLINE: @@ -122,7 +139,7 @@ if (!empty($verbs[$action])) { return $verbs[$action]; } else { - return 'brazenly '.$action; + return pht('brazenly %s', $action); } } diff --git a/src/applications/differential/constants/DifferentialChangeType.php b/src/applications/differential/constants/DifferentialChangeType.php --- a/src/applications/differential/constants/DifferentialChangeType.php +++ b/src/applications/differential/constants/DifferentialChangeType.php @@ -105,7 +105,7 @@ self::TYPE_MESSAGE => pht('Commit Message'), self::TYPE_CHILD => pht('Contents Modified'), ); - return idx($types, coalesce($type, '?'), 'Unknown'); + return idx($types, coalesce($type, '?'), pht('Unknown')); } } diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -372,7 +372,7 @@ $inline = new DifferentialInlineComment(); $inline->setChangesetID($changeset->getID()); $inline->setIsNewFile(1); - $inline->setSyntheticAuthor('Lint: '.$msg['name']); + $inline->setSyntheticAuthor(pht('Lint: %s', $msg['name'])); $inline->setLineNumber($msg['line']); $inline->setLineLength(0); diff --git a/src/applications/differential/controller/DifferentialDiffCreateController.php b/src/applications/differential/controller/DifferentialDiffCreateController.php --- a/src/applications/differential/controller/DifferentialDiffCreateController.php +++ b/src/applications/differential/controller/DifferentialDiffCreateController.php @@ -89,7 +89,7 @@ 'href' => $arcanist_href, 'target' => '_blank', ), - 'Learn More'); + pht('Learn More')); $cancel_uri = $this->getApplicationURI(); diff --git a/src/applications/differential/controller/DifferentialInlineCommentEditController.php b/src/applications/differential/controller/DifferentialInlineCommentEditController.php --- a/src/applications/differential/controller/DifferentialInlineCommentEditController.php +++ b/src/applications/differential/controller/DifferentialInlineCommentEditController.php @@ -29,7 +29,7 @@ $revision = $this->loadRevision(); if (!id(new DifferentialChangeset())->load($changeset_id)) { - throw new Exception('Invalid changeset ID!'); + throw new Exception(pht('Invalid changeset ID!')); } return id(new DifferentialInlineComment()) @@ -59,7 +59,7 @@ $inline = $this->loadComment($id); if (!$this->canEditInlineComment($user, $inline)) { - throw new Exception('That comment is not editable!'); + throw new Exception(pht('That comment is not editable!')); } return $inline; } diff --git a/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php b/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php --- a/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php +++ b/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php @@ -55,9 +55,10 @@ $body_why = array(); if ($revision_match_data['usedURI']) { return pht( - 'We found a "Differential Revision" field with value "%s" in the '. - 'commit message, and the domain on the URI matches this install, so '. + 'We found a "%s" field with value "%s" in the commit message, '. + 'and the domain on the URI matches this install, so '. 'we linked this commit to %s.', + 'Differential Revision', $revision_match_data['foundURI'], phutil_tag( 'a', @@ -67,16 +68,17 @@ $obj_handle->getName())); } else if ($revision_match_data['foundURI']) { $body_why[] = pht( - 'We found a "Differential Revision" field with value "%s" in the '. - 'commit message, but the domain on this URI did not match the '. - 'configured domain for this install, "%s", so we ignored it under '. + 'We found a "%s" field with value "%s" in the commit message, '. + 'but the domain on this URI did not match the configured '. + 'domain for this install, "%s", so we ignored it under '. 'the assumption that it refers to some third-party revision.', + 'Differential Revision', $revision_match_data['foundURI'], $revision_match_data['validDomain']); } else { $body_why[] = pht( - 'We didn\'t find a "Differential Revision" field in the commit '. - 'message.'); + 'We didn\'t find a "%s" field in the commit message.', + 'Differential Revision'); } switch ($revision_match_data['matchHashType']) { diff --git a/src/applications/differential/controller/DifferentialRevisionEditController.php b/src/applications/differential/controller/DifferentialRevisionEditController.php --- a/src/applications/differential/controller/DifferentialRevisionEditController.php +++ b/src/applications/differential/controller/DifferentialRevisionEditController.php @@ -49,7 +49,8 @@ } if ($diff->getRevisionID()) { // TODO: Redirect? - throw new Exception('This diff is already attached to a revision!'); + throw new Exception( + pht('This diff is already attached to a revision!')); } } else { $diff = null; diff --git a/src/applications/differential/controller/DifferentialRevisionLandController.php b/src/applications/differential/controller/DifferentialRevisionLandController.php --- a/src/applications/differential/controller/DifferentialRevisionLandController.php +++ b/src/applications/differential/controller/DifferentialRevisionLandController.php @@ -29,10 +29,12 @@ $this->pushStrategy = newv($this->strategyClass, array()); } else { throw new Exception( - "Strategy type must be a valid class name and must subclass ". - "DifferentialLandingStrategy. ". - "'{$this->strategyClass}' is not a subclass of ". - "DifferentialLandingStrategy."); + pht( + "Strategy type must be a valid class name and must subclass ". + "%s. '%s' is not a subclass of %s", + 'DifferentialLandingStrategy', + $this->strategyClass, + 'DifferentialLandingStrategy')); } if ($request->isDialogFormPost()) { @@ -91,7 +93,7 @@ $prompt = hsprintf('%s

%s', pht( 'This will squash and rebase revision %s, and push it to '. - 'the default / master branch.', + 'the default / master branch.', $revision_id), pht('It is an experimental feature and may not work.')); @@ -109,13 +111,13 @@ private function attemptLand($revision, $request) { $status = $revision->getStatus(); if ($status != ArcanistDifferentialRevisionStatus::ACCEPTED) { - throw new Exception('Only Accepted revisions can be landed.'); + throw new Exception(pht('Only Accepted revisions can be landed.')); } $repository = $revision->getRepository(); if ($repository === null) { - throw new Exception('revision is not attached to a repository.'); + throw new Exception(pht('Revision is not attached to a repository.')); } $can_push = PhabricatorPolicyFilter::hasCapability( diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -38,7 +38,7 @@ if (!$diffs) { throw new Exception( - 'This revision has no diffs. Something has gone quite wrong.'); + pht('This revision has no diffs. Something has gone quite wrong.')); } $revision->attachActiveDiff(last($diffs)); @@ -151,7 +151,7 @@ if (count($changesets) > $limit && !$large) { $count = count($changesets); $warning = new PHUIInfoView(); - $warning->setTitle('Very Large Diff'); + $warning->setTitle(pht('Very Large Diff')); $warning->setSeverity(PHUIInfoView::SEVERITY_WARNING); $warning->appendChild(hsprintf( '%s %s', @@ -328,7 +328,7 @@ $changeset_view->setRepository($repository); } $changeset_view->setSymbolIndexes($symbol_indexes); - $changeset_view->setTitle('Diff '.$target->getID()); + $changeset_view->setTitle(pht('Diff %s', $target->getID())); $diff_history = id(new DifferentialRevisionUpdateHistoryView()) ->setUser($user) diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php --- a/src/applications/differential/customfield/DifferentialBranchField.php +++ b/src/applications/differential/customfield/DifferentialBranchField.php @@ -45,8 +45,9 @@ public function getProTips() { return array( pht( - 'In Git and Mercurial, use a branch like "T123" to automatically '. - 'associate changes with the corresponding task.'), + 'In Git and Mercurial, use a branch like "%s" to automatically '. + 'associate changes with the corresponding task.', + 'T123'), ); } diff --git a/src/applications/differential/customfield/DifferentialConflictsField.php b/src/applications/differential/customfield/DifferentialConflictsField.php --- a/src/applications/differential/customfield/DifferentialConflictsField.php +++ b/src/applications/differential/customfield/DifferentialConflictsField.php @@ -22,8 +22,8 @@ public function getFieldDescription() { return pht( - 'Parses the "Conflicts" field which Git can inject into commit '. - 'messages.'); + 'Parses the "%s" field which Git can inject into commit messages.', + 'Conflicts'); } public function canDisableField() { diff --git a/src/applications/differential/customfield/DifferentialDependsOnField.php b/src/applications/differential/customfield/DifferentialDependsOnField.php --- a/src/applications/differential/customfield/DifferentialDependsOnField.php +++ b/src/applications/differential/customfield/DifferentialDependsOnField.php @@ -45,7 +45,8 @@ return array( pht( 'Create a dependency between revisions by writing '. - '"Depends on D123" in your summary.'), + '"%s" in your summary.', + 'Depends on D123'), ); } diff --git a/src/applications/differential/customfield/DifferentialGitSVNIDField.php b/src/applications/differential/customfield/DifferentialGitSVNIDField.php --- a/src/applications/differential/customfield/DifferentialGitSVNIDField.php +++ b/src/applications/differential/customfield/DifferentialGitSVNIDField.php @@ -22,8 +22,8 @@ public function getFieldDescription() { return pht( - 'Parses the "git-svn-id" field which Git/SVN can inject into commit '. - 'messages.'); + 'Parses the "%s" field which Git/SVN can inject into commit messages.', + 'git-svn-id'); } public function canDisableField() { diff --git a/src/applications/differential/customfield/DifferentialLintField.php b/src/applications/differential/customfield/DifferentialLintField.php --- a/src/applications/differential/customfield/DifferentialLintField.php +++ b/src/applications/differential/customfield/DifferentialLintField.php @@ -83,7 +83,7 @@ $name = idx($message, 'name'); $description = idx($message, 'description'); - $line_link = 'line '.intval($line); + $line_link = pht('line %d', intval($line)); if (isset($path_changesets[$path])) { $href = '#C'.$path_changesets[$path].'NL'.max(1, $line); @@ -130,7 +130,9 @@ idx($location, 'path', $path). ($other_line ? ":{$other_line}" : ''); } - $description .= "\nOther locations: ".implode(', ', $locations); + $description .= "\n".pht( + 'Other locations: %s', + implode(', ', $locations)); } if (strlen($description)) { @@ -231,7 +233,9 @@ } } - return 'Show Full Lint Results ('.implode(', ', $show).')'; + return pht( + 'Show Full Lint Results (%s)', + implode(', ', $show)); } public function getWarningsForDetailView() { diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php --- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php +++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php @@ -106,8 +106,9 @@ public function getProTips() { return array( pht( - 'Write "Fixes T123" in your summary to automatically close the '. - 'corresponding task when this change lands.'), + 'Write "%s" in your summary to automatically close the '. + 'corresponding task when this change lands.', + 'Fixes T123'), ); } diff --git a/src/applications/differential/customfield/DifferentialProjectReviewersField.php b/src/applications/differential/customfield/DifferentialProjectReviewersField.php --- a/src/applications/differential/customfield/DifferentialProjectReviewersField.php +++ b/src/applications/differential/customfield/DifferentialProjectReviewersField.php @@ -61,7 +61,8 @@ return array( pht( 'You can add a project as a subscriber or reviewer by writing '. - '"#projectname" in the appropriate field.'), + '"%s" in the appropriate field.', + '#projectname'), ); } diff --git a/src/applications/differential/customfield/DifferentialRepositoryField.php b/src/applications/differential/customfield/DifferentialRepositoryField.php --- a/src/applications/differential/customfield/DifferentialRepositoryField.php +++ b/src/applications/differential/customfield/DifferentialRepositoryField.php @@ -155,7 +155,8 @@ return; } - $body->addTextSection(pht('REPOSITORY'), + $body->addTextSection( + pht('REPOSITORY'), $repository->getMonogram().' '.$repository->getName()); } diff --git a/src/applications/differential/customfield/DifferentialRevisionIDField.php b/src/applications/differential/customfield/DifferentialRevisionIDField.php --- a/src/applications/differential/customfield/DifferentialRevisionIDField.php +++ b/src/applications/differential/customfield/DifferentialRevisionIDField.php @@ -19,8 +19,7 @@ public function getFieldDescription() { return pht( - 'Ties commits to revisions and provides a permananent link between '. - 'them.'); + 'Ties commits to revisions and provides a permanent link between them.'); } public function canDisableField() { diff --git a/src/applications/differential/customfield/DifferentialUnitField.php b/src/applications/differential/customfield/DifferentialUnitField.php --- a/src/applications/differential/customfield/DifferentialUnitField.php +++ b/src/applications/differential/customfield/DifferentialUnitField.php @@ -49,7 +49,7 @@ if ($excuse) { $rows[] = array( 'style' => 'excuse', - 'name' => 'Excuse', + 'name' => pht('Excuse'), 'value' => phutil_escape_html_newlines($excuse), 'show' => true, ); @@ -83,8 +83,8 @@ $userdata = str_replace("\000", '', $userdata); } $markup_object = id(new PhabricatorMarkupOneOff()) - ->setContent($userdata) - ->setPreserveLinebreaks(true); + ->setContent($userdata) + ->setPreserveLinebreaks(true); $engine->addObject($markup_object, 'default'); $markup_objects[$key] = $markup_object; } @@ -189,12 +189,12 @@ )) + $hidden; $noun = array( - ArcanistUnitTestResult::RESULT_BROKEN => 'Broken', - ArcanistUnitTestResult::RESULT_FAIL => 'Failed', - ArcanistUnitTestResult::RESULT_UNSOUND => 'Unsound', - ArcanistUnitTestResult::RESULT_SKIP => 'Skipped', - ArcanistUnitTestResult::RESULT_POSTPONED => 'Postponed', - ArcanistUnitTestResult::RESULT_PASS => 'Passed', + ArcanistUnitTestResult::RESULT_BROKEN => pht('Broken'), + ArcanistUnitTestResult::RESULT_FAIL => pht('Failed'), + ArcanistUnitTestResult::RESULT_UNSOUND => pht('Unsound'), + ArcanistUnitTestResult::RESULT_SKIP => pht('Skipped'), + ArcanistUnitTestResult::RESULT_POSTPONED => pht('Postponed'), + ArcanistUnitTestResult::RESULT_PASS => pht('Passed'), ); $show = array(); @@ -206,7 +206,9 @@ } } - return 'Show Full Unit Results ('.implode(', ', $show).')'; + return pht( + 'Show Full Unit Results (%s)', + implode(', ', $show)); } public function getWarningsForDetailView() { diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -908,8 +908,7 @@ case DifferentialAction::ACTION_REJECT: if ($actor_is_author) { - return pht( - 'You can not request changes to your own revision.'); + return pht('You can not request changes to your own revision.'); } if ($revision_status == $status_abandoned) { @@ -1484,13 +1483,14 @@ $nested_comments = $this->nestCommentHistory( $inline->getComment(), $comments_by_line_number, $authors_by_phid); - $section->addFragment('================') - ->addFragment('Comment at: '.$file.':'.$range) - ->addPlaintextFragment($patch) - ->addHTMLFragment($this->renderPatchHTMLForMail($patch)) - ->addFragment('----------------') - ->addFragment($nested_comments) - ->addFragment(null); + $section + ->addFragment('================') + ->addFragment(pht('Comment at: %s:%s', $file, $range)) + ->addPlaintextFragment($patch) + ->addHTMLFragment($this->renderPatchHTMLForMail($patch)) + ->addFragment('----------------') + ->addFragment($nested_comments) + ->addFragment(null); } } } @@ -1569,8 +1569,7 @@ ->executeOne(); if (!$revision) { throw new Exception( - pht( - 'Failed to load revision for Herald adapter construction!')); + pht('Failed to load revision for Herald adapter construction!')); } $adapter = HeraldDifferentialRevisionAdapter::newLegacyAdapter( diff --git a/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php --- a/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php @@ -20,7 +20,7 @@ id(new DifferentialHostedGitLandingStrategy()) ->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to commit patch', $e); + throw new PhutilProxyException(pht('Failed to commit patch.'), $e); } try { @@ -33,7 +33,9 @@ } // Else, throw what git said. - throw new PhutilProxyException('Failed to push changes upstream', $e); + throw new PhutilProxyException( + pht('Failed to push changes upstream.'), + $e); } } @@ -103,13 +105,14 @@ if (!$this->account) { throw new Exception( - "No matching GitHub account found for {$repo_domain}."); + pht('No matching GitHub account found for %s.', $repo_domain)); } $this->provider = PhabricatorAuthProvider::getEnabledProviderByKey( $this->account->getProviderKey()); if (!$this->provider) { - throw new Exception("GitHub provider for {$repo_domain} is not enabled."); + throw new Exception( + pht('GitHub provider for %s is not enabled.', $repo_domain)); } } @@ -152,8 +155,9 @@ if ($no_permission) { throw new Exception( - "You don't have permission to push to this repository. \n". - "Push permissions for this repository are managed on GitHub."); + pht( + "You don't have permission to push to this repository. ". + "Push permissions for this repository are managed on GitHub.")); } $scopes = BaseHTTPFuture::getHeader($headers, 'X-OAuth-Scopes'); @@ -166,8 +170,8 @@ ->setUser($viewer) ->setTitle(pht('Stronger token needed')) ->appendChild(pht( - 'In order to complete this action, you need a '. - 'stronger GitHub token.')) + 'In order to complete this action, you need a '. + 'stronger GitHub token.')) ->setSubmitURI($refresh_token_uri) ->addCancelButton('/D'.$revision->getId()) ->setDisableWorkflowOnSubmit(true) diff --git a/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php --- a/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php @@ -14,13 +14,17 @@ try { $this->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to commit patch', $e); + throw new PhutilProxyException( + pht('Failed to commit patch.'), + $e); } try { $this->pushWorkspaceRepository($repository, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to push changes upstream', $e); + throw new PhutilProxyException( + pht('Failed to push changes upstream.'), + $e); } } @@ -45,7 +49,7 @@ ."0000000000000000000000000000000000000000.." ."0000000000000000000000000000000000000000\n"; if (strpos($raw_diff, $missing_binary) !== false) { - throw new Exception('Patch is missing content for a binary file'); + throw new Exception(pht('Patch is missing content for a binary file')); } $future = $workspace->execFutureLocal('apply --index -'); diff --git a/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php --- a/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php @@ -15,13 +15,15 @@ try { $this->commitRevisionToWorkspace($revision, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to commit patch', $e); + throw new PhutilProxyException(pht('Failed to commit patch.'), $e); } try { $this->pushWorkspaceRepository($repository, $workspace, $viewer); } catch (Exception $e) { - throw new PhutilProxyException('Failed to push changes upstream', $e); + throw new PhutilProxyException( + pht('Failed to push changes upstream.'), + $e); } } diff --git a/src/applications/differential/landing/DifferentialLandingStrategy.php b/src/applications/differential/landing/DifferentialLandingStrategy.php --- a/src/applications/differential/landing/DifferentialLandingStrategy.php +++ b/src/applications/differential/landing/DifferentialLandingStrategy.php @@ -64,7 +64,9 @@ try { return DifferentialGetWorkingCopy::getCleanGitWorkspace($repository); } catch (Exception $e) { - throw new PhutilProxyException('Failed to allocate a workspace', $e); + throw new PhutilProxyException( + pht('Failed to allocate a workspace.'), + $e); } } @@ -76,7 +78,9 @@ return DifferentialGetWorkingCopy::getCleanMercurialWorkspace( $repository); } catch (Exception $e) { - throw new PhutilProxyException('Failed to allocate a workspace', $e); + throw new PhutilProxyException( + pht('Failed to allocate a workspace.'), + $e); } } diff --git a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php --- a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php +++ b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php @@ -53,10 +53,10 @@ $diff = id(new PhabricatorDifferenceEngine()) ->generateRawDiffFromFileContent($code, $newcode); $call = new ConduitCall( - 'differential.createrawdiff', - array( - 'diff' => $diff, - )); + 'differential.createrawdiff', + array( + 'diff' => $diff, + )); $call->setUser($author); $result = $call->execute(); $thediff = id(new DifferentialDiff())->load( diff --git a/src/applications/differential/mail/DifferentialCreateMailReceiver.php b/src/applications/differential/mail/DifferentialCreateMailReceiver.php --- a/src/applications/differential/mail/DifferentialCreateMailReceiver.php +++ b/src/applications/differential/mail/DifferentialCreateMailReceiver.php @@ -3,8 +3,8 @@ final class DifferentialCreateMailReceiver extends PhabricatorMailReceiver { public function isEnabled() { - $app_class = 'PhabricatorDifferentialApplication'; - return PhabricatorApplication::isClassInstalled($app_class); + return PhabricatorApplication::isClassInstalled( + 'PhabricatorDifferentialApplication'); } public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) { diff --git a/src/applications/differential/mail/DifferentialReplyHandler.php b/src/applications/differential/mail/DifferentialReplyHandler.php --- a/src/applications/differential/mail/DifferentialReplyHandler.php +++ b/src/applications/differential/mail/DifferentialReplyHandler.php @@ -5,7 +5,7 @@ public function validateMailReceiver($mail_receiver) { if (!($mail_receiver instanceof DifferentialRevision)) { - throw new Exception('Receiver is not a DifferentialRevision!'); + throw new Exception(pht('Receiver is not a %s!', 'DifferentialRevision')); } } diff --git a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php --- a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php +++ b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php @@ -4,8 +4,8 @@ extends PhabricatorObjectMailReceiver { public function isEnabled() { - $app_class = 'PhabricatorDifferentialApplication'; - return PhabricatorApplication::isClassInstalled($app_class); + return PhabricatorApplication::isClassInstalled( + 'PhabricatorDifferentialApplication'); } protected function getObjectPattern() { diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -1154,10 +1154,11 @@ * * @return array($gaps, $mask, $depths) */ - private function calculateGapsMaskAndDepths($mask_force, - $feedback_mask, - $range_start, - $range_len) { + private function calculateGapsMaskAndDepths( + $mask_force, + $feedback_mask, + $range_start, + $range_len) { // Calculate gaps and mask first $gaps = array(); @@ -1263,7 +1264,7 @@ PhabricatorInlineCommentInterface $comment) { if (!$this->isCommentVisibleOnRenderedDiff($comment)) { - throw new Exception('Comment is not visible on changeset!'); + throw new Exception(pht('Comment is not visible on changeset!')); } $changeset_id = $comment->getChangesetID(); diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php --- a/src/applications/differential/parser/DifferentialCommitMessageParser.php +++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php @@ -73,8 +73,10 @@ if (!$key_title || !$key_summary || ($label_map === null)) { throw new Exception( pht( - 'Expected labelMap, summaryKey and titleKey to be set before '. - 'parsing a corpus.')); + 'Expected %s, %s and %s to be set before parsing a corpus.', + 'labelMap', + 'summaryKey', + 'titleKey')); } $label_regexp = $this->buildLabelRegexp($label_map); diff --git a/src/applications/differential/parser/DifferentialHunkParser.php b/src/applications/differential/parser/DifferentialHunkParser.php --- a/src/applications/differential/parser/DifferentialHunkParser.php +++ b/src/applications/differential/parser/DifferentialHunkParser.php @@ -35,9 +35,7 @@ } public function getVisibleLinesMask() { if ($this->visibleLinesMask === null) { - throw new Exception( - 'You must generateVisibileLinesMask before accessing this data.' - ); + throw new PhutilInvalidStateException('generateVisibileLinesMask'); } return $this->visibleLinesMask; } @@ -48,9 +46,7 @@ } public function getIntraLineDiffs() { if ($this->intraLineDiffs === null) { - throw new Exception( - 'You must generateIntraLineDiffs before accessing this data.' - ); + throw new PhutilInvalidStateException('generateIntraLineDiffs'); } return $this->intraLineDiffs; } @@ -61,9 +57,7 @@ } public function getNewLines() { if ($this->newLines === null) { - throw new Exception( - 'You must parseHunksForLineData before accessing this data.' - ); + throw new PhutilInvalidStateException('parseHunksForLineData'); } return $this->newLines; } @@ -74,9 +68,7 @@ } public function getOldLines() { if ($this->oldLines === null) { - throw new Exception( - 'You must parseHunksForLineData before accessing this data.' - ); + throw new PhutilInvalidStateException('parseHunksForLineData'); } return $this->oldLines; } @@ -132,8 +124,9 @@ private function getWhitespaceMode() { if ($this->whitespaceMode === null) { throw new Exception( - 'You must setWhitespaceMode before accessing this data.' - ); + pht( + 'You must %s before accessing this data.', + 'setWhitespaceMode')); } return $this->whitespaceMode; } @@ -173,7 +166,7 @@ private function getHasChanges($filter) { if ($filter !== 'any' && $filter !== 'text') { - throw new Exception("Unknown change filter '{$filter}'."); + throw new Exception(pht("Unknown change filter '%s'.", $filter)); } $old = $this->getOldLines(); diff --git a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php --- a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php +++ b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php @@ -18,8 +18,9 @@ throw new Exception( pht( 'Expected test file "%s" to contain four parts (message, fields, '. - 'output, errors) divided by "~~~~~~~~~~".', - $file)); + 'output, errors) divided by "%s".', + $file, + '~~~~~~~~~~')); } list($message, $fields, $output, $errors) = $parts; diff --git a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php --- a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php +++ b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php @@ -37,7 +37,7 @@ $parser = new ArcanistDiffParser(); $changes = $parser->parseDiff($data); if (count($changes) !== 1) { - throw new Exception("Expected 1 changeset for '{$name}'!"); + throw new Exception(pht("Expected 1 changeset for '%s'!", $name)); } $diff = DifferentialDiff::newFromRawChanges( @@ -113,10 +113,10 @@ public function testInclusionOfNewFileInOldCommentFromStart() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 3, - "+n1\n". - " e1/2\n". - "-o2\n". - "+n3\n"); + "+n1\n". + " e1/2\n". + "-o2\n". + "+n3\n"); $context = $parser->makeContextDiff( $hunks, 0, @@ -124,18 +124,18 @@ 1, 0); $this->assertEqual( - "@@ -1,2 +2,1 @@\n". - " e1/2\n". - "-o2", $context); + "@@ -1,2 +2,1 @@\n". + " e1/2\n". + "-o2", $context); } public function testInclusionOfOldFileInNewCommentFromStart() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 2, - "-o1\n". - " e2/1\n". - "-o3\n". - "+n2\n"); + "-o1\n". + " e2/1\n". + "-o3\n". + "+n2\n"); $context = $parser->makeContextDiff( $hunks, 1, @@ -143,16 +143,16 @@ 1, 0); $this->assertEqual( - "@@ -2,1 +1,2 @@\n". - " e2/1\n". - "+n2", $context); + "@@ -2,1 +1,2 @@\n". + " e2/1\n". + "+n2", $context); } public function testNoNewlineAtEndOfFile() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(0, 1, - "+a\n". - "\\No newline at end of file"); + "+a\n". + "\\No newline at end of file"); // Note that this only works with additional context. $context = $parser->makeContextDiff( $hunks, @@ -161,23 +161,23 @@ 0, 1); $this->assertEqual( - "@@ +1,1 @@\n". - "+a\n". - "\\No newline at end of file", $context); + "@@ +1,1 @@\n". + "+a\n". + "\\No newline at end of file", $context); } public function testMultiLineNewComment() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(7, 7, - " e1\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5\n". - "+n6\n". - " e7\n"); + " e1\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5\n". + "+n6\n". + " e7\n"); $context = $parser->makeContextDiff( $hunks, 1, @@ -185,28 +185,28 @@ 4, 0); $this->assertEqual( - "@@ -2,5 +2,5 @@\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5\n". - "+n6", $context); + "@@ -2,5 +2,5 @@\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5\n". + "+n6", $context); } public function testMultiLineOldComment() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(7, 7, - " e1\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5\n". - "+n6\n". - " e7\n"); + " e1\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5\n". + "+n6\n". + " e7\n"); $context = $parser->makeContextDiff( $hunks, 0, @@ -214,22 +214,22 @@ 4, 0); $this->assertEqual( - "@@ -2,5 +2,4 @@\n". - " e2\n". - "-o3\n". - "-o4\n". - "+n3\n". - " e5/4\n". - " e6/5", $context); + "@@ -2,5 +2,4 @@\n". + " e2\n". + "-o3\n". + "-o4\n". + "+n3\n". + " e5/4\n". + " e6/5", $context); } public function testInclusionOfNewFileInOldCommentFromStartWithContext() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 3, - "+n1\n". - " e1/2\n". - "-o2\n". - "+n3\n"); + "+n1\n". + " e1/2\n". + "-o2\n". + "+n3\n"); $context = $parser->makeContextDiff( $hunks, 0, @@ -237,19 +237,19 @@ 1, 1); $this->assertEqual( - "@@ -1,2 +1,2 @@\n". - "+n1\n". - " e1/2\n". - "-o2", $context); + "@@ -1,2 +1,2 @@\n". + "+n1\n". + " e1/2\n". + "-o2", $context); } public function testInclusionOfOldFileInNewCommentFromStartWithContext() { $parser = new DifferentialHunkParser(); $hunks = $this->createSingleChange(2, 2, - "-o1\n". - " e2/1\n". - "-o3\n". - "+n2\n"); + "-o1\n". + " e2/1\n". + "-o3\n". + "+n2\n"); $context = $parser->makeContextDiff( $hunks, 1, @@ -257,11 +257,11 @@ 1, 1); $this->assertEqual( - "@@ -1,3 +1,2 @@\n". - "-o1\n". - " e2/1\n". - "-o3\n". - "+n2", $context); + "@@ -1,3 +1,2 @@\n". + "-o1\n". + " e2/1\n". + "-o3\n". + "+n2", $context); } public function testMissingContext() { diff --git a/src/applications/differential/query/DifferentialHunkQuery.php b/src/applications/differential/query/DifferentialHunkQuery.php --- a/src/applications/differential/query/DifferentialHunkQuery.php +++ b/src/applications/differential/query/DifferentialHunkQuery.php @@ -95,7 +95,9 @@ if (!$this->changesets) { throw new Exception( - pht('You must load hunks via changesets, with withChangesets()!')); + pht( + 'You must load hunks via changesets, with %s!', + 'withChangesets()')); } $where[] = qsprintf( diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php --- a/src/applications/differential/query/DifferentialRevisionQuery.php +++ b/src/applications/differential/query/DifferentialRevisionQuery.php @@ -820,7 +820,7 @@ break; default: throw new Exception( - "Unknown revision status filter constant '{$this->status}'!"); + pht("Unknown revision status filter constant '%s'!", $this->status)); } $where[] = $this->buildWhereClauseParts($conn_r); @@ -1035,7 +1035,7 @@ // The author can never have authority unless we allow self-accept. $has_authority = false; } else { - // Otherwise, look up whether th viewer has authority. + // Otherwise, look up whether the viewer has authority. $has_authority = isset($authority[$reviewer_phid]); } diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -265,8 +265,7 @@ 'This file was converted from %s for display.', phutil_tag('strong', array(), $encoding)); } else { - $messages[] = pht( - 'This file uses an unknown character encoding.'); + $messages[] = pht('This file uses an unknown character encoding.'); } } } @@ -371,7 +370,11 @@ $force !== 'whitespace' && $force !== 'none' && $force !== 'default') { - throw new Exception("Invalid 'force' parameter '{$force}'!"); + throw new Exception( + pht( + "Invalid '%s' parameter '%s'!", + 'force', + $force)); } $range = "0-{$end}"; @@ -516,7 +519,7 @@ if ($is_last_block) { $text = pht('Show Last %d Line(s)', $block_size); } else { - $text = pht("\xE2\x96\xBC Show %d Line(s)", $block_size); + $text = "\xE2\x96\xBC ".pht('Show %d Line(s)', $block_size); } $links[] = $this->renderShowContextLink( diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php --- a/src/applications/differential/render/DifferentialChangesetRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetRenderer.php @@ -599,7 +599,7 @@ } } else { - throw new Exception("Unknown primitive type '{$primitive}'!"); + throw new Exception(pht("Unknown primitive type '%s'!", $primitive)); } } diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -299,10 +299,12 @@ return $this->wrapChangeInTable(phutil_implode_html('', $html)); } - public function renderFileChange($old_file = null, - $new_file = null, - $id = 0, - $vs = 0) { + public function renderFileChange( + $old_file = null, + $new_file = null, + $id = 0, + $vs = 0) { + $old = null; if ($old_file) { $old = $this->renderImageStage($old_file); diff --git a/src/applications/differential/search/DifferentialSearchIndexer.php b/src/applications/differential/search/DifferentialSearchIndexer.php --- a/src/applications/differential/search/DifferentialSearchIndexer.php +++ b/src/applications/differential/search/DifferentialSearchIndexer.php @@ -14,7 +14,7 @@ ->needReviewerStatus(true) ->executeOne(); if (!$object) { - throw new Exception("Unable to load object by phid '{$phid}'!"); + throw new Exception(pht("Unable to load object by PHID '%s'!", $phid)); } return $object; } diff --git a/src/applications/differential/storage/DifferentialReviewer.php b/src/applications/differential/storage/DifferentialReviewer.php --- a/src/applications/differential/storage/DifferentialReviewer.php +++ b/src/applications/differential/storage/DifferentialReviewer.php @@ -41,7 +41,7 @@ $viewer_phid = $viewer->getPHID(); if (!array_key_exists($viewer_phid, $this->authority)) { - throw new Exception('You must attachAuthority() first!'); + throw new Exception(pht('You must %s first!', 'attachAuthority()')); } return $this->authority[$viewer_phid]; } diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -316,8 +316,7 @@ switch ($capability) { case PhabricatorPolicyCapability::CAN_VIEW: - $description[] = pht( - "A revision's reviewers can always view it."); + $description[] = pht("A revision's reviewers can always view it."); $description[] = pht( 'If a revision belongs to a repository, other users must be able '. 'to view the repository in order to view the revision.'); diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php --- a/src/applications/differential/storage/DifferentialTransaction.php +++ b/src/applications/differential/storage/DifferentialTransaction.php @@ -274,14 +274,11 @@ case self::TYPE_STATUS: switch ($this->getNewValue()) { case ArcanistDifferentialRevisionStatus::ACCEPTED: - return pht( - 'This revision is now accepted and ready to land.'); + return pht('This revision is now accepted and ready to land.'); case ArcanistDifferentialRevisionStatus::NEEDS_REVISION: - return pht( - 'This revision now requires changes to proceed.'); + return pht('This revision now requires changes to proceed.'); case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: - return pht( - 'This revision now requires review to proceed.'); + return pht('This revision now requires review to proceed.'); } } @@ -595,11 +592,9 @@ 'You can not commandeer this revision because you already own '. 'it.'); case DifferentialAction::ACTION_ACCEPT: - return pht( - 'You have already accepted this revision.'); + return pht('You have already accepted this revision.'); case DifferentialAction::ACTION_REJECT: - return pht( - 'You have already requested changes to this revision.'); + return pht('You have already requested changes to this revision.'); } break; } diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -137,9 +137,9 @@ ($changeset->getOldProperties() === $changeset->getNewProperties()) ? '' : phutil_tag( - 'span', - array('title' => pht('Properties Changed')), - 'M'); + 'span', + array('title' => pht('Properties Changed')), + 'M'); $fname = $changeset->getFilename(); $cov = $this->renderCoverage($coverage, $fname); @@ -246,8 +246,8 @@ false, )); $anchor = id(new PhabricatorAnchorView()) - ->setAnchorName('toc') - ->setNavigationMarker(true); + ->setAnchorName('toc') + ->setNavigationMarker(true); return id(new PHUIObjectBoxView()) ->setHeaderText(pht('Table of Contents')) diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -365,7 +365,7 @@ case DifferentialLintStatus::LINT_POSTPONED: return pht('Lint Postponed'); } - return '???'; + return pht('Unknown'); } public static function getDiffUnitMessage(DifferentialDiff $diff) { @@ -386,7 +386,7 @@ case DifferentialUnitStatus::UNIT_POSTPONED: return pht('Unit Tests Postponed'); } - return '???'; + return pht('Unknown'); } private static function renderDiffStar($star) { diff --git a/src/applications/differential/view/DifferentialTransactionView.php b/src/applications/differential/view/DifferentialTransactionView.php --- a/src/applications/differential/view/DifferentialTransactionView.php +++ b/src/applications/differential/view/DifferentialTransactionView.php @@ -104,7 +104,7 @@ $inlines[] = $xaction; break; default: - throw new Exception('Unknown grouped transaction type!'); + throw new Exception(pht('Unknown grouped transaction type!')); } } diff --git a/src/applications/diffusion/DiffusionLintSaveRunner.php b/src/applications/diffusion/DiffusionLintSaveRunner.php --- a/src/applications/diffusion/DiffusionLintSaveRunner.php +++ b/src/applications/diffusion/DiffusionLintSaveRunner.php @@ -172,7 +172,7 @@ try { $paths = phutil_json_decode($json); } catch (PhutilJSONParserException $ex) { - fprintf(STDERR, pht("Invalid JSON: %s\n", $json)); + fprintf(STDERR, pht('Invalid JSON: %s', $json)."\n"); continue; } diff --git a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php @@ -8,9 +8,9 @@ } public function getMethodDescription() { - return + return pht( 'File(s) information for a repository at an (optional) path and '. - '(optional) commit.'; + '(optional) commit.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php @@ -12,9 +12,15 @@ } public function getMethodDescription() { - return 'Add a comment to a Diffusion commit. By specifying an action of '. - '"concern", "accept", "resign", or "close", auditing actions can '. - 'be triggered. Defaults to "comment".'; + return pht( + 'Add a comment to a Diffusion commit. By specifying an action '. + 'of "%s", "%s", "%s", or "%s", auditing actions can '. + 'be triggered. Defaults to "%s".', + 'concern', + 'accept', + 'resign', + 'close', + 'comment'); } protected function defineParamTypes() { @@ -32,9 +38,9 @@ protected function defineErrorTypes() { return array( - 'ERR_BAD_COMMIT' => 'No commit found with that PHID', - 'ERR_BAD_ACTION' => 'Invalid action type', - 'ERR_MISSING_MESSAGE' => 'Message is required', + 'ERR_BAD_COMMIT' => pht('No commit found with that PHID.'), + 'ERR_BAD_ACTION' => pht('Invalid action type.'), + 'ERR_MISSING_MESSAGE' => pht('Message is required.'), ); } diff --git a/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php @@ -10,9 +10,9 @@ } public function getMethodDescription() { - return + return pht( 'Get diff information from a repository for a specific path at an '. - '(optional) commit.'; + '(optional) commit.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Determine if code exists in a version control system.'; + return pht('Determine if code exists in a version control system.'); } protected function defineReturnType() { @@ -51,7 +51,7 @@ list($err, $stdout) = $repository->execLocalCommand( 'id --rev %s', $commit); - return !$err; + return !$err; } } diff --git a/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Retrieve file content from a repository.'; + return pht('Retrieve file content from a repository.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php @@ -16,7 +16,7 @@ } public function getMethodStatusDescription() { - return pht('Obsoleted by diffusion.querycommits.'); + return pht('Obsoleted by %s.', 'diffusion.querycommits'); } protected function defineParamTypes() { diff --git a/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php @@ -10,7 +10,8 @@ } public function getMethodDescription() { - return 'Get commit identifiers for recent commits affecting a given path.'; + return pht( + 'Get commit identifiers for recent commits affecting a given path.'); } protected function defineParamTypes() { diff --git a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php @@ -10,8 +10,9 @@ } public function getMethodDescription() { - return 'Returns history information for a repository at a specific '. - 'commit and path.'; + return pht( + 'Returns history information for a repository at a specific '. + 'commit and path.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php @@ -8,8 +8,8 @@ } public function getMethodDescription() { - return - 'Merged commit information for a specific commit in a repository.'; + return pht( + 'Merged commit information for a specific commit in a repository.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php @@ -13,7 +13,7 @@ public function getMethodStatusDescription() { return pht( - 'See T2784 - migrating diffusion working copy calls to conduit methods. '. + 'See T2784 - migrating Diffusion working copy calls to conduit methods. '. 'Until that task is completed (and possibly after) these methods are '. 'unstable.'); } diff --git a/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php @@ -8,9 +8,9 @@ } public function getMethodDescription() { - return + return pht( 'Get raw diff information from a repository for a specific commit at an '. - '(optional) path.'; + '(optional) path.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php @@ -8,8 +8,8 @@ } public function getMethodDescription() { - return - 'Query a git repository for ref information at a specific commit.'; + return pht( + 'Query a git repository for ref information at a specific commit.'); } protected function defineReturnType() { diff --git a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php --- a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Search (grep) a repository at a specific path and commit.'; + return pht('Search (grep) a repository at a specific path and commit.'); } protected function defineReturnType() { @@ -27,7 +27,7 @@ protected function defineCustomErrorTypes() { return array( - 'ERR-GREP-COMMAND' => 'Grep command failed.', + 'ERR-GREP-COMMAND' => pht('Grep command failed.'), ); } diff --git a/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php b/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php --- a/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php +++ b/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php @@ -35,9 +35,10 @@ pht('Attach Patches'), pht('Do Not Attach Patches'), )) - ->setDescription(pht( - 'Set this to true if you want patches to be attached to commit '. - 'notifications from Diffusion.')), + ->setDescription( + pht( + 'Set this to true if you want patches to be attached to commit '. + 'notifications from Diffusion.')), $this->newOption('metamta.diffusion.inline-patches', 'int', 0) ->setSummary(pht('Include patches in Diffusion mail as body text.')) ->setDescription( @@ -63,10 +64,11 @@ $this->newOption('bugtraq.url', 'string', null) ->addExample('https://bugs.php.net/%BUGID%', pht('PHP bugs')) ->addExample('/%BUGID%', pht('Local Maniphest URL')) - ->setDescription(pht( - 'URL of external bug tracker used by Diffusion. %s will be '. + ->setDescription( + pht( + 'URL of external bug tracker used by Diffusion. %s will be '. 'substituted by the bug ID.', - '%BUGID%')), + '%BUGID%')), $this->newOption('bugtraq.logregex', 'list', array()) ->addExample(array('/\B#([1-9]\d*)\b/'), pht('Issue #123')) ->addExample( @@ -74,8 +76,9 @@ pht('Issue #123, #456')) ->addExample(array('/(?addExample('/[A-Z]{2,}-\d+/', pht('JIRA-1234')) - ->setDescription(pht( - 'Regular expression to link external bug tracker. See '. + ->setDescription( + pht( + 'Regular expression to link external bug tracker. See '. 'http://tortoisesvn.net/docs/release/TortoiseSVN_en/'. 'tsvn-dug-bugtracker.html for further explanation.')), $this->newOption('diffusion.allow-http-auth', 'bool', false) diff --git a/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php b/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php --- a/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php @@ -98,7 +98,9 @@ array( 'title' => array( nonempty(basename($drequest->getPath()), '/'), - $drequest->getRepository()->getCallsign().' Repository', + pht( + '%s Repository', + $drequest->getRepository()->getCallsign()), ), )); } diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -124,13 +124,15 @@ switch ($follow) { case 'first': $notice->appendChild( - pht('Unable to continue tracing the history of this file because '. - 'this commit is the first commit in the repository.')); + pht( + 'Unable to continue tracing the history of this file because '. + 'this commit is the first commit in the repository.')); break; case 'created': $notice->appendChild( - pht('Unable to continue tracing the history of this file because '. - 'this commit created the file.')); + pht( + 'Unable to continue tracing the history of this file because '. + 'this commit created the file.')); break; } $content[] = $notice; @@ -142,7 +144,8 @@ $notice->setSeverity(PHUIInfoView::SEVERITY_NOTICE); $notice->setTitle(pht('File Renamed')); $notice->appendChild( - pht("File history passes through a rename from '%s' to '%s'.", + pht( + "File history passes through a rename from '%s' to '%s'.", $drequest->getPath(), $renamed)); $content[] = $notice; } diff --git a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php --- a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php @@ -33,7 +33,9 @@ array( 'title' => array( nonempty(basename($drequest->getPath()), '/'), - $drequest->getRepository()->getCallsign().' Repository', + pht( + '%s Repository', + $drequest->getRepository()->getCallsign()), ), )); } diff --git a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php --- a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php +++ b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php @@ -39,6 +39,6 @@ } return id(new AphrontAjaxResponse()) - ->setContent($branch_links ? implode(', ', $branch_links) : 'None'); + ->setContent($branch_links ? implode(', ', $branch_links) : pht('None')); } } diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -83,10 +83,12 @@ $error_panel->setTitle(pht('Commit Not Tracked')); $error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING); $error_panel->appendChild( - pht("This Diffusion repository is configured to track only one ". - "subdirectory of the entire Subversion repository, and this commit ". - "didn't affect the tracked subdirectory ('%s'), so no ". - "information is available.", $subpath)); + pht( + "This Diffusion repository is configured to track only one ". + "subdirectory of the entire Subversion repository, and this commit ". + "didn't affect the tracked subdirectory ('%s'), so no ". + "information is available.", + $subpath)); $content[] = $error_panel; } else { $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); @@ -238,7 +240,7 @@ $change_panel = new PHUIObjectBoxView(); $header = new PHUIHeaderView(); - $header->setHeader('Changes ('.number_format($count).')'); + $header->setHeader(pht('Changes (%d', number_format($count))); $change_panel->setID('toc'); if ($count > self::CHANGES_LIMIT && !$show_all_details) { @@ -253,7 +255,7 @@ $warning_view = id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_WARNING) - ->setTitle('Very Large Commit') + ->setTitle(pht('Very Large Commit')) ->appendChild( pht('This commit is very large. Load each file individually.')); @@ -280,7 +282,7 @@ $vcs_supports_directory_changes = false; break; default: - throw new Exception('Unknown VCS.'); + throw new Exception(pht('Unknown VCS.')); } $references = array(); @@ -901,8 +903,8 @@ $caption->setSeverity(PHUIInfoView::SEVERITY_NOTICE); $caption->appendChild( pht( - 'This commit merges a very large number of changes. Only the first '. - '%s are shown.', + 'This commit merges a very large number of changes. '. + 'Only the first %s are shown.', new PhutilNumber($limit))); } diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -11,7 +11,7 @@ protected function getDiffusionRequest() { if (!$this->diffusionRequest) { - throw new Exception('No Diffusion request object!'); + throw new Exception(pht('No Diffusion request object!')); } return $this->diffusionRequest; } diff --git a/src/applications/diffusion/controller/DiffusionExternalController.php b/src/applications/diffusion/controller/DiffusionExternalController.php --- a/src/applications/diffusion/controller/DiffusionExternalController.php +++ b/src/applications/diffusion/controller/DiffusionExternalController.php @@ -75,9 +75,11 @@ ->appendChild(phutil_tag( 'p', array(), - pht('This external (%s) does not appear in any tracked '. - 'repository. It may exist in an untracked repository that '. - 'Diffusion does not know about.', $desc))); + pht( + 'This external (%s) does not appear in any tracked '. + 'repository. It may exist in an untracked repository that '. + 'Diffusion does not know about.', + $desc))); } else if (count($commits) == 1) { $commit = head($commits); $repo = $repositories[$commit->getRepositoryID()]; diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php --- a/src/applications/diffusion/controller/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/DiffusionHistoryController.php @@ -168,6 +168,4 @@ return $view; } - - } diff --git a/src/applications/diffusion/controller/DiffusionInlineCommentController.php b/src/applications/diffusion/controller/DiffusionInlineCommentController.php --- a/src/applications/diffusion/controller/DiffusionInlineCommentController.php +++ b/src/applications/diffusion/controller/DiffusionInlineCommentController.php @@ -33,7 +33,7 @@ PhabricatorRepository::TABLE_PATH, $path_id); if (!$path) { - throw new Exception('Invalid path ID!'); + throw new Exception(pht('Invalid path ID!')); } return id(new PhabricatorAuditInlineComment()) @@ -55,7 +55,7 @@ $inline = $this->loadComment($id); if (!$this->canEditInlineComment($user, $inline)) { - throw new Exception('That comment is not editable!'); + throw new Exception(pht('That comment is not editable!')); } return $inline; } diff --git a/src/applications/diffusion/controller/DiffusionPathValidateController.php b/src/applications/diffusion/controller/DiffusionPathValidateController.php --- a/src/applications/diffusion/controller/DiffusionPathValidateController.php +++ b/src/applications/diffusion/controller/DiffusionPathValidateController.php @@ -58,7 +58,7 @@ if ($branch) { $message = pht('Not found in %s', $branch); } else { - $message = pht('Not found at HEAD'); + $message = pht('Not found at %s', 'HEAD'); } } else { $message = pht('OK'); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -60,8 +60,7 @@ } } else { $empty_title = pht('Empty Repository'); - $empty_message = pht( - 'This repository does not have any commits yet.'); + $empty_message = pht('This repository does not have any commits yet.'); } } @@ -391,9 +390,9 @@ $button->setTag('a'); $button->setIcon($icon); $button->setHref($drequest->generateURI( - array( - 'action' => 'branches', - ))); + array( + 'action' => 'branches', + ))); $header->addActionLink($button); $panel->setHeader($header); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php @@ -71,7 +71,7 @@ $cancel_uri = $this->getApplicationURI('new/'); break; default: - throw new Exception('Invalid edit operation!'); + throw new Exception(pht('Invalid edit operation!')); } $form = id(new PHUIPagedFormView()) @@ -483,7 +483,7 @@ $is_mercurial = true; break; default: - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } $has_local = ($is_git || $is_mercurial); @@ -527,7 +527,7 @@ "repository, use the //Import Only// option at the end of this ". "workflow.)"); } else { - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } $page->addRemarkupInstructions($instructions, 'remoteURI'); @@ -623,7 +623,7 @@ $remote_uri), 'credential'); } else { - throw new Exception('Unknown URI protocol!'); + throw new Exception(pht('Unknown URI protocol!')); } if ($provides_type) { @@ -734,8 +734,7 @@ ->setAdjustFormPageCallback(array($this, 'adjustPolicyPage')) ->setUser($viewer) ->addRemarkupInstructions( - pht( - 'Select access policies for this repository.')) + pht('Select access policies for this repository.')) ->addControl($view_policy) ->addControl($edit_policy) ->addControl($push_policy); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php @@ -75,8 +75,7 @@ "new commits. You can disable publishing for this repository by ". "turning off **Notify/Publish**. This will disable notifications, ". "feed, and Herald (including audits and build plans) for this ". - "repository.". - "\n\n". + "repository.\n\n". "When Phabricator discovers a new commit, it can automatically ". "close associated revisions and tasks. If you don't want ". "Phabricator to close objects when it discovers new commits in ". diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php @@ -152,19 +152,25 @@ private function getReadmeInstructions() { return pht(<< $row) { @@ -167,8 +167,7 @@ $form = id(new AphrontFormView()) ->setUser($viewer) ->appendRemarkupInstructions( - pht( - 'You can choose a **Default Branch** for viewing this repository.')) + pht('You can choose a **Default Branch** for viewing this repository.')) ->appendChild( id(new AphrontFormTextControl()) ->setName('default') @@ -196,7 +195,8 @@ pht( 'When specifying branches, you should enter one branch name per '. 'line. You can use regular expressions to match branches by '. - 'wrapping an expression in `regexp(...)`. For example:')) + 'wrapping an expression in `%s`. For example:', + 'regexp(...)')) ->appendChild( id(new AphrontFormMarkupControl()) ->setValue($example_table)) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php @@ -30,8 +30,9 @@ $command = csprintf( 'phabricator/ $ ./bin/remove destroy %R', $repository->getMonogram()); - $text_2 = pht('Repositories touch many objects and as such deletes are '. - 'prohibitively expensive to run from the web UI.'); + $text_2 = pht( + 'Repositories touch many objects and as such deletes are '. + 'prohibitively expensive to run from the web UI.'); $body = phutil_tag( 'div', array( diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php @@ -104,8 +104,7 @@ Phabricator handles text encodings. EOT , - PhabricatorEnv::getDoclink( - 'User Guide: UTF-8 and Character Encoding')); + PhabricatorEnv::getDoclink('User Guide: UTF-8 and Character Encoding')); } } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php @@ -819,8 +819,9 @@ ->setTarget( pht('Missing Binary %s', phutil_tag('tt', array(), $binary))) ->setNote(pht( - 'Unable to find this binary in `environment.append-paths`. '. + 'Unable to find this binary in `%s`. '. 'You need to configure %s and include %s.', + 'environment.append-paths', $this->getEnvConfigLink(), $path))); } diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php @@ -57,10 +57,11 @@ ->appendRemarkupInstructions( pht( "You can not adjust the local path for this repository from the ". - "web interface. To edit it, run this command:\n\n". - " phabricator/ $ ./bin/repository edit %s --as %s --local-path ...", - $repository->getCallsign(), - $user->getUsername())) + "web interface. To edit it, run this command:\n\n %s", + sprintf( + 'phabricator/ $ ./bin/repository edit %s --as %s --local-path ...', + $repository->getCallsign(), + $user->getUsername()))) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton($edit_uri, pht('Done'))); diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php @@ -84,11 +84,11 @@ pht( "You can set the **Repository UUID**, which will help Phabriactor ". "provide better context in some cases. You can find the UUID of a ". - "repository by running `svn info`.". - "\n\n". + "repository by running `%s`.\n\n". "If you want to import only part of a repository, like `trunk/`, ". "you can set a path in **Import Only**. Phabricator will ignore ". - "commits which do not affect this path.")) + "commits which do not affect this path.", + 'svn info')) ->appendChild( id(new AphrontFormTextControl()) ->setName('uuid') diff --git a/src/applications/diffusion/controller/DiffusionRepositoryNewController.php b/src/applications/diffusion/controller/DiffusionRepositoryNewController.php --- a/src/applications/diffusion/controller/DiffusionRepositoryNewController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryNewController.php @@ -53,11 +53,11 @@ 'import', pht('Import an Existing External Repository'), pht( - 'Import a repository hosted somewhere else, like GitHub, '. - 'Bitbucket, or your organization\'s existing servers. '. - 'Phabricator will read changes from the repository but will '. - 'not host or manage it. The authoritative master version of '. - 'the repository will stay where it is now.'))) + "Import a repository hosted somewhere else, like GitHub, ". + "Bitbucket, or your organization's existing servers. ". + "Phabricator will read changes from the repository but will ". + "not host or manage it. The authoritative master version of ". + "the repository will stay where it is now."))) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Continue')) diff --git a/src/applications/diffusion/controller/DiffusionServeController.php b/src/applications/diffusion/controller/DiffusionServeController.php --- a/src/applications/diffusion/controller/DiffusionServeController.php +++ b/src/applications/diffusion/controller/DiffusionServeController.php @@ -342,7 +342,11 @@ // resolve the binary first. $bin = Filesystem::resolveBinary('git-http-backend'); if (!$bin) { - throw new Exception('Unable to find `git-http-backend` in PATH!'); + throw new Exception( + pht( + 'Unable to find `%s` in %s!', + 'git-http-backend', + '$PATH')); } $env = array( @@ -485,7 +489,11 @@ $bin = Filesystem::resolveBinary('hg'); if (!$bin) { - throw new Exception('Unable to find `hg` in PATH!'); + throw new Exception( + pht( + 'Unable to find `%s` in %s!', + 'hg', + '$PATH')); } $env = $this->getCommonEnvironment($viewer); diff --git a/src/applications/diffusion/data/DiffusionGitBranch.php b/src/applications/diffusion/data/DiffusionGitBranch.php --- a/src/applications/diffusion/data/DiffusionGitBranch.php +++ b/src/applications/diffusion/data/DiffusionGitBranch.php @@ -42,7 +42,10 @@ continue; } if (!preg_match('/^ *(\S+)\s+([a-z0-9]{40})/', $line, $matches)) { - throw new Exception("Failed to parse {$line}!"); + throw new Exception( + pht( + 'Failed to parse %s!', + $line)); } $remote_branch = $matches[1]; @@ -57,7 +60,9 @@ $matches = null; if (!preg_match('#^([^/]+)/(.*)$#', $remote_branch, $matches)) { throw new Exception( - "Failed to parse remote branch '{$remote_branch}'!"); + pht( + "Failed to parse remote branch '%s'!", + $remote_branch)); } $remote_name = $matches[1]; $branch_name = $matches[2]; @@ -84,7 +89,10 @@ foreach ($lines as $line) { $matches = null; if (!preg_match($regex, $line, $matches)) { - throw new Exception("Failed to parse {$line}!"); + throw new Exception( + pht( + 'Failed to parse %s!', + $line)); } $branch = $matches[1]; diff --git a/src/applications/diffusion/data/DiffusionRepositoryTag.php b/src/applications/diffusion/data/DiffusionRepositoryTag.php --- a/src/applications/diffusion/data/DiffusionRepositoryTag.php +++ b/src/applications/diffusion/data/DiffusionRepositoryTag.php @@ -72,7 +72,7 @@ public function getMessage() { if ($this->message === false) { - throw new Exception('Message is not attached!'); + throw new Exception(pht('Message is not attached!')); } return $this->message; } diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php --- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php +++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php @@ -697,7 +697,10 @@ private function findMercurialChangegroupRefUpdates() { $hg_node = getenv('HG_NODE'); if (!$hg_node) { - throw new Exception(pht('Expected HG_NODE in environment!')); + throw new Exception( + pht( + 'Expected %s in environment!', + 'HG_NODE')); } // NOTE: We need to make sure this is passed to subprocesses, or they won't diff --git a/src/applications/diffusion/exception/DiffusionSetupException.php b/src/applications/diffusion/exception/DiffusionSetupException.php --- a/src/applications/diffusion/exception/DiffusionSetupException.php +++ b/src/applications/diffusion/exception/DiffusionSetupException.php @@ -3,7 +3,7 @@ final class DiffusionSetupException extends AphrontUsageException { public function __construct($message) { - parent::__construct('Diffusion Setup Exception', $message); + parent::__construct(pht('Diffusion Setup Exception'), $message); } } diff --git a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php --- a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php @@ -28,7 +28,7 @@ ); if (!isset($commands[$command])) { - throw new Exception("Unknown Mercurial command '{$command}!"); + throw new Exception(pht("Unknown Mercurial command '%s!", $command)); } return $commands[$command]; @@ -65,7 +65,7 @@ // on the side of caution and throw if we don't get any data here. This // either indicates a mangled command from the client or a programming // error in our code. - throw new Exception("Expected nonempty 'cmds' specification!"); + throw new Exception(pht("Expected nonempty '%s' specification!", 'cmds')); } // For "batch" we get a "cmds" argument like: diff --git a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php --- a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php +++ b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php @@ -93,7 +93,7 @@ $this->state = 'item'; } } else { - throw new Exception("Invalid state '{$this->state}'!"); + throw new Exception(pht("Invalid state '%s'!", $this->state)); } } @@ -124,7 +124,10 @@ $out[] = self::serializeStruct($value); break; default: - throw new Exception("Unknown SVN wire protocol structure '{$type}'!"); + throw new Exception( + pht( + "Unknown SVN wire protocol structure '%s'!", + $type)); } if ($type != 'list') { $out[] = ' '; @@ -139,7 +142,9 @@ if (empty($struct[0]['type']) || ($struct[0]['type'] != 'word')) { // This isn't what we expect; fail defensively. throw new Exception( - pht("Unexpected command structure, expected '( word ... )'.")); + pht( + "Unexpected command structure, expected '%s'.", + '( word ... )')); } switch ($struct[0]['value']) { diff --git a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php --- a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php +++ b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php @@ -42,7 +42,7 @@ $result = $this->resolveSubversionRefs(); break; default: - throw new Exception('Unsupported repository type!'); + throw new Exception(pht('Unsupported repository type!')); } if ($this->types !== null) { diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php --- a/src/applications/diffusion/query/DiffusionCommitQuery.php +++ b/src/applications/diffusion/query/DiffusionCommitQuery.php @@ -144,7 +144,9 @@ public function getIdentifierMap() { if ($this->identifierMap === null) { throw new Exception( - 'You must execute() the query before accessing the identifier map.'); + pht( + 'You must %s the query before accessing the identifier map.', + 'execute()')); } return $this->identifierMap; } @@ -491,8 +493,10 @@ self::AUDIT_STATUS_PARTIAL, ); throw new Exception( - "Unknown audit status '{$status}'! Valid statuses are: ". - implode(', ', $valid)); + pht( + "Unknown audit status '%s'! Valid statuses are: %s.", + $status, + implode(', ', $valid))); } } diff --git a/src/applications/diffusion/query/DiffusionQuery.php b/src/applications/diffusion/query/DiffusionQuery.php --- a/src/applications/diffusion/query/DiffusionQuery.php +++ b/src/applications/diffusion/query/DiffusionQuery.php @@ -32,7 +32,7 @@ $name = idx($map, $repository->getVersionControlSystem()); if (!$name) { - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } $class = str_replace('Diffusion', 'Diffusion'.$name, $base_class); diff --git a/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php b/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php --- a/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php +++ b/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php @@ -45,8 +45,10 @@ // 8220d5d54f6d5d5552a636576cbe9c35f15b65b2 // (Andrew Gallagher 2010-12-03 324) // // Add the lines for trailing context - preg_match('/^\s*?(\S+?)\s*\(\s*(.*?)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/', - $line, $m); + preg_match( + '/^\s*?(\S+?)\s*\(\s*(.*?)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/', + $line, + $m); $rev_id = $m[1]; $author = $m[2]; $text = idx($m, 3); diff --git a/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php b/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php --- a/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php +++ b/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php @@ -26,9 +26,10 @@ // nuked; Diffusion will think it still exists and try to grab content // at HEAD. throw new Exception( - 'Failed to retrieve file content from Subversion. The file may '. - 'have been recently deleted, or the Diffusion cache may be out of '. - 'date.'); + pht( + 'Failed to retrieve file content from Subversion. The file may '. + 'have been recently deleted, or the Diffusion cache may be out of '. + 'date.')); } else { throw $ex; } diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php @@ -17,8 +17,7 @@ protected function executeQuery() { if (!strlen($this->identifier)) { - throw new Exception( - pht('You must provide an identifier with withIdentifier()!')); + throw new PhutilInvalidStateException('withIdentifier'); } $type = $this->getRepository()->getVersionControlSystem(); diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php @@ -12,8 +12,7 @@ protected function executeQuery() { if (!strlen($this->identifier)) { - throw new Exception( - pht('You must provide an identifier with withIdentifier()!')); + throw new PhutilInvalidStateException('withIdentifier'); } $type = $this->getRepository()->getVersionControlSystem(); diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php --- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php +++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php @@ -42,7 +42,7 @@ $result = $this->resolveSubversionRefs(); break; default: - throw new Exception('Unsupported repository type!'); + throw new Exception(pht('Unsupported repository type!')); } if ($this->types !== null) { @@ -112,7 +112,10 @@ $lines = explode("\n", rtrim($stdout, "\n")); if (count($lines) !== count($unresolved)) { - throw new Exception('Unexpected line count from `git cat-file`!'); + throw new Exception( + pht( + 'Unexpected line count from `%s`!', + 'git cat-file')); } $hits = array(); @@ -122,7 +125,11 @@ foreach ($lines as $ref => $line) { $parts = explode(' ', $line); if (count($parts) < 2) { - throw new Exception("Failed to parse `git cat-file` output: {$line}"); + throw new Exception( + pht( + 'Failed to parse `%s` output: %s', + 'git cat-file', + $line)); } list($identifier, $type) = $parts; @@ -143,7 +150,10 @@ break; default: throw new Exception( - "Unexpected object type from `git cat-file`: {$line}"); + pht( + 'Unexpected object type from `%s`: %s', + 'git cat-file', + $line)); } $hits[] = array( @@ -177,7 +187,10 @@ $alternate = $identifier; $identifier = idx($tag_map, $ref); if (!$identifier) { - throw new Exception("Failed to look up tag '{$ref}'!"); + throw new Exception( + pht( + "Failed to look up tag '%s'!", + $ref)); } } diff --git a/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php b/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php --- a/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php +++ b/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php @@ -6,19 +6,19 @@ $this->assertEqual( '/', DiffusionPathIDQuery::getParentPath('/'), - 'Parent of /'); + pht('Parent of %s', '/')); $this->assertEqual( '/', DiffusionPathIDQuery::getParentPath('x.txt'), - 'Parent of x.txt'); + pht('Parent of %s', 'x.txt')); $this->assertEqual( '/a', DiffusionPathIDQuery::getParentPath('/a/b'), - 'Parent of /a/b'); + pht('Parent of %s', '/a/b')); $this->assertEqual( '/a', DiffusionPathIDQuery::getParentPath('/a///b'), - 'Parent of /a///b'); + pht('Parent of %s', '/a///b')); } public function testExpandEdgeCases() { diff --git a/src/applications/diffusion/request/DiffusionGitRequest.php b/src/applications/diffusion/request/DiffusionGitRequest.php --- a/src/applications/diffusion/request/DiffusionGitRequest.php +++ b/src/applications/diffusion/request/DiffusionGitRequest.php @@ -17,7 +17,7 @@ if ($this->repository) { return $this->repository->getDefaultBranch(); } - throw new Exception('Unable to determine branch!'); + throw new Exception(pht('Unable to determine branch!')); } } diff --git a/src/applications/diffusion/request/DiffusionMercurialRequest.php b/src/applications/diffusion/request/DiffusionMercurialRequest.php --- a/src/applications/diffusion/request/DiffusionMercurialRequest.php +++ b/src/applications/diffusion/request/DiffusionMercurialRequest.php @@ -19,7 +19,7 @@ return $this->repository->getDefaultBranch(); } - throw new Exception('Unable to determine branch!'); + throw new Exception(pht('Unable to determine branch!')); } } diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php --- a/src/applications/diffusion/request/DiffusionRequest.php +++ b/src/applications/diffusion/request/DiffusionRequest.php @@ -62,13 +62,22 @@ final public static function newFromDictionary(array $data) { if (isset($data['repository']) && isset($data['callsign'])) { throw new Exception( - "Specify 'repository' or 'callsign', but not both."); + pht( + "Specify '%s' or '%s', but not both.", + 'repository', + 'callsign')); } else if (!isset($data['repository']) && !isset($data['callsign'])) { throw new Exception( - "One of 'repository' and 'callsign' is required."); + pht( + "One of '%s' and '%s' is required.", + 'repository', + 'callsign')); } else if (isset($data['callsign']) && empty($data['user'])) { throw new Exception( - "Parameter 'user' is required if 'callsign' is provided."); + pht( + "Parameter '%s' is required if '%s' is provided.", + 'user', + 'callsign')); } if (isset($data['repository'])) { @@ -147,7 +156,7 @@ ->executeOne(); if (!$repository) { - throw new Exception("No such repository '{$callsign}'."); + throw new Exception(pht("No such repository '%s'.", $callsign)); } return self::newFromRepository($repository); @@ -174,7 +183,7 @@ $class = idx($map, $repository->getVersionControlSystem()); if (!$class) { - throw new Exception('Unknown version control system!'); + throw new Exception(pht('Unknown version control system!')); } $object = new $class(); @@ -207,7 +216,9 @@ $user = idx($data, 'user'); if (!$user) { throw new Exception( - 'You must provide a PhabricatorUser in the dictionary!'); + pht( + 'You must provide a %s in the dictionary!', + 'PhabricatorUser')); } $this->setUser($user); } @@ -409,7 +420,7 @@ if (!$data) { $data = new PhabricatorRepositoryCommitData(); $data->setCommitMessage( - '(This commit has not been fully parsed yet.)'); + pht('(This commit has not been fully parsed yet.)')); } $this->repositoryCommitData = $data; } @@ -533,12 +544,16 @@ if ($req_callsign && !strlen($callsign)) { throw new Exception( - "Diffusion URI action '{$action}' requires callsign!"); + pht( + "Diffusion URI action '%s' requires callsign!", + $action)); } if ($req_commit && !strlen($commit)) { throw new Exception( - "Diffusion URI action '{$action}' requires commit!"); + pht( + "Diffusion URI action '%s' requires commit!", + $action)); } switch ($action) { @@ -576,7 +591,7 @@ $uri = "/r{$callsign}{$commit}"; break; default: - throw new Exception("Unknown Diffusion URI action '{$action}'!"); + throw new Exception(pht("Unknown Diffusion URI action '%s'!", $action)); } if ($action == 'rendering-ref') { @@ -663,7 +678,7 @@ // Prevent any hyjinx since we're ultimately shipping this to the // filesystem under a lot of workflows. if ($part == '..') { - throw new Exception('Invalid path URI.'); + throw new Exception(pht('Invalid path URI.')); } } @@ -689,21 +704,27 @@ $host = php_uname('n'); $callsign = $this->getRepository()->getCallsign(); throw new DiffusionSetupException( - "The clone of this repository ('{$callsign}') on the local machine ". - "('{$host}') could not be read. Ensure that the repository is in a ". - "location where the web server has read permissions."); + pht( + "The clone of this repository ('%s') on the local machine ('%s') ". + "could not be read. Ensure that the repository is in a ". + "location where the web server has read permissions.", + $callsign, + $host)); } protected function raiseCloneException() { $host = php_uname('n'); $callsign = $this->getRepository()->getCallsign(); throw new DiffusionSetupException( - "The working copy for this repository ('{$callsign}') hasn't been ". - "cloned yet on this machine ('{$host}'). Make sure you've started the ". - "Phabricator daemons. If this problem persists for longer than a clone ". - "should take, check the daemon logs (in the Daemon Console) to see if ". - "there were errors cloning the repository. Consult the 'Diffusion User ". - "Guide' in the documentation for help setting up repositories."); + pht( + "The working copy for this repository ('%s') hasn't been cloned yet ". + "on this machine ('%s'). Make sure you've started the Phabricator ". + "daemons. If this problem persists for longer than a clone should ". + "take, check the daemon logs (in the Daemon Console) to see if there ". + "were errors cloning the repository. Consult the 'Diffusion User ". + "Guide' in the documentation for help setting up repositories.", + $callsign, + $host)); } private function queryStableCommit() { diff --git a/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php b/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php --- a/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php +++ b/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php @@ -67,7 +67,7 @@ $this->assertEqual( $expect, $actual, - "Parsing '{$input}'"); + pht("Parsing '%s'", $input)); } } diff --git a/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php --- a/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php @@ -35,11 +35,11 @@ $args = $this->getArgs(); if (!$args->getArg('stdio')) { - throw new Exception('Expected `hg ... --stdio`!'); + throw new Exception(pht('Expected `%s`!', 'hg ... --stdio')); } if ($args->getArg('command') !== array('serve')) { - throw new Exception('Expected `hg ... serve`!'); + throw new Exception(pht('Expected `%s`!', 'hg ... serve')); } if ($this->shouldProxy()) { diff --git a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php --- a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php +++ b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php @@ -207,7 +207,7 @@ break; } } else { - throw new Exception("Bad parser state '{$this->state}'!"); + throw new Exception(pht("Bad parser state '%s'!", $this->state)); } } diff --git a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php --- a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php @@ -154,8 +154,7 @@ if (!preg_match($regex, $path, $matches)) { throw new Exception( pht( - 'Unrecognized repository path "%s". Expected a path like '. - '"%s".', + 'Unrecognized repository path "%s". Expected a path like "%s".', $path, '/diffusion/X/')); } diff --git a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php --- a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php @@ -83,7 +83,8 @@ if (!$exec_channel->isOpenForReading()) { throw new Exception( pht( - 'svnserve subprocess exited before emitting a protocol frame.')); + '%s subprocess exited before emitting a protocol frame.', + 'svnserve')); } } @@ -141,7 +142,7 @@ $args = $this->getArgs(); if (!$args->getArg('tunnel')) { - throw new Exception('Expected `svnserve -t`!'); + throw new Exception(pht('Expected `%s`!', 'svnserve -t')); } if ($this->shouldProxy()) { @@ -350,8 +351,9 @@ if ($proto !== 'svn+ssh') { throw new Exception( pht( - 'Protocol for URI "%s" MUST be "svn+ssh".', - $uri_string)); + 'Protocol for URI "%s" MUST be "%s".', + $uri_string, + 'svn+ssh')); } $path = $uri->getPath(); @@ -360,7 +362,8 @@ if (preg_match('(/\\.\\./)', $path)) { throw new Exception( pht( - 'String "/../" is invalid in path specification "%s".', + 'String "%s" is invalid in path specification "%s".', + '/../', $uri_string)); } diff --git a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php --- a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php +++ b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php @@ -50,7 +50,7 @@ $this->assertTrue( ($caught instanceof Exception), - "No extra messages for '{$file}'."); + pht("No extra messages for '%s'.", $file)); } } diff --git a/src/applications/diffusion/view/DiffusionEmptyResultView.php b/src/applications/diffusion/view/DiffusionEmptyResultView.php --- a/src/applications/diffusion/view/DiffusionEmptyResultView.php +++ b/src/applications/diffusion/view/DiffusionEmptyResultView.php @@ -55,7 +55,7 @@ $title = pht('Path Was Deleted'); $body = pht( 'This path does not exist at %s. It was deleted in %s and last %s '. - 'at %s.', + 'at %s.', $commit, self::linkCommit($drequest->getRepository(), $deleted), $browse, @@ -66,14 +66,15 @@ $subdir = $drequest->getRepository()->getDetail('svn-subpath'); $title = pht('Directory Not Tracked'); $body = - pht("This repository is configured to track only one subdirectory ". - "of the entire repository ('%s'), ". - "but you aren't looking at something in that subdirectory, so no ". - "information is available.", $subdir); + pht( + "This repository is configured to track only one subdirectory ". + "of the entire repository ('%s'), but you aren't looking at ". + "something in that subdirectory, so no information is available.", + $subdir); $severity = PHUIInfoView::SEVERITY_WARNING; break; default: - throw new Exception("Unknown failure reason: $reason"); + throw new Exception(pht('Unknown failure reason: %s', $reason)); } $error_view = new PHUIInfoView(); diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -13,8 +13,11 @@ return $this->diffusionRequest; } - final public function linkChange($change_type, $file_type, $path = null, - $commit_identifier = null) { + final public function linkChange( + $change_type, + $file_type, + $path = null, + $commit_identifier = null) { $text = DifferentialChangeType::getFullNameForChangeType($change_type); if ($change_type == DifferentialChangeType::TYPE_CHILD) { diff --git a/src/applications/diviner/atom/DivinerAtom.php b/src/applications/diviner/atom/DivinerAtom.php --- a/src/applications/diviner/atom/DivinerAtom.php +++ b/src/applications/diviner/atom/DivinerAtom.php @@ -396,7 +396,7 @@ case self::TYPE_METHOD: return pht('This method is not documented.'); default: - phlog("Need translation for '{$type}'."); + phlog(pht("Need translation for '%s'.", $type)); return pht('This %s is not documented.', $type); } } @@ -427,7 +427,7 @@ case self::TYPE_METHOD: return pht('Method'); default: - phlog("Need translation for '{$type}'."); + phlog(pht("Need translation for '%s'.", $type)); return ucwords($type); } } diff --git a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php --- a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php +++ b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php @@ -16,7 +16,7 @@ $title = idx($meta, 'title'); if (!strlen($title)) { $title = pht('Untitled Article "%s"', basename($file_name)); - $atom->addWarning('Article has no @title!'); + $atom->addWarning(pht('Article has no %s!', '@title')); $atom->setDocblockMetaValue('title', $title); } diff --git a/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php --- a/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php +++ b/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php @@ -65,7 +65,7 @@ $phid_aid_map = $this->lookupAsanaUserIDs($all_phids); if (!$phid_aid_map) { throw new PhabricatorWorkerPermanentFailureException( - 'No related users have linked Asana accounts.'); + pht('No related users have linked Asana accounts.')); } $owner_asana_id = idx($phid_aid_map, $owner_phid); @@ -86,8 +86,9 @@ if (!$oauth_token) { throw new PhabricatorWorkerPermanentFailureException( - 'Unable to find any Asana user with valid credentials to '. - 'pull an OAuth token out of.'); + pht( + 'Unable to find any Asana user with valid credentials to '. + 'pull an OAuth token out of.')); } $etype_main = PhabricatorObjectHasAsanaTaskEdgeType::EDGECONST; @@ -124,21 +125,23 @@ $parent_ref = head($refs); if (!$parent_ref) { throw new PhabricatorWorkerPermanentFailureException( - 'DoorkeeperExternalObject could not be loaded.'); + pht('%s could not be loaded.', 'DoorkeeperExternalObject')); } if ($parent_ref->getSyncFailed()) { throw new Exception( - 'Synchronization of parent task from Asana failed!'); + pht('Synchronization of parent task from Asana failed!')); } else if (!$parent_ref->getIsVisible()) { - $this->log("Skipping main task update, object is no longer visible.\n"); + $this->log( + "%s\n", + pht('Skipping main task update, object is no longer visible.')); $extra_data['gone'] = true; } else { $edge_cursor = idx($main_edge['data'], 'cursor', 0); // TODO: This probably breaks, very rarely, on 32-bit systems. if ($edge_cursor <= $story->getChronologicalKey()) { - $this->log("Updating main task.\n"); + $this->log("%s\n", pht('Updating main task.')); $task_id = $parent_ref->getObjectID(); $this->makeAsanaAPICall( @@ -148,7 +151,8 @@ $main_data); } else { $this->log( - "Skipping main task update, cursor is ahead of the story.\n"); + "%s\n", + pht('Skipping main task update, cursor is ahead of the story.')); } } } else { @@ -156,7 +160,9 @@ // (reviewers or auditors), and we haven't synchronized the object before, // don't synchronize the object. if (!$active_phids && !$passive_phids && !$follow_phids) { - $this->log("Object has no followers or active/passive users.\n"); + $this->log( + "%s\n", + pht('Object has no followers or active/passive users.')); return; } @@ -240,8 +246,10 @@ if (!$parent_ref->getIsVisible()) { throw new PhabricatorWorkerPermanentFailureException( - 'DoorkeeperExternalObject has no visible object on the other side; '. - 'this likely indicates the Asana task has been deleted.'); + pht( + '%s has no visible object on the other side; this '. + 'likely indicates the Asana task has been deleted.', + 'DoorkeeperExternalObject')); } // Now, handle the subtasks. @@ -264,7 +272,7 @@ foreach ($refs as $ref) { if ($ref->getSyncFailed()) { throw new Exception( - 'Synchronization of child task from Asana failed!'); + pht('Synchronization of child task from Asana failed!')); } if (!$ref->getIsVisible()) { $ref->getExternalObject()->delete(); @@ -283,8 +291,10 @@ } $this->log( - "Removing subtask edge to %s, foreign object is not visible.\n", - $sub_phid); + "%s\n", + pht( + 'Removing subtask edge to %s, foreign object is not visible.', + $sub_phid)); $sub_editor->removeEdge($src_phid, $etype_sub, $sub_phid); unset($sub_edges[$sub_phid]); } @@ -448,7 +458,7 @@ $provider = PhabricatorAsanaAuthProvider::getAsanaProvider(); if (!$provider) { throw new PhabricatorWorkerPermanentFailureException( - 'No Asana provider configured.'); + pht('No Asana provider configured.')); } $this->provider = $provider; } @@ -500,11 +510,11 @@ } private function getSynchronizationWarning() { - return + return pht( "\xE2\x9A\xA0 DO NOT EDIT THIS TASK \xE2\x9A\xA0\n". "\xE2\x98\xA0 Your changes will not be reflected in Phabricator.\n". "\xE2\x98\xA0 Your changes will be destroyed the next time state ". - "is synchronized."; + "is synchronized."); } private function lookupAsanaUserIDs($all_phids) { diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php --- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php +++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php @@ -158,21 +158,23 @@ */ final protected function doWork() { if (PhabricatorEnv::getEnvConfig('phabricator.silent')) { - $this->log(pht('Phabricator is running in silent mode.')); + $this->log("%s\n", pht('Phabricator is running in silent mode.')); return; } if (!$this->isEnabled()) { - $this->log("Doorkeeper worker '%s' is not enabled.\n", get_class($this)); + $this->log( + "%s\n", + pht("Doorkeeper worker '%s' is not enabled.", get_class($this))); return; } $publisher = $this->loadPublisher(); if (!$publisher) { - $this->log("Story is about an unsupported object type.\n"); + $this->log("%s\n", pht('Story is about an unsupported object type.')); return; } else { - $this->log("Using publisher '%s'.\n", get_class($publisher)); + $this->log("%s\n", pht("Using publisher '%s'.", get_class($publisher))); } $this->publishFeedStory(); diff --git a/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php --- a/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php +++ b/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php @@ -34,7 +34,9 @@ $object->getPHID(), PhabricatorJiraIssueHasObjectEdgeType::EDGECONST); if (!$jira_issue_phids) { - $this->log("Story is about an object with no linked JIRA issues.\n"); + $this->log( + "%s\n", + pht('Story is about an object with no linked JIRA issues.')); return; } @@ -44,13 +46,17 @@ ->execute(); if (!$xobjs) { - $this->log("Story object has no corresponding external JIRA objects.\n"); + $this->log( + "%s\n", + pht('Story object has no corresponding external JIRA objects.')); return; } $try_users = $this->findUsersToPossess(); if (!$try_users) { - $this->log("No users to act on linked JIRA objects.\n"); + $this->log( + "%s\n", + pht('No users to act on linked JIRA objects.')); return; } @@ -89,9 +95,11 @@ } catch (HTTPFutureResponseStatus $ex) { phlog($ex); $this->log( - "Failed to update object %s using user %s.\n", - $xobj->getObjectID(), - $account->getUserPHID()); + "%s\n", + pht( + 'Failed to update object %s using user %s.', + $xobj->getObjectID(), + $account->getUserPHID())); } } } @@ -113,7 +121,7 @@ $provider = PhabricatorJIRAAuthProvider::getJIRAProvider(); if (!$provider) { throw new PhabricatorWorkerPermanentFailureException( - 'No JIRA provider configured.'); + pht('No JIRA provider configured.')); } $this->provider = $provider; } diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php --- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php @@ -36,7 +36,7 @@ $lease = idx($query, $lease_id); if (!$lease) { - throw new Exception("No such lease '{$lease_id}'!"); + throw new Exception(pht("No such lease '%d'!", $lease_id)); } return $lease; @@ -45,7 +45,7 @@ protected function getInstance() { if (!$this->instance) { throw new Exception( - 'Attach the blueprint instance to the implementation.'); + pht('Attach the blueprint instance to the implementation.')); } return $this->instance; @@ -116,7 +116,7 @@ $scope = $this->pushActiveScope($resource, $lease); - $this->log('Trying to Allocate Lease'); + $this->log(pht('Trying to Allocate Lease')); $lease->setStatus(DrydockLeaseStatus::STATUS_ACQUIRING); $lease->setResourceID($resource->getID()); @@ -158,7 +158,7 @@ $this->log('Allocated Lease'); } else { $resource->killTransaction(); - $this->log('Failed to Allocate Lease'); + $this->log(pht('Failed to Allocate Lease')); } if ($allocation_exception) { @@ -221,7 +221,7 @@ $scope = $this->pushActiveScope($resource, $lease); - $this->log('Acquiring Lease'); + $this->log(pht('Acquiring Lease')); $lease->setStatus(DrydockLeaseStatus::STATUS_ACTIVE); $lease->setResourceID($resource->getID()); $lease->attachResource($resource); @@ -237,7 +237,7 @@ $lease->setAttributes($ephemeral_lease->getAttributes()); $lease->save(); - $this->log('Acquired Lease'); + $this->log(pht('Acquired Lease')); } @@ -287,7 +287,7 @@ $lease->saveTransaction(); if (!$released) { - throw new Exception('Unable to release lease: lease not active!'); + throw new Exception(pht('Unable to release lease: lease not active!')); } } @@ -428,9 +428,12 @@ if (!($resource instanceof DrydockResource)) { throw new Exception( - "Blueprint '{$blueprint}' is not properly implemented: ". - "executeAllocateResource() must return an object of type ". - "DrydockResource or throw, but returned something else."); + pht( + "Blueprint '%s' is not properly implemented: %s must return an ". + "object of type %s or throw, but returned something else.", + $blueprint, + 'executeAllocateResource()', + 'DrydockResource')); } $current_status = $resource->getStatus(); @@ -439,10 +442,14 @@ $current_name = DrydockResourceStatus::getNameForStatus($current_status); $req_name = DrydockResourceStatus::getNameForStatus($req_status); throw new Exception( - "Blueprint '{$blueprint}' is not properly implemented: ". - "executeAllocateResource() must return a DrydockResource with ". - "status '{$req_name}', but returned one with status ". - "'{$current_name}'."); + pht( + "Blueprint '%s' is not properly implemented: %s must return a %s ". + "with status '%s', but returned one with status '%s'.", + $blueprint, + 'executeAllocateResource()', + 'DrydockResource', + $req_name, + $current_name)); } } @@ -452,7 +459,7 @@ if (($this->activeResource !== null) || ($this->activeLease !== null)) { - throw new Exception('There is already an active resource or lease!'); + throw new Exception(pht('There is already an active resource or lease!')); } $this->activeResource = $resource; diff --git a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php --- a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php @@ -20,7 +20,8 @@ } protected function executeAllocateResource(DrydockLease $lease) { - throw new Exception("Preallocated hosts can't be dynamically allocated."); + throw new Exception( + pht("Preallocated hosts can't be dynamically allocated.")); } protected function canAllocateLease( @@ -84,7 +85,9 @@ // inaccurate sanity checking since we can't safely escape the path. if (preg_match('/^[A-Z]\\:\\\\[a-zA-Z0-9\\\\\\ ]/', $full_path) === 0) { throw new Exception( - 'Unsafe path detected for Windows platform: "'.$full_path.'".'); + pht( + 'Unsafe path detected for Windows platform: "%s".', + $full_path)); } $cmd->execx('mkdir %C', $full_path); } @@ -120,7 +123,7 @@ )); } - throw new Exception("No interface of type '{$type}'."); + throw new Exception(pht("No interface of type '%s'.", $type)); } } diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php --- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php @@ -37,7 +37,9 @@ $repository_id = $lease->getAttribute('repositoryID'); if (!$repository_id) { throw new Exception( - "Lease is missing required 'repositoryID' attribute."); + pht( + "Lease is missing required '%s' attribute.", + 'repositoryID')); } $repository = id(new PhabricatorRepositoryQuery()) @@ -47,14 +49,16 @@ if (!$repository) { throw new Exception( - "Repository '{$repository_id}' does not exist!"); + pht( + "Repository '%s' does not exist!", + $repository_id)); } switch ($repository->getVersionControlSystem()) { case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: break; default: - throw new Exception('Unsupported VCS!'); + throw new Exception(pht('Unsupported VCS!')); } // TODO: Policy stuff here too. @@ -108,7 +112,7 @@ ->getInterface($type); } - throw new Exception("No interface of type '{$type}'."); + throw new Exception(pht("No interface of type '%s'.", $type)); } } diff --git a/src/applications/drydock/constants/DrydockResourceStatus.php b/src/applications/drydock/constants/DrydockResourceStatus.php --- a/src/applications/drydock/constants/DrydockResourceStatus.php +++ b/src/applications/drydock/constants/DrydockResourceStatus.php @@ -17,7 +17,7 @@ self::STATUS_DESTROYED => pht('Destroyed'), ); - return idx($map, $status, 'Unknown'); + return idx($map, $status, pht('Unknown')); } public static function getAllStatuses() { diff --git a/src/applications/drydock/controller/DrydockConsoleController.php b/src/applications/drydock/controller/DrydockConsoleController.php --- a/src/applications/drydock/controller/DrydockConsoleController.php +++ b/src/applications/drydock/controller/DrydockConsoleController.php @@ -43,24 +43,19 @@ ->setHeader(pht('Resources')) ->setHref($this->getApplicationURI('resource/')) ->addAttribute( - pht( - 'View and manage resources Drydock has built, like hosts.'))); + pht('View and manage resources Drydock has built, like hosts.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Leases')) ->setHref($this->getApplicationURI('lease/')) - ->addAttribute( - pht( - 'Manage leases on resources.'))); + ->addAttribute(pht('Manage leases on resources.'))); $menu->addItem( id(new PHUIObjectItemView()) ->setHeader(pht('Logs')) ->setHref($this->getApplicationURI('log/')) - ->addAttribute( - pht( - 'View logs.'))); + ->addAttribute(pht('View logs.'))); $crumbs = $this->buildApplicationCrumbs(); diff --git a/src/applications/drydock/controller/DrydockLeaseReleaseController.php b/src/applications/drydock/controller/DrydockLeaseReleaseController.php --- a/src/applications/drydock/controller/DrydockLeaseReleaseController.php +++ b/src/applications/drydock/controller/DrydockLeaseReleaseController.php @@ -27,8 +27,11 @@ $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Lease Not Active')) - ->appendChild(phutil_tag('p', array(), pht( - 'You can only release "active" leases.'))) + ->appendChild( + phutil_tag( + 'p', + array(), + pht('You can only release "active" leases.'))) ->addCancelButton($lease_uri); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -38,10 +41,14 @@ $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Really release lease?')) - ->appendChild(phutil_tag('p', array(), pht( - 'Releasing a lease may cause trouble for the lease holder and '. - 'trigger cleanup of the underlying resource. It can not be '. - 'undone. Continue?'))) + ->appendChild( + phutil_tag( + 'p', + array(), + pht( + 'Releasing a lease may cause trouble for the lease holder and '. + 'trigger cleanup of the underlying resource. It can not be '. + 'undone. Continue?'))) ->addSubmitButton(pht('Release Lease')) ->addCancelButton($lease_uri); diff --git a/src/applications/drydock/controller/DrydockResourceViewController.php b/src/applications/drydock/controller/DrydockResourceViewController.php --- a/src/applications/drydock/controller/DrydockResourceViewController.php +++ b/src/applications/drydock/controller/DrydockResourceViewController.php @@ -20,7 +20,7 @@ return new Aphront404Response(); } - $title = 'Resource '.$resource->getID().' '.$resource->getName(); + $title = pht('Resource %s %s', $resource->getID(), $resource->getName()); $header = id(new PHUIHeaderView()) ->setHeader($title); diff --git a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php --- a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php +++ b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php @@ -17,14 +17,15 @@ ->executeOne(); if ($credential === null) { - throw new Exception(pht( - 'There is no credential with ID %d.', - $this->getConfig('credential'))); + throw new Exception( + pht( + 'There is no credential with ID %d.', + $this->getConfig('credential'))); } if ($credential->getProvidesType() !== PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) { - throw new Exception('Only private key credentials are supported.'); + throw new Exception(pht('Only private key credentials are supported.')); } $this->passphraseSSHKey = PassphraseSSHKey::loadFromPHID( diff --git a/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php b/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php --- a/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php +++ b/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php @@ -17,7 +17,7 @@ if ($credential->getProvidesType() !== PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) { - throw new Exception('Only private key credentials are supported.'); + throw new Exception(pht('Only private key credentials are supported.')); } $this->passphraseSSHKey = PassphraseSSHKey::loadFromPHID( diff --git a/src/applications/drydock/management/DrydockManagementCloseWorkflow.php b/src/applications/drydock/management/DrydockManagementCloseWorkflow.php --- a/src/applications/drydock/management/DrydockManagementCloseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementCloseWorkflow.php @@ -6,7 +6,7 @@ protected function didConstruct() { $this ->setName('close') - ->setSynopsis('Close a resource.') + ->setSynopsis(pht('Close a resource.')) ->setArguments( array( array( @@ -22,7 +22,7 @@ $ids = $args->getArg('ids'); if (!$ids) { throw new PhutilArgumentUsageException( - 'Specify one or more resource IDs to close.'); + pht('Specify one or more resource IDs to close.')); } $viewer = $this->getViewer(); @@ -35,12 +35,12 @@ foreach ($ids as $id) { $resource = idx($resources, $id); if (!$resource) { - $console->writeErr("Resource %d does not exist!\n", $id); + $console->writeErr("%s\n", pht('Resource %d does not exist!', $id)); } else if ($resource->getStatus() != DrydockResourceStatus::STATUS_OPEN) { - $console->writeErr("Resource %d is not 'open'!\n", $id); + $console->writeErr("%s\n", pht("Resource %d is not 'open'!", $id)); } else { $resource->closeResource(); - $console->writeErr("Closed resource %d.\n", $id); + $console->writeErr("%s\n", pht('Closed resource %d.', $id)); } } diff --git a/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php b/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php --- a/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php @@ -6,23 +6,23 @@ protected function didConstruct() { $this ->setName('create-resource') - ->setSynopsis('Create a resource manually.') + ->setSynopsis(pht('Create a resource manually.')) ->setArguments( array( array( 'name' => 'name', 'param' => 'resource_name', - 'help' => 'Resource name.', + 'help' => pht('Resource name.'), ), array( 'name' => 'blueprint', 'param' => 'blueprint_id', - 'help' => 'Blueprint ID.', + 'help' => pht('Blueprint ID.'), ), array( 'name' => 'attributes', 'param' => 'name=value,...', - 'help' => 'Resource attributes.', + 'help' => pht('Resource attributes.'), ), )); } @@ -33,13 +33,17 @@ $resource_name = $args->getArg('name'); if (!$resource_name) { throw new PhutilArgumentUsageException( - 'Specify a resource name with `--name`.'); + pht( + 'Specify a resource name with `%s`.', + '--name')); } $blueprint_id = $args->getArg('blueprint'); if (!$blueprint_id) { throw new PhutilArgumentUsageException( - 'Specify a blueprint ID with `--blueprint`.'); + pht( + 'Specify a blueprint ID with `%s`.', + '--blueprint')); } $attributes = $args->getArg('attributes'); @@ -57,7 +61,7 @@ ->executeOne(); if (!$blueprint) { throw new PhutilArgumentUsageException( - 'Specified blueprint does not exist.'); + pht('Specified blueprint does not exist.')); } $resource = id(new DrydockResource()) @@ -70,7 +74,7 @@ } $resource->save(); - $console->writeOut("Created Resource %s\n", $resource->getID()); + $console->writeOut("%s\n", pht('Created Resource %s', $resource->getID())); return 0; } diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php --- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php @@ -6,18 +6,18 @@ protected function didConstruct() { $this ->setName('lease') - ->setSynopsis('Lease a resource.') + ->setSynopsis(pht('Lease a resource.')) ->setArguments( array( array( 'name' => 'type', 'param' => 'resource_type', - 'help' => 'Resource type.', + 'help' => pht('Resource type.'), ), array( 'name' => 'attributes', 'param' => 'name=value,...', - 'help' => 'Resource specficiation.', + 'help' => pht('Resource specficiation.'), ), )); } @@ -28,7 +28,9 @@ $resource_type = $args->getArg('type'); if (!$resource_type) { throw new PhutilArgumentUsageException( - 'Specify a resource type with `--type`.'); + pht( + 'Specify a resource type with `%s`.', + '--type')); } $attributes = $args->getArg('attributes'); @@ -49,7 +51,7 @@ ->queueForActivation() ->waitUntilActive(); - $console->writeOut("Acquired Lease %s\n", $lease->getID()); + $console->writeOut("%s\n", pht('Acquired Lease %s', $lease->getID())); return 0; } diff --git a/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php b/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php --- a/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php +++ b/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php @@ -6,7 +6,7 @@ protected function didConstruct() { $this ->setName('release') - ->setSynopsis('Release a lease.') + ->setSynopsis(pht('Release a lease.')) ->setArguments( array( array( @@ -22,7 +22,7 @@ $ids = $args->getArg('ids'); if (!$ids) { throw new PhutilArgumentUsageException( - 'Specify one or more lease IDs to release.'); + pht('Specify one or more lease IDs to release.')); } $viewer = $this->getViewer(); @@ -35,15 +35,15 @@ foreach ($ids as $id) { $lease = idx($leases, $id); if (!$lease) { - $console->writeErr("Lease %d does not exist!\n", $id); + $console->writeErr("%s\n", pht('Lease %d does not exist!', $id)); } else if ($lease->getStatus() != DrydockLeaseStatus::STATUS_ACTIVE) { - $console->writeErr("Lease %d is not 'active'!\n", $id); + $console->writeErr("%s\n", pht("Lease %d is not 'active'!", $id)); } else { $resource = $lease->getResource(); $blueprint = $resource->getBlueprint(); $blueprint->releaseLease($resource, $lease); - $console->writeErr("Released lease %d.\n", $id); + $console->writeErr("%s\n", pht('Released lease %d.', $id)); } } diff --git a/src/applications/drydock/storage/DrydockBlueprint.php b/src/applications/drydock/storage/DrydockBlueprint.php --- a/src/applications/drydock/storage/DrydockBlueprint.php +++ b/src/applications/drydock/storage/DrydockBlueprint.php @@ -56,7 +56,9 @@ DrydockBlueprintImplementation::getAllBlueprintImplementations(); if (!isset($implementations[$class])) { throw new Exception( - "Invalid class name for blueprint (got '".$class."')"); + pht( + "Invalid class name for blueprint (got '%s')", + $class)); } return id(new $class())->attachInstance($this); } @@ -148,5 +150,4 @@ } - } diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php --- a/src/applications/drydock/storage/DrydockLease.php +++ b/src/applications/drydock/storage/DrydockLease.php @@ -100,7 +100,7 @@ public function queueForActivation() { if ($this->getID()) { throw new Exception( - 'Only new leases may be queued for activation!'); + pht('Only new leases may be queued for activation!')); } $this->setStatus(DrydockLeaseStatus::STATUS_PENDING); @@ -143,8 +143,9 @@ private function assertActive() { if (!$this->isActive()) { throw new Exception( - 'Lease is not active! You can not interact with resources through '. - 'an inactive lease.'); + pht( + 'Lease is not active! You can not interact with resources through '. + 'an inactive lease.')); } } @@ -164,16 +165,16 @@ unset($unresolved[$key]); break; case DrydockLeaseStatus::STATUS_RELEASED: - throw new Exception('Lease has already been released!'); + throw new Exception(pht('Lease has already been released!')); case DrydockLeaseStatus::STATUS_EXPIRED: - throw new Exception('Lease has already expired!'); + throw new Exception(pht('Lease has already expired!')); case DrydockLeaseStatus::STATUS_BROKEN: - throw new Exception('Lease has been broken!'); + throw new Exception(pht('Lease has been broken!')); case DrydockLeaseStatus::STATUS_PENDING: case DrydockLeaseStatus::STATUS_ACQUIRING: break; default: - throw new Exception('Unknown status??'); + throw new Exception(pht('Unknown status??')); } } diff --git a/src/applications/drydock/worker/DrydockAllocatorWorker.php b/src/applications/drydock/worker/DrydockAllocatorWorker.php --- a/src/applications/drydock/worker/DrydockAllocatorWorker.php +++ b/src/applications/drydock/worker/DrydockAllocatorWorker.php @@ -39,7 +39,7 @@ protected function doWork() { $lease = $this->loadLease(); - $this->logToDrydock('Allocating Lease'); + $this->logToDrydock(pht('Allocating Lease')); try { $this->allocateLease($lease); @@ -147,8 +147,10 @@ $lease->save(); $this->logToDrydock( - "There are no resources of type '{$type}' available, and no ". - "blueprints which can allocate new ones."); + pht( + "There are no resources of type '%s' available, and no ". + "blueprints which can allocate new ones.", + $type)); return; } @@ -174,7 +176,7 @@ // and then switch them to "OPEN" only after the allocating lease gets // its grubby mitts on the resource. This might make more sense but // is a bit messy. - throw new Exception('Lost an allocation race?'); + throw new Exception(pht('Lost an allocation race?')); } } diff --git a/src/applications/fact/controller/PhabricatorFactChartController.php b/src/applications/fact/controller/PhabricatorFactChartController.php --- a/src/applications/fact/controller/PhabricatorFactChartController.php +++ b/src/applications/fact/controller/PhabricatorFactChartController.php @@ -32,7 +32,7 @@ if (!$points) { // NOTE: Raphael crashes Safari if you hand it series with no points. - throw new Exception('No data to show!'); + throw new Exception(pht('No data to show!')); } // Limit amount of data passed to browser. diff --git a/src/applications/fact/daemon/PhabricatorFactDaemon.php b/src/applications/fact/daemon/PhabricatorFactDaemon.php --- a/src/applications/fact/daemon/PhabricatorFactDaemon.php +++ b/src/applications/fact/daemon/PhabricatorFactDaemon.php @@ -15,7 +15,7 @@ } $this->processAggregates(); - $this->log('Zzz...'); + $this->log(pht('Zzz...')); $this->sleep(60 * 5); } } @@ -35,7 +35,7 @@ } public function processIteratorWithCursor($iterator_name, $iterator) { - $this->log("Processing cursor '{$iterator_name}'."); + $this->log(pht("Processing cursor '%s'.", $iterator_name)); $cursor = id(new PhabricatorFactCursor())->loadOneWhere( 'name = %s', @@ -73,7 +73,7 @@ $raw_facts = array(); foreach ($iterator as $key => $object) { $phid = $object->getPHID(); - $this->log("Processing {$phid}..."); + $this->log(pht('Processing %s...', $phid)); $raw_facts[$phid] = $this->computeRawFacts($object); if (count($raw_facts) > self::RAW_FACT_BUFFER_LIMIT) { $this->updateRawFacts($raw_facts); @@ -91,7 +91,7 @@ } public function processAggregates() { - $this->log('Processing aggregates.'); + $this->log(pht('Processing aggregates.')); $facts = $this->computeAggregateFacts(); $this->updateAggregateFacts($facts); diff --git a/src/applications/fact/engine/PhabricatorFactCountEngine.php b/src/applications/fact/engine/PhabricatorFactCountEngine.php --- a/src/applications/fact/engine/PhabricatorFactCountEngine.php +++ b/src/applications/fact/engine/PhabricatorFactCountEngine.php @@ -10,9 +10,9 @@ foreach ($fact_types as $type) { if (!strncmp($type, '+N:', 3)) { if ($type == '+N:*') { - $name = 'Total Objects'; + $name = pht('Total Objects'); } else { - $name = 'Total Objects of type '.substr($type, 3); + $name = pht('Total Objects of type %s', substr($type, 3)); } $results[] = id(new PhabricatorFactSimpleSpec($type)) @@ -22,9 +22,9 @@ if (!strncmp($type, 'N:', 2)) { if ($type == 'N:*') { - $name = 'Objects'; + $name = pht('Objects'); } else { - $name = 'Objects of type '.substr($type, 2); + $name = pht('Objects of type %s', substr($type, 2)); } $results[] = id(new PhabricatorFactSimpleSpec($type)) ->setName($name) diff --git a/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php b/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php --- a/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php +++ b/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php @@ -10,7 +10,7 @@ foreach ($fact_types as $type) { if ($type == 'updated') { $results[] = id(new PhabricatorFactSimpleSpec($type)) - ->setName('Facts Last Updated') + ->setName(pht('Facts Last Updated')) ->setUnit(PhabricatorFactSimpleSpec::UNIT_EPOCH); } } diff --git a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php --- a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php +++ b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php @@ -2,7 +2,7 @@ /** * Iterate over objects by update time in a stable way. This iterator only works - * for "normal" Lisk objects: objects with an autoincrement ID and a + * for "normal" Lisk objects: objects with an auto-increment ID and a * dateModified column. */ final class PhabricatorFactUpdateIterator extends PhutilBufferedIterator { diff --git a/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php b/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php --- a/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php +++ b/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php @@ -13,15 +13,15 @@ 'name' => 'iterator', 'param' => 'name', 'repeat' => true, - 'help' => 'Process only iterator __name__.', + 'help' => pht('Process only iterator __name__.'), ), array( 'name' => 'all', - 'help' => 'Analyze from the beginning, ignoring cursors.', + 'help' => pht('Analyze from the beginning, ignoring cursors.'), ), array( 'name' => 'skip-aggregates', - 'help' => 'Skip analysis of aggreate facts.', + 'help' => pht('Skip analysis of aggregate facts.'), ), )); } diff --git a/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php b/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php --- a/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php +++ b/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php @@ -16,7 +16,7 @@ 'name' => 'reset', 'param' => 'cursor', 'repeat' => true, - 'help' => 'Reset cursor __cursor__.', + 'help' => pht('Reset cursor __cursor__.'), ), )); } diff --git a/src/applications/fact/spec/PhabricatorFactSpec.php b/src/applications/fact/spec/PhabricatorFactSpec.php --- a/src/applications/fact/spec/PhabricatorFactSpec.php +++ b/src/applications/fact/spec/PhabricatorFactSpec.php @@ -33,8 +33,9 @@ } public function getName() { - $type = $this->getType(); - return "Fact ({$type})"; + return pht( + 'Fact (%s)', + $this->getType()); } public function formatValueForDisplay(PhabricatorUser $user, $value) { diff --git a/src/applications/feed/PhabricatorFeedStoryPublisher.php b/src/applications/feed/PhabricatorFeedStoryPublisher.php --- a/src/applications/feed/PhabricatorFeedStoryPublisher.php +++ b/src/applications/feed/PhabricatorFeedStoryPublisher.php @@ -74,21 +74,29 @@ public function publish() { $class = $this->storyType; if (!$class) { - throw new Exception('Call setStoryType() before publishing!'); + throw new Exception( + pht( + 'Call %s before publishing!', + 'setStoryType()')); } if (!class_exists($class)) { throw new Exception( - "Story type must be a valid class name and must subclass ". - "PhabricatorFeedStory. ". - "'{$class}' is not a loadable class."); + pht( + "Story type must be a valid class name and must subclass %s. ". + "'%s' is not a loadable class.", + 'PhabricatorFeedStory', + $class)); } if (!is_subclass_of($class, 'PhabricatorFeedStory')) { throw new Exception( - "Story type must be a valid class name and must subclass ". - "PhabricatorFeedStory. ". - "'{$class}' is not a subclass of PhabricatorFeedStory."); + pht( + "Story type must be a valid class name and must subclass %s. ". + "'%s' is not a subclass of %s.", + 'PhabricatorFeedStory', + $class, + 'PhabricatorFeedStory')); } $chrono_key = $this->generateChronologicalKey(); @@ -139,7 +147,10 @@ private function insertNotifications($chrono_key, array $subscribed_phids) { if (!$this->primaryObjectPHID) { throw new Exception( - 'You must call setPrimaryObjectPHID() if you setSubscribedPHIDs()!'); + pht( + 'You must call %s if you %s!', + 'setPrimaryObjectPHID()', + 'setSubscribedPHIDs()')); } $notif = new PhabricatorFeedStoryNotification(); diff --git a/src/applications/feed/builder/PhabricatorFeedBuilder.php b/src/applications/feed/builder/PhabricatorFeedBuilder.php --- a/src/applications/feed/builder/PhabricatorFeedBuilder.php +++ b/src/applications/feed/builder/PhabricatorFeedBuilder.php @@ -34,7 +34,7 @@ public function buildView() { if (!$this->user) { - throw new Exception('Call setUser() before buildView()!'); + throw new PhutilInvalidStateException('setUser'); } $user = $this->user; diff --git a/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php b/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php --- a/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php +++ b/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php @@ -11,7 +11,7 @@ } public function getMethodDescription() { - return 'Publish a story to the feed.'; + return pht('Publish a story to the feed.'); } protected function defineParamTypes() { diff --git a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php --- a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php +++ b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php @@ -11,7 +11,7 @@ } public function getMethodDescription() { - return 'Query the feed for stories'; + return pht('Query the feed for stories'); } private function getDefaultLimit() { @@ -30,10 +30,10 @@ private function getSupportedViewTypes() { return array( - 'html' => 'Full HTML presentation of story', - 'data' => 'Dictionary with various data of the story', - 'html-summary' => 'Story contains only the title of the story', - 'text' => 'Simple one-line plain text representation of story', + 'html' => pht('Full HTML presentation of story'), + 'data' => pht('Dictionary with various data of the story'), + 'html-summary' => pht('Story contains only the title of the story'), + 'text' => pht('Simple one-line plain text representation of story'), ); } @@ -44,7 +44,9 @@ return array( 'ERR-UNKNOWN-TYPE' => - 'Unsupported view type, possibles are: '.$view_types, + pht( + 'Unsupported view type, possibles are: %s', + $view_types), ); } diff --git a/src/applications/feed/query/PhabricatorFeedQuery.php b/src/applications/feed/query/PhabricatorFeedQuery.php --- a/src/applications/feed/query/PhabricatorFeedQuery.php +++ b/src/applications/feed/query/PhabricatorFeedQuery.php @@ -67,7 +67,8 @@ $keys = $this->chronologicalKeys; foreach ($keys as $key) { if (!ctype_digit($key)) { - throw new Exception("Key '{$key}' is not a valid chronological key!"); + throw new Exception( + pht("Key '%s' is not a valid chronological key!", $key)); } } diff --git a/src/applications/feed/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php --- a/src/applications/feed/story/PhabricatorFeedStory.php +++ b/src/applications/feed/story/PhabricatorFeedStory.php @@ -215,7 +215,7 @@ case PhabricatorApplicationTransaction::TARGET_TEXT: break; default: - throw new Exception('Unknown rendering target: '.$target); + throw new Exception(pht('Unknown rendering target: %s', $target)); break; } } @@ -229,7 +229,9 @@ $object = idx($this->objects, $phid); if (!$object) { throw new Exception( - "Story is asking for an object it did not request ('{$phid}')!"); + pht( + "Story is asking for an object it did not request ('%s')!", + $phid)); } return $object; } @@ -237,7 +239,7 @@ public function getPrimaryObject() { $phid = $this->getPrimaryObjectPHID(); if (!$phid) { - throw new Exception('Story has no primary object!'); + throw new Exception(pht('Story has no primary object!')); } return $this->getObject($phid); } @@ -308,7 +310,7 @@ $handle = new PhabricatorObjectHandle(); $handle->setPHID($phid); - $handle->setName("Unloaded Object '{$phid}'"); + $handle->setName(pht("Unloaded Object '%s'", $phid)); return $handle; } diff --git a/src/applications/feed/worker/FeedPushWorker.php b/src/applications/feed/worker/FeedPushWorker.php --- a/src/applications/feed/worker/FeedPushWorker.php +++ b/src/applications/feed/worker/FeedPushWorker.php @@ -13,7 +13,7 @@ if (!$story) { throw new PhabricatorWorkerPermanentFailureException( - 'Feed story does not exist.'); + pht('Feed story does not exist.')); } return $story; diff --git a/src/applications/files/application/PhabricatorFilesApplication.php b/src/applications/files/application/PhabricatorFilesApplication.php --- a/src/applications/files/application/PhabricatorFilesApplication.php +++ b/src/applications/files/application/PhabricatorFilesApplication.php @@ -59,8 +59,7 @@ protected function getCustomCapabilities() { return array( FilesDefaultViewCapability::CAPABILITY => array( - 'caption' => pht( - 'Default view policy for newly created files.'), + 'caption' => pht('Default view policy for newly created files.'), ), ); } diff --git a/src/applications/files/conduit/FileConduitAPIMethod.php b/src/applications/files/conduit/FileConduitAPIMethod.php --- a/src/applications/files/conduit/FileConduitAPIMethod.php +++ b/src/applications/files/conduit/FileConduitAPIMethod.php @@ -74,8 +74,7 @@ if ($chunk->getDataFilePHID()) { throw new Exception( - pht( - 'Chunk has already been uploaded.')); + pht('Chunk has already been uploaded.')); } return $chunk; diff --git a/src/applications/files/conduit/FileDownloadConduitAPIMethod.php b/src/applications/files/conduit/FileDownloadConduitAPIMethod.php --- a/src/applications/files/conduit/FileDownloadConduitAPIMethod.php +++ b/src/applications/files/conduit/FileDownloadConduitAPIMethod.php @@ -7,7 +7,7 @@ } public function getMethodDescription() { - return 'Download a file from the server.'; + return pht('Download a file from the server.'); } protected function defineParamTypes() { @@ -22,7 +22,7 @@ protected function defineErrorTypes() { return array( - 'ERR-BAD-PHID' => 'No such file exists.', + 'ERR-BAD-PHID' => pht('No such file exists.'), ); } diff --git a/src/applications/files/conduit/FileInfoConduitAPIMethod.php b/src/applications/files/conduit/FileInfoConduitAPIMethod.php --- a/src/applications/files/conduit/FileInfoConduitAPIMethod.php +++ b/src/applications/files/conduit/FileInfoConduitAPIMethod.php @@ -7,7 +7,7 @@ } public function getMethodDescription() { - return 'Get information about a file.'; + return pht('Get information about a file.'); } protected function defineParamTypes() { @@ -23,7 +23,7 @@ protected function defineErrorTypes() { return array( - 'ERR-NOT-FOUND' => 'No such file exists.', + 'ERR-NOT-FOUND' => pht('No such file exists.'), ); } diff --git a/src/applications/files/conduit/FileUploadConduitAPIMethod.php b/src/applications/files/conduit/FileUploadConduitAPIMethod.php --- a/src/applications/files/conduit/FileUploadConduitAPIMethod.php +++ b/src/applications/files/conduit/FileUploadConduitAPIMethod.php @@ -7,7 +7,7 @@ } public function getMethodDescription() { - return 'Upload a file to the server.'; + return pht('Upload a file to the server.'); } protected function defineParamTypes() { diff --git a/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php b/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php --- a/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php +++ b/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php @@ -8,7 +8,7 @@ } public function getMethodDescription() { - return 'Upload a file to the server using content hash.'; + return pht('Upload a file to the server using content hash.'); } protected function defineParamTypes() { diff --git a/src/applications/files/config/PhabricatorFilesConfigOptions.php b/src/applications/files/config/PhabricatorFilesConfigOptions.php --- a/src/applications/files/config/PhabricatorFilesConfigOptions.php +++ b/src/applications/files/config/PhabricatorFilesConfigOptions.php @@ -101,35 +101,37 @@ pht('Configure which MIME types are viewable in the browser.')) ->setDescription( pht( - 'Configure which uploaded file types may be viewed directly '. - 'in the browser. Other file types will be downloaded instead '. - 'of displayed. This is mainly a usability consideration, since '. - 'browsers tend to freak out when viewing enormous binary files.'. + "Configure which uploaded file types may be viewed directly ". + "in the browser. Other file types will be downloaded instead ". + "of displayed. This is mainly a usability consideration, since ". + "browsers tend to freak out when viewing enormous binary files.". "\n\n". - 'The keys in this map are vieweable MIME types; the values are '. - 'the MIME types they are delivered as when they are viewed in '. - 'the browser.')), + "The keys in this map are viewable MIME types; the values are ". + "the MIME types they are delivered as when they are viewed in ". + "the browser.")), $this->newOption('files.image-mime-types', 'set', $image_default) ->setLocked(true) ->setSummary(pht('Configure which MIME types are images.')) ->setDescription( pht( - 'List of MIME types which can be used as the `src` for an '. - '`` tag.')), + 'List of MIME types which can be used as the `%s` for an `%s` tag.', + 'src', + '')), $this->newOption('files.audio-mime-types', 'set', $audio_default) ->setLocked(true) ->setSummary(pht('Configure which MIME types are audio.')) ->setDescription( pht( - 'List of MIME types which can be used to render an '. - '`