1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Correct a mangled translation string in "bin/phd log --id X"

Summary:
Ref T13210. See PHI930. This translation is wrong: the parameter is a comma-separated list as a string, but the USEnglish translation provides alternatives. We can't select among alternatives based on a random string (it isn't a plurality value to let us select "chair" vs "chairs", and isn't a gender value to let us select "his profile" vs "her profile") so we get an error.

But the string itself is also misleading, since "bin/phd log --id A --id B --id C" will say "none of these are valid" if //any// of them are invalid.

Instead, just tell the user explicitly about the first problem.

Test Plan:
  - Ran `bin/phd log --id` with good (got logs) and bad IDs (got sensible error).
  - Ran `bin/phd log` with any logs (got logs) and (simluated) without any logs (got error).

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13210

Differential Revision: https://secure.phabricator.com/D19755
This commit is contained in:
epriestley 2018-10-24 09:38:29 -07:00
parent 5f3a7cb41b
commit a7c008708d
2 changed files with 12 additions and 11 deletions

View file

@ -40,16 +40,21 @@ final class PhabricatorDaemonManagementLogWorkflow
$query->withIDs($ids);
}
$daemons = $query->execute();
$daemons = mpull($daemons, null, 'getID');
if (!$daemons) {
if ($ids) {
foreach ($ids as $id) {
if (!isset($daemons[$id])) {
throw new PhutilArgumentUsageException(
pht('No daemon(s) with id(s) "%s" exist!', implode(', ', $ids)));
} else {
throw new PhutilArgumentUsageException(
pht('No daemons are running.'));
pht(
'No log record exists for a daemon with ID "%s".',
$id));
}
}
} else if (!$daemons) {
throw new PhutilArgumentUsageException(
pht('No log records exist for any daemons.'));
}
$console = PhutilConsole::getConsole();

View file

@ -9,10 +9,6 @@ final class PhabricatorUSEnglishTranslation
protected function getTranslations() {
return array(
'No daemon(s) with id(s) "%s" exist!' => array(
'No daemon with id %s exists!',
'No daemons with ids %s exist!',
),
'These %d configuration value(s) are related:' => array(
'This configuration value is related:',
'These configuration values are related:',