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

@ -46,8 +46,8 @@ if (getenv('ARC_PHUTIL_PATH')) {
}
if (!@constant('__LIBPHUTIL__')) {
echo "ERROR: Unable to load libphutil. Put libphutil/ next to arcanist/, or ".
"update your PHP 'include_path' to include the parent directory of ".
"libphutil/, or symlink libphutil/ into arcanist/externals/includes/.\n";
"update your PHP 'include_path' to include the parent directory of ".
"libphutil/, or symlink libphutil/ into arcanist/externals/includes/.\n";
exit(1);
}

View file

@ -94,7 +94,7 @@ final class ArcanistDiffUtilsTestCase extends PhutilTestCase {
ArcanistDiffUtils::generateEditString(
str_split($test[0]),
str_split($test[1])),
"'{$test[0]}' vs '{$test[1]}'");
pht("'%s' vs '%s'", $test[0], $test[1]));
}
$utf8_tests = array(
@ -111,7 +111,7 @@ final class ArcanistDiffUtilsTestCase extends PhutilTestCase {
ArcanistDiffUtils::generateEditString(
phutil_utf8v_combined($test[0]),
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?',
),
'(To ignore these %s change(s), add them to ".git/info/exclude".)' =>
array(
'(To ignore this change, add it to ".git/info/exclude".)',
'(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".)',
'(To ignore these %s change(s), add them to "%s".)' => array(
'(To ignore this change, add it to "%s".)',
'(To ignore these changes, add them to "%s".)',
),
'%s line(s)' => array('line', 'lines'),

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -29,19 +29,19 @@ final class ArcanistXHPASTLintNamingHookTestCase
$this->assertEqual(
$expect[0],
ArcanistXHPASTLintNamingHook::isUpperCamelCase($test),
"UpperCamelCase: '{$test}'");
pht("UpperCamelCase: '%s'", $test));
$this->assertEqual(
$expect[1],
ArcanistXHPASTLintNamingHook::isLowerCamelCase($test),
"lowerCamelCase: '{$test}'");
pht("lowerCamelCase: '%s'", $test));
$this->assertEqual(
$expect[2],
ArcanistXHPASTLintNamingHook::isUppercaseWithUnderscores($test),
"UPPERCASE_WITH_UNDERSCORES: '{$test}'");
pht("UPPERCASE_WITH_UNDERSCORES: '%s'", $test));
$this->assertEqual(
$expect[3],
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() {
if ($this->text === null) {
throw new Exception('Not parsing!');
throw new Exception(pht('Not parsing!'));
}
if (isset($this->text[$this->line])) {
return $this->text[$this->line];
@ -1205,14 +1205,14 @@ final class ArcanistDiffParser {
}
$out = array();
$out[] = "Diff Parse Exception: {$message}";
$out[] = pht('Diff Parse Exception: %s', $message);
if ($this->writeDiffOnFailure) {
$temp = new TempFile();
$temp->setPreserveFile(true);
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;

View file

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

View file

@ -314,7 +314,8 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
// TODO: Remove the history lesson soon.
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(
pht(
"You're running a command which operates on a range of revisions ".
@ -973,7 +974,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
$branch);
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) {
throw new ArcanistNoEffectException('No tests to run.');
throw new ArcanistNoEffectException(pht('No tests to run.'));
}
$enable_coverage = $this->getEnableCoverage();

View file

@ -53,17 +53,17 @@ final class ArcanistPhpunitTestResultParser extends ArcanistTestResultParser {
$user_data .= idx($event, 'message')."\n";
foreach (idx($event, 'trace') as $trace) {
$user_data .= sprintf(
"\n%s:%s",
idx($trace, 'file'),
idx($trace, 'line'));
"\n%s:%s",
idx($trace, 'file'),
idx($trace, 'line'));
}
} else if ('error' == idx($event, 'status')) {
if (strpos(idx($event, 'message'), 'Skipped Test') !== false) {
$status = ArcanistUnitTestResult::RESULT_SKIP;
$user_data .= idx($event, 'message');
} else if (strpos(
idx($event, 'message'),
'Incomplete Test') !== false) {
idx($event, 'message'),
'Incomplete Test') !== false) {
$status = ArcanistUnitTestResult::RESULT_SKIP;
$user_data .= idx($event, 'message');
} else {
@ -71,9 +71,9 @@ final class ArcanistPhpunitTestResultParser extends ArcanistTestResultParser {
$user_data .= idx($event, 'message');
foreach (idx($event, 'trace') as $trace) {
$user_data .= sprintf(
"\n%s:%s",
idx($trace, 'file'),
idx($trace, 'line'));
"\n%s:%s",
idx($trace, 'file'),
idx($trace, 'line'));
}
}
}

View file

@ -92,19 +92,19 @@ final class ArcanistUnitConsoleRenderer extends ArcanistUnitRenderer {
private function formatTime($seconds) {
if ($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) {
return sprintf('%4.1fs', $seconds);
return pht('%4.1fs', $seconds);
}
$milliseconds = $seconds * 1000;
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)) {
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'.

View file

@ -252,7 +252,7 @@ EOTEXT
$prefix = pht(
'Revision includes changes to %s path(s) that 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);
}

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

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

View file

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