1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Fix pht method calls

Summary: Ref T7046. This is mainly a proof-of-concept for D11661.

Test Plan: `arc lint`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7046

Differential Revision: https://secure.phabricator.com/D11680
This commit is contained in:
Joshua Spence 2015-02-10 18:49:08 +11:00
parent c66954af26
commit aaf8d73ec7
11 changed files with 35 additions and 56 deletions

View file

@ -192,7 +192,7 @@ final class AlmanacManagementRegisterWorkflow
$console->writeOut(
"%s\n",
pht('Installing device ID...', $raw_device));
pht('Installing device %s...', $raw_device));
// The permissions on this file are more open because the webserver also
// needs to read it.

View file

@ -6,7 +6,8 @@ final class ConduitMethodDoesNotExistException
public function __construct($method_name) {
parent::__construct(
pht(
'Conduit API method "%s" does not exist.'));
'Conduit API method "%s" does not exist.',
$method_name));
}
}

View file

@ -385,8 +385,8 @@ final class PhabricatorSetupIssueView extends AphrontView {
'p',
array(),
pht(
'PHP also loaded these configuration file(s):',
count($more_loc)));
'PHP also loaded these %s configuration file(s):',
new PhutilNumber(count($more_loc))));
$info[] = phutil_tag(
'pre',
array(),

View file

@ -60,7 +60,7 @@ final class DifferentialHovercardEventListener
implode_selected_handle_links(', ', $handles, $reviewer_phids));
if ($tasks) {
$hovercard->addField(pht('Task(s)', count($tasks)),
$hovercard->addField(pht('%s Task(s)', new PhutilNumber(count($tasks))),
implode_selected_handle_links(', ', $handles, $tasks));
}

View file

@ -79,15 +79,15 @@ final class DifferentialCreateMailReceiver extends PhabricatorMailReceiver {
count($diffs));
} else {
$subject = pht(
'Diff creation failed; see body for error(s).',
count($errors));
'Diff creation failed; see body for %s error(s).',
new PhutilNumber(count($errors)));
}
$body = new PhabricatorMetaMTAMailBody();
$body->addRawSection($subject);
if (count($diffs)) {
$text_body = '';
$html_body = array();
$body_label = pht('DIFF LINK(S)', count($diffs));
$body_label = pht('%s DIFF LINK(S)', new PhutilNumber(count($diffs)));
foreach ($diffs as $filename => $diff_uri) {
$text_body .= $filename.': '.$diff_uri."\n";
$html_body[] = phutil_tag(
@ -104,7 +104,7 @@ final class DifferentialCreateMailReceiver extends PhabricatorMailReceiver {
if (count($errors)) {
$body_section = new PhabricatorMetaMTAMailSection();
$body_label = pht('ERROR(S)', count($errors));
$body_label = pht('%s ERROR(S)', new PhutilNumber(count($errors)));
foreach ($errors as $error) {
$body_section->addFragment($error);
}

View file

@ -10,40 +10,27 @@ abstract class DifferentialChangesetHTMLRenderer
$file = $changeset->getFileType();
$messages = array();
$none = hsprintf('');
switch ($change) {
case DifferentialChangeType::TYPE_ADD:
switch ($file) {
case DifferentialChangeType::FILE_TEXT:
$messages[] = pht(
'This file was <strong>added</strong>.',
$none);
$messages[] = pht('This file was added.');
break;
case DifferentialChangeType::FILE_IMAGE:
$messages[] = pht(
'This image was <strong>added</strong>.',
$none);
$messages[] = pht('This image was added.');
break;
case DifferentialChangeType::FILE_DIRECTORY:
$messages[] = pht(
'This directory was <strong>added</strong>.',
$none);
$messages[] = pht('This directory was added.');
break;
case DifferentialChangeType::FILE_BINARY:
$messages[] = pht(
'This binary file was <strong>added</strong>.',
$none);
$messages[] = pht('This binary file was added.');
break;
case DifferentialChangeType::FILE_SYMLINK:
$messages[] = pht(
'This symlink was <strong>added</strong>.',
$none);
$messages[] = pht('This symlink was added.');
break;
case DifferentialChangeType::FILE_SUBMODULE:
$messages[] = pht(
'This submodule was <strong>added</strong>.',
$none);
$messages[] = pht('This submodule was added.');
break;
}
break;
@ -51,34 +38,22 @@ abstract class DifferentialChangesetHTMLRenderer
case DifferentialChangeType::TYPE_DELETE:
switch ($file) {
case DifferentialChangeType::FILE_TEXT:
$messages[] = pht(
'This file was <strong>deleted</strong>.',
$none);
$messages[] = pht('This file was deleted.');
break;
case DifferentialChangeType::FILE_IMAGE:
$messages[] = pht(
'This image was <strong>deleted</strong>.',
$none);
$messages[] = pht('This image was deleted.');
break;
case DifferentialChangeType::FILE_DIRECTORY:
$messages[] = pht(
'This directory was <strong>deleted</strong>.',
$none);
$messages[] = pht('This directory was deleted.');
break;
case DifferentialChangeType::FILE_BINARY:
$messages[] = pht(
'This binary file was <strong>deleted</strong>.',
$none);
$messages[] = pht('This binary file was deleted.');
break;
case DifferentialChangeType::FILE_SYMLINK:
$messages[] = pht(
'This symlink was <strong>deleted</strong>.',
$none);
$messages[] = pht('This symlink was deleted.');
break;
case DifferentialChangeType::FILE_SUBMODULE:
$messages[] = pht(
'This submodule was <strong>deleted</strong>.',
$none);
$messages[] = pht('This submodule was deleted.');
break;
}
break;

View file

@ -31,8 +31,7 @@ final class PhabricatorPeopleApproveController
$title = pht(
'Phabricator Account "%s" Approved',
$user->getUsername(),
$admin->getUsername());
$user->getUsername());
$body = pht(
"Your Phabricator account (%s) has been approved by %s. You can ".

View file

@ -52,7 +52,7 @@ final class PhabricatorRepositoryURINormalizer extends Phobject {
case self::TYPE_MERCURIAL:
break;
default:
throw new Exception(pht('Unknown URI type "%s"!'));
throw new Exception(pht('Unknown URI type "%s"!', $type));
}
$this->type = $type;

View file

@ -48,7 +48,9 @@ final class PhabricatorRepositoryManagementLookupUsersWorkflow
if (empty($refs_raw['data'])) {
throw new Exception(
pht('Unable to retrieve details for commit "%s"!'));
pht(
'Unable to retrieve details for commit "%s"!',
$commit->getPHID()));
}
$ref = DiffusionCommitRef::newFromConduitResult(head($refs_raw['data']));

View file

@ -17,9 +17,9 @@ abstract class PhabricatorBaseEnglishTranslation
'This configuration value is related:',
'These configuration values are related:',
),
'Task(s)' => array('Task', 'Tasks'),
'%s Task(s)' => array('Task', 'Tasks'),
'ERROR(S)' => array('ERROR', 'ERRORS'),
'%s ERROR(S)' => array('ERROR', 'ERRORS'),
'%d Error(s)' => array('%d Error', '%d Errors'),
'%d Warning(s)' => array('%d Warning', '%d Warnings'),
'%d Auto-Fix(es)' => array('%d Auto-Fix', '%d Auto-Fixes'),
@ -32,12 +32,12 @@ abstract class PhabricatorBaseEnglishTranslation
'%d path(s)' => array('%d path', '%d paths'),
'%d diff(s)' => array('%d diff', '%d diffs'),
'DIFF LINK(S)' => array('DIFF LINK', 'DIFF LINKS'),
'%s DIFF LINK(S)' => array('DIFF LINK', 'DIFF LINKS'),
'You successfully created %d diff(s).' => array(
'You successfully created %d diff.',
'You successfully created %d diffs.',
),
'Diff creation failed; see body for error(s).' => array(
'Diff creation failed; see body for %s error(s).' => array(
'Diff creation failed; see body for error.',
'Diff creation failed; see body for errors.',
),
@ -499,7 +499,7 @@ abstract class PhabricatorBaseEnglishTranslation
'here:',
),
'PHP also loaded these configuration file(s):' => array(
'PHP also loaded these %s configuration file(s):' => array(
'PHP also loaded this configuration file:',
'PHP also loaded these configuration files:',
),

View file

@ -37,7 +37,9 @@ final class PhabricatorRemarkupCowsayBlockInterpreter
if ($err) {
return $this->markupError(
pht(
'Execution of `cowsay` failed:', $stderr));
'Execution of `%s` failed: %s',
'cowsay',
$stderr));
}