Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistInstallCertificateWorkflow.php
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | if ($is_token_auth) { | ||||
throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
pht( | pht( | ||||
'The token "%s" is not formatted correctly. API tokens should '. | 'The token "%s" is not formatted correctly. API tokens should '. | ||||
'be 32 characters long. Make sure you visited the correct URI '. | 'be 32 characters long. Make sure you visited the correct URI '. | ||||
'and copy/pasted the token correctly.', | 'and copy/pasted the token correctly.', | ||||
$token)); | $token)); | ||||
} | } | ||||
if (strncmp($token, 'cli-', 4) !== 0) { | if (strncmp($token, 'api-', 4) == 0) { | ||||
echo pht( | |||||
'You are installing a standard API token, but a CLI API token '. | |||||
'was expected. If you\'re writing a script, consider passing the '. | |||||
'token at runtime with --conduit-token instead of installing it.'); | |||||
if (!phutil_console_confirm(pht('Install this token anyway?'))) { | |||||
throw new ArcanistUsageException(pht('Not installing API token.')); | |||||
epriestley: Use `pht()` here, to make these messages ("Install this..."), ("Not installing...")… | |||||
} | |||||
} else if (strncmp($token, 'cli-', 4) !== 0) { | |||||
throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
pht( | pht( | ||||
'The token "%s" is not formatted correctly. Valid API tokens '. | 'The token "%s" is not formatted correctly. Valid API tokens '. | ||||
'should begin "cli-" and be 32 characters long. Make sure you '. | 'should begin "cli-" and be 32 characters long. Make sure you '. | ||||
'visited the correct URI and copy/pasted the token correctly.', | 'visited the correct URI and copy/pasted the token correctly.', | ||||
$token)); | $token)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |
Use pht() here, to make these messages ("Install this..."), ("Not installing...") translatable.
See here for more details about error/exception translations, or the rest of this document for discussion of pht():
https://secure.phabricator.com/book/phabcontrib/article/internationalization/#exceptions-and-errors