1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-09 16:32:39 +01:00

phtize a bunch more strings

Summary: I found a few strings that I had missed, using a mostly-broken-but-somewhat-okay custom linter ruler (https://secure.phabricator.com/differential/diff/30988/).

Test Plan: Intense eyeballing.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: aurelijus, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12888
This commit is contained in:
Joshua Spence 2015-05-22 17:09:55 +10:00
parent 9edcaadb2a
commit 6f86866104
24 changed files with 412 additions and 323 deletions

View file

@ -94,7 +94,7 @@ final class ArcanistDiffUtilsTestCase extends PhutilTestCase {
ArcanistDiffUtils::generateEditString( ArcanistDiffUtils::generateEditString(
str_split($test[0]), str_split($test[0]),
str_split($test[1])), str_split($test[1])),
"'{$test[0]}' vs '{$test[1]}'"); pht("'%s' vs '%s'", $test[0], $test[1]));
} }
$utf8_tests = array( $utf8_tests = array(
@ -111,7 +111,7 @@ final class ArcanistDiffUtilsTestCase extends PhutilTestCase {
ArcanistDiffUtils::generateEditString( ArcanistDiffUtils::generateEditString(
phutil_utf8v_combined($test[0]), phutil_utf8v_combined($test[0]),
phutil_utf8v_combined($test[1])), phutil_utf8v_combined($test[1])),
"'{$test[0]}' vs '{$test[1]}' (utf8)"); pht("'%s' vs '%s' (utf8)", $test[0], $test[1]));
} }
} }

View file

@ -50,20 +50,9 @@ final class ArcanistUSEnglishTranslation extends PhutilTranslation {
'Do you want to create a new commit with these changes?', 'Do you want to create a new commit with these changes?',
), ),
'(To ignore these %s change(s), add them to ".git/info/exclude".)' => '(To ignore these %s change(s), add them to "%s".)' => array(
array( '(To ignore this change, add it to "%s".)',
'(To ignore this change, add it to ".git/info/exclude".)', '(To ignore these changes, add them to "%s".)',
'(To ignore these changes, add them to ".git/info/exclude".)',
),
'(To ignore these %s change(s), add them to "svn:ignore".)' => array(
'(To ignore this change, add it to "svn:ignore".)',
'(To ignore these changes, add them to "svn:ignore".)',
),
'(To ignore these %s change(s), add them to ".hgignore".)' => array(
'(To ignore this change, add it to ".hgignore".)',
'(To ignore these changes, add them to ".hgignore".)',
), ),
'%s line(s)' => array('line', 'lines'), '%s line(s)' => array('line', 'lines'),

View file

@ -6,7 +6,7 @@
final class ArcanistClosureLinter extends ArcanistExternalLinter { final class ArcanistClosureLinter extends ArcanistExternalLinter {
public function getInfoName() { public function getInfoName() {
return 'Closure Linter'; return pht('Closure Linter');
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -6,7 +6,7 @@
final class ArcanistJSONLintLinter extends ArcanistExternalLinter { final class ArcanistJSONLintLinter extends ArcanistExternalLinter {
public function getInfoName() { public function getInfoName() {
return 'JSON Lint'; return pht('JSON Lint');
} }
public function getInfoURI() { public function getInfoURI() {

View file

@ -8,7 +8,7 @@ final class ArcanistJSONLinter extends ArcanistLinter {
const LINT_PARSE_ERROR = 1; const LINT_PARSE_ERROR = 1;
public function getInfoName() { public function getInfoName() {
return 'JSON Lint'; return pht('JSON Lint');
} }
public function getInfoDescription() { public function getInfoDescription() {

View file

@ -15,7 +15,7 @@ final class ArcanistPhutilLibraryLinter extends ArcanistLinter {
const LINT_ONE_CLASS_PER_FILE = 3; const LINT_ONE_CLASS_PER_FILE = 3;
public function getInfoName() { public function getInfoName() {
return 'Phutil Library Linter'; return pht('Phutil Library Linter');
} }
public function getInfoDescription() { public function getInfoDescription() {

View file

@ -81,7 +81,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
private $windowsVersion; private $windowsVersion;
public function getInfoName() { public function getInfoName() {
return 'XHPAST Lint'; return pht('XHPAST Lint');
} }
public function getInfoDescription() { public function getInfoDescription() {
@ -1893,9 +1893,10 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
$message = $this->raiseLintAtNode( $message = $this->raiseLintAtNode(
$var, $var,
self::LINT_REUSED_AS_ITERATOR, self::LINT_REUSED_AS_ITERATOR,
pht(
'This iterator variable is a previously declared local '. 'This iterator variable is a previously declared local '.
'variable. To avoid overwriting locals, do not reuse them '. 'variable. To avoid overwriting locals, do not reuse them '.
'as iterator variables.'); 'as iterator variables.'));
$message->setOtherLocations(array( $message->setOtherLocations(array(
$this->getOtherLocation($declarations[$concrete]), $this->getOtherLocation($declarations[$concrete]),
$this->getOtherLocation(max($uses[$concrete])), $this->getOtherLocation(max($uses[$concrete])),

View file

@ -107,7 +107,7 @@ abstract class ArcanistLinterTestCase extends PhutilTestCase {
$working_copy = ArcanistWorkingCopyIdentity::newFromRootAndConfigFile( $working_copy = ArcanistWorkingCopyIdentity::newFromRootAndConfigFile(
$dir, $dir,
null, null,
'Unit Test'); pht('Unit Test'));
$configuration_manager = new ArcanistConfigurationManager(); $configuration_manager = new ArcanistConfigurationManager();
$configuration_manager->setWorkingCopyIdentity($working_copy); $configuration_manager->setWorkingCopyIdentity($working_copy);

View file

@ -29,19 +29,19 @@ final class ArcanistXHPASTLintNamingHookTestCase
$this->assertEqual( $this->assertEqual(
$expect[0], $expect[0],
ArcanistXHPASTLintNamingHook::isUpperCamelCase($test), ArcanistXHPASTLintNamingHook::isUpperCamelCase($test),
"UpperCamelCase: '{$test}'"); pht("UpperCamelCase: '%s'", $test));
$this->assertEqual( $this->assertEqual(
$expect[1], $expect[1],
ArcanistXHPASTLintNamingHook::isLowerCamelCase($test), ArcanistXHPASTLintNamingHook::isLowerCamelCase($test),
"lowerCamelCase: '{$test}'"); pht("lowerCamelCase: '%s'", $test));
$this->assertEqual( $this->assertEqual(
$expect[2], $expect[2],
ArcanistXHPASTLintNamingHook::isUppercaseWithUnderscores($test), ArcanistXHPASTLintNamingHook::isUppercaseWithUnderscores($test),
"UPPERCASE_WITH_UNDERSCORES: '{$test}'"); pht("UPPERCASE_WITH_UNDERSCORES: '%s'", $test));
$this->assertEqual( $this->assertEqual(
$expect[3], $expect[3],
ArcanistXHPASTLintNamingHook::isLowercaseWithUnderscores($test), ArcanistXHPASTLintNamingHook::isLowercaseWithUnderscores($test),
"lowercase_with_underscores: '{$test}'"); pht("lowercase_with_underscores: '%s'", $test));
} }
} }

View file

@ -1104,7 +1104,7 @@ final class ArcanistDiffParser {
protected function getLine() { protected function getLine() {
if ($this->text === null) { if ($this->text === null) {
throw new Exception('Not parsing!'); throw new Exception(pht('Not parsing!'));
} }
if (isset($this->text[$this->line])) { if (isset($this->text[$this->line])) {
return $this->text[$this->line]; return $this->text[$this->line];
@ -1205,14 +1205,14 @@ final class ArcanistDiffParser {
} }
$out = array(); $out = array();
$out[] = "Diff Parse Exception: {$message}"; $out[] = pht('Diff Parse Exception: %s', $message);
if ($this->writeDiffOnFailure) { if ($this->writeDiffOnFailure) {
$temp = new TempFile(); $temp = new TempFile();
$temp->setPreserveFile(true); $temp->setPreserveFile(true);
Filesystem::writeFile($temp, $this->rawDiff); Filesystem::writeFile($temp, $this->rawDiff);
$out[] = 'Raw input file was written to: '.(string)$temp; $out[] = pht('Raw input file was written to: %s', $temp);
} }
$out[] = $context; $out[] = $context;

View file

@ -5,7 +5,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
public function testBasics() { public function testBasics() {
// Verify that the very basics of base commit resolution work. // Verify that the very basics of base commit resolution work.
$this->assertCommit( $this->assertCommit(
'Empty Rules', pht('Empty Rules'),
null, null,
array( array(
)); ));
@ -23,7 +23,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
// test cases intentionally scramble argument order to test that resolution // test cases intentionally scramble argument order to test that resolution
// order is independent of argument order. // order is independent of argument order.
$this->assertCommit( $this->assertCommit(
'Order: Args', pht('Order: Args'),
'y', 'y',
array( array(
'local' => 'literal:n', 'local' => 'literal:n',
@ -33,7 +33,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
)); ));
$this->assertCommit( $this->assertCommit(
'Order: Local', pht('Order: Local'),
'y', 'y',
array( array(
'project' => 'literal:n', 'project' => 'literal:n',
@ -42,7 +42,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
)); ));
$this->assertCommit( $this->assertCommit(
'Order: Project', pht('Order: Project'),
'y', 'y',
array( array(
'project' => 'literal:y', 'project' => 'literal:y',
@ -50,7 +50,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
)); ));
$this->assertCommit( $this->assertCommit(
'Order: Global', pht('Order: Global'),
'y', 'y',
array( array(
'user' => 'literal:y', 'user' => 'literal:y',
@ -60,7 +60,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
public function testLegacyRule() { public function testLegacyRule() {
// 'global' should translate to 'user' // 'global' should translate to 'user'
$this->assertCommit( $this->assertCommit(
'"global" name', pht('"%s" name', 'global'),
'y', 'y',
array( array(
'runtime' => 'arc:global, arc:halt', 'runtime' => 'arc:global, arc:halt',
@ -71,7 +71,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
// 'args' should translate to 'runtime' // 'args' should translate to 'runtime'
$this->assertCommit( $this->assertCommit(
'"args" name', pht('"%s" name', 'args'),
'y', 'y',
array( array(
'runtime' => 'arc:project, literal:y', 'runtime' => 'arc:project, literal:y',
@ -84,7 +84,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
public function testHalt() { public function testHalt() {
// 'arc:halt' should halt all processing. // 'arc:halt' should halt all processing.
$this->assertCommit( $this->assertCommit(
'Halt', pht('Halt'),
null, null,
array( array(
'runtime' => 'arc:halt', 'runtime' => 'arc:halt',
@ -95,7 +95,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
public function testYield() { public function testYield() {
// 'arc:yield' should yield to other rulesets. // 'arc:yield' should yield to other rulesets.
$this->assertCommit( $this->assertCommit(
'Yield', pht('Yield'),
'xyz', 'xyz',
array( array(
'runtime' => 'arc:yield, literal:abc', 'runtime' => 'arc:yield, literal:abc',
@ -104,7 +104,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
// This one should return to 'runtime' after exhausting 'local'. // This one should return to 'runtime' after exhausting 'local'.
$this->assertCommit( $this->assertCommit(
'Yield + Return', pht('Yield + Return'),
'abc', 'abc',
array( array(
'runtime' => 'arc:yield, literal:abc', 'runtime' => 'arc:yield, literal:abc',
@ -115,7 +115,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
public function testJump() { public function testJump() {
// This should resolve to 'abc' without hitting any of the halts. // This should resolve to 'abc' without hitting any of the halts.
$this->assertCommit( $this->assertCommit(
'Jump', pht('Jump'),
'abc', 'abc',
array( array(
'runtime' => 'arc:project, arc:halt', 'runtime' => 'arc:project, arc:halt',
@ -128,7 +128,7 @@ final class ArcanistBaseCommitParserTestCase extends PhutilTestCase {
public function testJumpReturn() { public function testJumpReturn() {
// After jumping to project, we should return to 'runtime'. // After jumping to project, we should return to 'runtime'.
$this->assertCommit( $this->assertCommit(
'Jump Return', pht('Jump Return'),
'xyz', 'xyz',
array( array(
'runtime' => 'arc:project, literal:xyz', 'runtime' => 'arc:project, literal:xyz',

View file

@ -314,7 +314,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
// TODO: Remove the history lesson soon. // TODO: Remove the history lesson soon.
echo phutil_console_format( echo phutil_console_format(
"<bg:green>** Select a Default Commit Range **</bg>\n\n"); "<bg:green>** %s **</bg>\n\n",
pht('Select a Default Commit Range'));
echo phutil_console_wrap( echo phutil_console_wrap(
pht( pht(
"You're running a command which operates on a range of revisions ". "You're running a command which operates on a range of revisions ".
@ -973,7 +974,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
$branch); $branch);
if ($err) { if ($err) {
throw new ArcanistUsageException('Merge failed!'); throw new ArcanistUsageException(pht('Merge failed!'));
} }
} }

View file

@ -17,7 +17,7 @@ final class PhutilUnitTestEngine extends ArcanistUnitTestEngine {
} }
if (!$run_tests) { if (!$run_tests) {
throw new ArcanistNoEffectException('No tests to run.'); throw new ArcanistNoEffectException(pht('No tests to run.'));
} }
$enable_coverage = $this->getEnableCoverage(); $enable_coverage = $this->getEnableCoverage();

View file

@ -92,19 +92,19 @@ final class ArcanistUnitConsoleRenderer extends ArcanistUnitRenderer {
private function formatTime($seconds) { private function formatTime($seconds) {
if ($seconds >= 60) { if ($seconds >= 60) {
$minutes = floor($seconds / 60); $minutes = floor($seconds / 60);
return sprintf('%dm%02ds', $minutes, round($seconds % 60)); return pht('%dm%02ds', $minutes, round($seconds % 60));
} }
if ($seconds >= 1) { if ($seconds >= 1) {
return sprintf('%4.1fs', $seconds); return pht('%4.1fs', $seconds);
} }
$milliseconds = $seconds * 1000; $milliseconds = $seconds * 1000;
if ($milliseconds >= 1) { if ($milliseconds >= 1) {
return sprintf('%3dms', round($milliseconds)); return pht('%3dms', round($milliseconds));
} }
return ' <1ms'; return pht(' <%dms', 1);
} }
} }

View file

@ -170,7 +170,7 @@ EOTEXT
} }
if (!$repository_api->hasLocalCommit($commit_hash)) { if (!$repository_api->hasLocalCommit($commit_hash)) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
'Invalid commit provided or does not exist in the working copy!'); pht('Invalid commit provided or does not exist in the working copy!'));
} }
// Run 'backout'. // Run 'backout'.

View file

@ -252,7 +252,7 @@ EOTEXT
$prefix = pht( $prefix = pht(
'Revision includes changes to %s path(s) that do not exist:', 'Revision includes changes to %s path(s) that do not exist:',
new PhutilNumber(count($do_not_exist))); new PhutilNumber(count($do_not_exist)));
$prompt = 'Commit this revision anyway?'; $prompt = pht('Commit this revision anyway?');
$this->promptFileWarning($prefix, $prompt, $do_not_exist); $this->promptFileWarning($prefix, $prompt, $do_not_exist);
} }

File diff suppressed because it is too large Load diff

View file

@ -87,7 +87,7 @@ EOTEXT
)); ));
$bytes = number_format($info['byteSize']); $bytes = number_format($info['byteSize']);
$desc = '('.$bytes.' bytes)'; $desc = pht('(%d bytes)', $bytes);
if ($info['name']) { if ($info['name']) {
$desc = "'".$info['name']."' ".$desc; $desc = "'".$info['name']."' ".$desc;
} }

View file

@ -29,7 +29,7 @@ EOTEXT
public function getArguments() { public function getArguments() {
return array( return array(
'full' => array( 'full' => array(
'help' => 'Print detailed information about each command.', 'help' => pht('Print detailed information about each command.'),
), ),
'*' => 'command', '*' => 'command',
); );

View file

@ -30,7 +30,7 @@ EOTEXT
'current' => array( 'current' => array(
'param' => 'cursor_position', 'param' => 'cursor_position',
'paramtype' => 'int', 'paramtype' => 'int',
'help' => 'Current term in the argument list being completed.', 'help' => pht('Current term in the argument list being completed.'),
), ),
'*' => 'argv', '*' => 'argv',
); );

View file

@ -134,7 +134,7 @@ EOTEXT
'hg diff --rev %R', 'hg diff --rev %R',
hgsprintf('%s', $relative)); hgsprintf('%s', $relative));
} else { } else {
throw new Exception('Unknown VCS!'); throw new Exception(pht('Unknown VCS!'));
} }
echo phutil_console_wrap( echo phutil_console_wrap(
@ -193,7 +193,7 @@ EOTEXT
'copy:'))); 'copy:')));
if (empty($revisions)) { if (empty($revisions)) {
echo " (No revisions match.)\n"; echo " ".pht('(No revisions match.)')."\n";
echo "\n"; echo "\n";
echo phutil_console_wrap( echo phutil_console_wrap(
phutil_console_format( phutil_console_format(

View file

@ -1228,7 +1228,7 @@ abstract class ArcanistWorkflow extends Phobject {
$parser = $this->newDiffParser(); $parser = $this->newDiffParser();
$changes = $parser->parseDiff($diff); $changes = $parser->parseDiff($diff);
if (count($changes) != 1) { if (count($changes) != 1) {
throw new Exception('Expected exactly one change.'); throw new Exception(pht('Expected exactly one change.'));
} }
$this->changeCache[$path] = reset($changes); $this->changeCache[$path] = reset($changes);
} }
@ -1240,7 +1240,7 @@ abstract class ArcanistWorkflow extends Phobject {
} }
} }
} else { } else {
throw new Exception('Missing VCS support.'); throw new Exception(pht('Missing VCS support.'));
} }
if (empty($this->changeCache[$path])) { if (empty($this->changeCache[$path])) {
@ -1253,7 +1253,9 @@ abstract class ArcanistWorkflow extends Phobject {
return $change; return $change;
} else { } else {
throw new Exception( throw new Exception(
"Trying to get change for unchanged path '{$path}'!"); pht(
"Trying to get change for unchanged path '%s'!",
$path));
} }
} }
@ -1275,7 +1277,10 @@ abstract class ArcanistWorkflow extends Phobject {
$extended_info = ' '.$options['nosupport'][$system_name]; $extended_info = ' '.$options['nosupport'][$system_name];
} }
throw new ArcanistUsageException( throw new ArcanistUsageException(
"Option '--{$arg}' is not supported under {$system_name}.". pht(
"Option '%s' is not supported under %s.",
"--{$arg}",
$system_name).
$extended_info); $extended_info);
} }
} }
@ -1375,7 +1380,10 @@ abstract class ArcanistWorkflow extends Phobject {
foreach ($paths as $key => $path) { foreach ($paths as $key => $path) {
$full_path = Filesystem::resolvePath($path); $full_path = Filesystem::resolvePath($path);
if (!Filesystem::pathExists($full_path)) { if (!Filesystem::pathExists($full_path)) {
throw new ArcanistUsageException("Path '{$path}' does not exist!"); throw new ArcanistUsageException(
pht(
"Path '%s' does not exist!",
$path));
} }
$relative_path = Filesystem::readablePath( $relative_path = Filesystem::readablePath(
$full_path, $full_path,
@ -1600,10 +1608,12 @@ abstract class ArcanistWorkflow extends Phobject {
} catch (ConduitClientException $ex) { } catch (ConduitClientException $ex) {
if ($ex->getErrorCode() == 'ERR-CONDUIT-CALL') { if ($ex->getErrorCode() == 'ERR-CONDUIT-CALL') {
echo phutil_console_wrap( echo phutil_console_wrap(
"This feature requires a newer version of Phabricator. Please ". "%s\n\n",
"update it using these instructions: ". pht(
"http://www.phabricator.com/docs/phabricator/article/". 'This feature requires a newer version of Phabricator. Please '.
"Installation_Guide.html#updating-phabricator\n\n"); 'update it using these instructions: %s',
'http://www.phabricator.com/docs/phabricator/article/'.
'Installation_Guide.html#updating-phabricator'));
} }
throw $ex; throw $ex;
} }
@ -1628,13 +1638,14 @@ abstract class ArcanistWorkflow extends Phobject {
$api = $this->getRepositoryAPI(); $api = $this->getRepositoryAPI();
if (!$api->supportsCommitRanges()) { if (!$api->supportsCommitRanges()) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
'This version control system does not support commit ranges.'); pht('This version control system does not support commit ranges.'));
} }
if (count($argv) > 1) { if (count($argv) > 1) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
pht(
'Specify exactly one base commit. The end of the commit range is '. 'Specify exactly one base commit. The end of the commit range is '.
'always the working copy state.'); 'always the working copy state.'));
} }
$api->setBaseCommit(head($argv)); $api->setBaseCommit(head($argv));