1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-04 12:42:42 +01:00

Remove all product name literals in "pht()" in Arcanist

Summary:
Ref T13658. Remove all product name literals from "pht()" strings, by replacing them with generic text where that feels reasonably natural, or "PlatformSymbols" calls elsewhere.

These calls were identified with `arc lint --everything` after enabling the lint rule in D21763.

Test Plan: Read strings, ran "arc".

Maniphest Tasks: T13658

Differential Revision: https://secure.phabricator.com/D21764
This commit is contained in:
epriestley 2022-04-25 09:35:13 -07:00
parent a33aeb3c36
commit 93cf13cdb9
16 changed files with 83 additions and 77 deletions

View file

@ -68,7 +68,10 @@ $base_args->parsePartial(
array( array(
'name' => 'conduit-uri', 'name' => 'conduit-uri',
'param' => 'uri', 'param' => 'uri',
'help' => pht('Connect to Phabricator install specified by __uri__.'), 'help' => pht(
'Connect to the %s (or compatible software) server specified by '.
'__uri__.',
PlatformSymbols::getPlatformServerName()),
), ),
array( array(
'name' => 'conduit-token', 'name' => 'conduit-token',
@ -85,7 +88,8 @@ $base_args->parsePartial(
'repeat' => true, 'repeat' => true,
'help' => pht( 'help' => pht(
'Specify a runtime configuration value. This will take precedence '. 'Specify a runtime configuration value. This will take precedence '.
'over static values, and only affect the current arcanist invocation.'), 'over static values, and only affect the current process: the '.
'setting is not saved anywhere.'),
), ),
)); ));
@ -310,9 +314,13 @@ try {
$message = phutil_console_format( $message = phutil_console_format(
"%s\n\n - %s\n - %s\n - %s\n", "%s\n\n - %s\n - %s\n - %s\n",
pht( pht(
'This command requires arc to connect to a Phabricator install, '. 'This command requires %s to connect to a %s (or compatible '.
'but no Phabricator installation is configured. To configure a '. 'software) server, but no %s server is configured. To configure a '.
'Phabricator URI:'), '%s server URI:',
PlatformSymbols::getPlatformClientName(),
PlatformSymbols::getPlatformServerName(),
PlatformSymbols::getPlatformServerName(),
PlatformSymbols::getPlatformServerName()),
pht( pht(
'set a default location with `%s`; or', 'set a default location with `%s`; or',
'arc set-config default <uri>'), 'arc set-config default <uri>'),
@ -688,10 +696,12 @@ function arcanist_load_libraries(
"**<bg:yellow> %s </bg>** %s\n", "**<bg:yellow> %s </bg>** %s\n",
pht('VERY META'), pht('VERY META'),
pht( pht(
'You are running one copy of Arcanist (at path "%s") against '. 'You are running one copy of %s (at path "%s") against '.
'another copy of Arcanist (at path "%s"). Code in the current '. 'another copy of %s (at path "%s"). Code in the current '.
'working directory will not be loaded or executed.', 'working directory will not be loaded or executed.',
PlatformSymbols::getPlatformClientName(),
$executing_directory, $executing_directory,
PlatformSymbols::getPlatformClientName(),
$working_directory))); $working_directory)));
} }
} }

View file

@ -89,8 +89,8 @@ final class ArcanistConduitEngine
$block = id(new PhutilConsoleBlock()) $block = id(new PhutilConsoleBlock())
->addParagraph( ->addParagraph(
pht( pht(
'This command needs to communicate with Phabricator, but no '. 'This command needs to communicate with a server, but no '.
'Phabricator URI is configured.')) 'server URI is configured.'))
->addList($list); ->addList($list);
throw new ArcanistUsageException($block->drawConsoleString()); throw new ArcanistUsageException($block->drawConsoleString());

View file

@ -71,10 +71,10 @@ final class ArcanistArcConfigurationEngineExtension
->setSummary(pht('Repository for the current working copy.')) ->setSummary(pht('Repository for the current working copy.'))
->setHelp( ->setHelp(
pht( pht(
'Associate the working copy with a specific Phabricator '. 'Associate the working copy with a specific repository. Normally, '.
'repository. Normally, Arcanist can figure this association '. 'this association can be determined automatically, but if your '.
'out on its own, but if your setup is unusual you can use '. 'setup is unusual you can use this option to tell it what the '.
'this option to tell it what the desired value is.')) 'desired value is.'))
->setExamples( ->setExamples(
array( array(
'libexample', 'libexample',
@ -89,14 +89,15 @@ final class ArcanistArcConfigurationEngineExtension
'conduit_uri', 'conduit_uri',
'default', 'default',
)) ))
->setSummary(pht('Phabricator install to connect to.')) ->setSummary(pht('Server to connect to.'))
->setHelp( ->setHelp(
pht( pht(
'Associates this working copy with a specific installation of '. 'Associates this working copy with a specific installation of '.
'Phabricator.')) '%s (or compatible software).',
PlatformSymbols::getPlatformServerName()))
->setExamples( ->setExamples(
array( array(
'https://phabricator.mycompany.com/', 'https://devtools.example.com/',
)), )),
id(new ArcanistAliasesConfigOption()) id(new ArcanistAliasesConfigOption())
->setKey(self::KEY_ALIASES) ->setKey(self::KEY_ALIASES)

View file

@ -15,7 +15,7 @@ final class ArcanistBlindlyTrustHTTPEngineExtension
} }
public function getExtensionName() { public function getExtensionName() {
return pht('Arcanist HTTPS Trusted Domains'); return pht('HTTPS Trusted Domains');
} }
public function shouldTrustAnySSLAuthorityForURI(PhutilURI $uri) { public function shouldTrustAnySSLAuthorityForURI(PhutilURI $uri) {

View file

@ -42,12 +42,13 @@ final class PhutilEmailAddress extends Phobject {
public function __toString() { public function __toString() {
$address = $this->getAddress(); $address = $this->getAddress();
if (strlen($this->displayName)) {
if (phutil_nonempty_string($this->displayName)) {
$display_name = $this->encodeDisplayName($this->displayName); $display_name = $this->encodeDisplayName($this->displayName);
return $display_name.' <'.$address.'>'; return $display_name.' <'.$address.'>';
} else {
return $address;
} }
return $address;
} }
public function setDisplayName($display_name) { public function setDisplayName($display_name) {

View file

@ -9,7 +9,7 @@ final class ArcanistArcToolset extends ArcanistToolset {
array( array(
'name' => 'conduit-uri', 'name' => 'conduit-uri',
'param' => 'uri', 'param' => 'uri',
'help' => pht('Connect to Phabricator install specified by __uri__.'), 'help' => pht('Connect to server specified by __uri__.'),
), ),
array( array(
'name' => 'conduit-token', 'name' => 'conduit-token',

View file

@ -14,7 +14,7 @@ final class ArcanistShellCompleteWorkflow
public function getWorkflowInformation() { public function getWorkflowInformation() {
$help = pht(<<<EOTEXT $help = pht(<<<EOTEXT
Install shell completion so you can use the "tab" key to autocomplete Install shell completion so you can use the "tab" key to autocomplete
commands and flags in your shell for Arcanist toolsets and workflows. commands and flags in your shell for toolsets and workflows.
The **bash** shell is supported. The **bash** shell is supported.
@ -28,7 +28,7 @@ This will install shell completion into your current shell. After installing,
you may need to start a new shell (or open a new terminal window) to pick up you may need to start a new shell (or open a new terminal window) to pick up
the updated configuration. the updated configuration.
Once installed, completion should work across all Arcanist toolsets. Once installed, completion should work across all toolsets.
**Using Completion** **Using Completion**
@ -53,9 +53,9 @@ You can update shell completion without reinstalling it by running:
You may need to update shell completion if: You may need to update shell completion if:
- you install new Arcanist toolsets; or - you install new toolsets; or
- you move the Arcanist directory; or - you move this software on disk; or
- you upgrade Arcanist and the new version fixes shell completion bugs. - you upgrade this software and the new version fixes shell completion bugs.
EOTEXT EOTEXT
); );

View file

@ -141,7 +141,7 @@ function phutil_format_units_generic(
$scale = array_shift($scales); $scale = array_shift($scales);
$label = array_shift($labels); $label = array_shift($labels);
while ($n >= $scale && count($labels)) { while ($n >= $scale && count($labels)) {
$remainder += ($n % $scale) * $accum; $remainder += ((int)$n % $scale) * $accum;
$n /= $scale; $n /= $scale;
$accum *= $scale; $accum *= $scale;
$label = array_shift($labels); $label = array_shift($labels);

View file

@ -15,8 +15,7 @@ Allows you to make a raw Conduit method call:
- Call parameters are required, and read as a JSON blob from stdin. - Call parameters are required, and read as a JSON blob from stdin.
- Results are written to stdout as a JSON blob. - Results are written to stdout as a JSON blob.
This workflow is primarily useful for writing scripts which integrate This workflow is primarily useful for writing scripts. Examples:
with Phabricator. Examples:
$ echo '{}' | arc call-conduit -- conduit.ping $ echo '{}' | arc call-conduit -- conduit.ping
$ echo '{"phid":"PHID-FILE-xxxx"}' | arc call-conduit -- file.download $ echo '{"phid":"PHID-FILE-xxxx"}' | arc call-conduit -- file.download

View file

@ -115,8 +115,7 @@ EOTEXT
'raw' => array( 'raw' => array(
'help' => pht( 'help' => pht(
'Read diff from stdin, not from the working copy. This disables '. 'Read diff from stdin, not from the working copy. This disables '.
'many Arcanist/Phabricator features which depend on having access '. 'many features which depend on having access to the working copy.'),
'to the working copy.'),
'conflicts' => array( 'conflicts' => array(
'apply-patches' => pht('%s disables lint.', '--raw'), 'apply-patches' => pht('%s disables lint.', '--raw'),
'never-apply-patches' => pht('%s disables lint.', '--raw'), 'never-apply-patches' => pht('%s disables lint.', '--raw'),
@ -138,8 +137,8 @@ EOTEXT
'param' => 'command', 'param' => 'command',
'help' => pht( 'help' => pht(
'Generate diff by executing a specified command, not from the '. 'Generate diff by executing a specified command, not from the '.
'working copy. This disables many Arcanist/Phabricator features '. 'working copy. This disables many features which depend on having '.
'which depend on having access to the working copy.'), 'access to the working copy.'),
'conflicts' => array( 'conflicts' => array(
'apply-patches' => pht('%s disables lint.', '--raw-command'), 'apply-patches' => pht('%s disables lint.', '--raw-command'),
'never-apply-patches' => pht('%s disables lint.', '--raw-command'), 'never-apply-patches' => pht('%s disables lint.', '--raw-command'),
@ -326,9 +325,8 @@ EOTEXT
'head' => array( 'head' => array(
'param' => 'commit', 'param' => 'commit',
'help' => pht( 'help' => pht(
'Specify the end of the commit range. This disables many '. 'Specify the end of the commit range. This disables many features '.
'Arcanist/Phabricator features which depend on having access to '. 'which depend on having access to the working copy.'),
'the working copy.'),
'supports' => array('git'), 'supports' => array('git'),
'nosupport' => array( 'nosupport' => array(
'svn' => pht('Subversion does not support commit ranges.'), 'svn' => pht('Subversion does not support commit ranges.'),
@ -517,7 +515,7 @@ EOTEXT
if ($is_draft) { if ($is_draft) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
pht( pht(
'You have specified "--draft", but the version of Phabricator '. 'You have specified "--draft", but the software version '.
'on the server is too old to support draft revisions. Omit '. 'on the server is too old to support draft revisions. Omit '.
'the flag or upgrade the server software.')); 'the flag or upgrade the server software.'));
} }
@ -949,7 +947,7 @@ EOTEXT
} catch (ConduitClientException $e) { } catch (ConduitClientException $e) {
if ($e->getErrorCode() == 'ERR-BAD-ARCANIST-PROJECT') { if ($e->getErrorCode() == 'ERR-BAD-ARCANIST-PROJECT') {
echo phutil_console_wrap( echo phutil_console_wrap(
pht('Lookup of encoding in arcanist project failed: %s', pht('Lookup of encoding in project failed: %s',
$e->getMessage())."\n"); $e->getMessage())."\n");
} else { } else {
throw $e; throw $e;
@ -990,10 +988,10 @@ EOTEXT
'these files will be marked as binary.', 'these files will be marked as binary.',
phutil_count($utf8_problems)), phutil_count($utf8_problems)),
pht( pht(
"You can learn more about how Phabricator handles character ". "You can learn more about how this software handles character ".
"encodings (and how to configure encoding settings and detect and ". "encodings (and how to configure encoding settings and detect and ".
"correct encoding problems) by reading 'User Guide: UTF-8 and ". "correct encoding problems) by reading 'User Guide: UTF-8 and ".
"Character Encoding' in the Phabricator documentation."), "Character Encoding' in the documentation."),
pht( pht(
'%s AFFECTED FILE(S)', '%s AFFECTED FILE(S)',
phutil_count($utf8_problems))); phutil_count($utf8_problems)));
@ -2652,7 +2650,7 @@ EOTEXT
if (!$supported) { if (!$supported) {
$this->writeInfo( $this->writeInfo(
pht('SKIP STAGING'), pht('SKIP STAGING'),
pht('Phabricator does not support staging areas for this repository.')); pht('The server does not support staging areas for this repository.'));
return self::STAGING_REPOSITORY_UNSUPPORTED; return self::STAGING_REPOSITORY_UNSUPPORTED;
} }

View file

@ -19,12 +19,12 @@ EOTEXT
public function getCommandHelp() { public function getCommandHelp() {
return phutil_console_format(<<<EOTEXT return phutil_console_format(<<<EOTEXT
Supports: http, https Supports: http, https
Installs Conduit credentials into your ~/.arcrc for the given install Installs Conduit credentials into your ~/.arcrc for the given server.
of Phabricator. You need to do this before you can use 'arc', as it You need to do this before you can use 'arc', as it enables 'arc' to
enables 'arc' to link your command-line activity with your account on link your command-line activity with your account on the web. Run
the web. Run this command from within a project directory to install this command from within a project directory to install that
that project's certificate, or specify an explicit URI (like project's certificate, or specify an explicit URI (like
"https://phabricator.example.com/"). "https://devtools.example.com/").
EOTEXT EOTEXT
); );
} }
@ -91,12 +91,11 @@ EOTEXT
// Ignore. // Ignore.
} }
echo phutil_console_format("**%s**\n", pht('LOGIN TO PHABRICATOR')); echo phutil_console_format("**%s**\n", pht('LOG IN'));
echo phutil_console_format( echo phutil_console_format(
"%s\n\n%s\n\n%s", "%s\n\n%s\n\n%s",
pht( pht(
'Open this page in your browser and login to '. 'Open this page in your browser and log in if necessary:'),
'Phabricator if necessary:'),
$token_uri, $token_uri,
pht('Then paste the API Token on that page below.')); pht('Then paste the API Token on that page below.'));
@ -204,7 +203,7 @@ EOTEXT
$uri = $conduit_uri; $uri = $conduit_uri;
} }
$example = 'https://phabricator.example.com/'; $example = 'https://devtools.example.com/';
$uri_object = new PhutilURI($uri); $uri_object = new PhutilURI($uri);
$protocol = $uri_object->getProtocol(); $protocol = $uri_object->getProtocol();

View file

@ -11,13 +11,13 @@ final class ArcanistLiberateWorkflow
// TOOLSETS: Expand this help. // TOOLSETS: Expand this help.
$help = pht(<<<EOTEXT $help = pht(<<<EOTEXT
Create or update an Arcanist library. Create or update a library.
EOTEXT EOTEXT
); );
return $this->newWorkflowInformation() return $this->newWorkflowInformation()
->setSynopsis( ->setSynopsis(
pht('Create or update an Arcanist library.')) pht('Create or update a library.'))
->addExample(pht('**liberate**')) ->addExample(pht('**liberate**'))
->addExample(pht('**liberate** [__path__]')) ->addExample(pht('**liberate** [__path__]'))
->setHelp($help); ->setHelp($help);

View file

@ -9,12 +9,12 @@ final class ArcanistUpgradeWorkflow
public function getWorkflowInformation() { public function getWorkflowInformation() {
$help = pht(<<<EOTEXT $help = pht(<<<EOTEXT
Upgrade Arcanist to the latest version. Upgrade this program to the latest version.
EOTEXT EOTEXT
); );
return $this->newWorkflowInformation() return $this->newWorkflowInformation()
->setSynopsis(pht('Upgrade Arcanist to the latest version.')) ->setSynopsis(pht('Upgrade this program to the latest version.'))
->addExample(pht('**upgrade**')) ->addExample(pht('**upgrade**'))
->setHelp($help); ->setHelp($help);
} }
@ -51,10 +51,10 @@ EOTEXT
if (!$is_git) { if (!$is_git) {
throw new PhutilArgumentUsageException( throw new PhutilArgumentUsageException(
pht( pht(
'The "arc upgrade" workflow uses "git pull" to upgrade '. 'The "arc upgrade" workflow uses "git pull" to upgrade, but '.
'Arcanist, but the "arcanist/" directory (in "%s") is not a Git '. 'the "arcanist/" directory (in "%s") is not a Git working '.
'working copy. You must leave "arcanist/" as a Git '. 'copy. You must leave "arcanist/" as a Git working copy to '.
'working copy to use "arc upgrade".', 'use "arc upgrade".',
$root)); $root));
} }
@ -125,7 +125,7 @@ EOTEXT
$log->writeSuccess( $log->writeSuccess(
pht('UPGRADED'), pht('UPGRADED'),
pht('Your copy of Arcanist is now up to date.')); pht('This software is now up to date.'));
return 0; return 0;
} }

View file

@ -9,7 +9,7 @@ final class ArcanistUploadWorkflow
public function getWorkflowInformation() { public function getWorkflowInformation() {
$help = pht(<<<EOTEXT $help = pht(<<<EOTEXT
Upload one or more files from local disk to Phabricator. Upload one or more files from local disk.
EOTEXT EOTEXT
); );

View file

@ -28,15 +28,15 @@ The __symbol__ may be a branch or bookmark name, a revision name (like "D123"),
a task name (like "T123"), or a new symbol. a task name (like "T123"), or a new symbol.
If you provide a symbol which currently does not identify any ongoing work, If you provide a symbol which currently does not identify any ongoing work,
Arcanist will create a new branch or bookmark with the name you provide. a new branch or bookmark will be created with the name you provide.
If you provide the name of an existing branch or bookmark, Arcanist will switch If you provide the name of an existing branch or bookmark, the working copy
to that branch or bookmark. will be switched to that branch or bookmark.
If you provide the name of a revision or task, Arcanist will look for a related If you provide the name of a revision or task, the workflow will look for a
branch or bookmark that exists in the working copy. If it finds one, it will related branch or bookmark that already exists in the working copy. If one is
switch to it. If it does not find one, it will attempt to create a new branch found, it will switch to it. If it does not find one, it will attempt to create
or bookmark. a new branch or bookmark.
When "arc work" creates a branch or bookmark, it will use **--start** as the When "arc work" creates a branch or bookmark, it will use **--start** as the
branchpoint if it is provided. Otherwise, the current working copy state will branchpoint if it is provided. Otherwise, the current working copy state will

View file

@ -534,7 +534,7 @@ abstract class ArcanistWorkflow extends Phobject {
$conduit_uri = $this->conduitURI; $conduit_uri = $this->conduitURI;
$message = phutil_console_format( $message = phutil_console_format(
"\n%s\n\n %s\n\n%s\n%s", "\n%s\n\n %s\n\n%s\n%s",
pht('YOU NEED TO __INSTALL A CERTIFICATE__ TO LOGIN TO PHABRICATOR'), pht('YOU NEED TO __INSTALL A CERTIFICATE__ TO LOG IN'),
pht('To do this, run: **%s**', 'arc install-certificate'), pht('To do this, run: **%s**', 'arc install-certificate'),
pht("The server '%s' rejected your request:", $conduit_uri), pht("The server '%s' rejected your request:", $conduit_uri),
$ex->getMessage()); $ex->getMessage());
@ -1957,11 +1957,10 @@ abstract class ArcanistWorkflow extends Phobject {
} catch (ConduitClientException $ex) { } catch (ConduitClientException $ex) {
if ($ex->getErrorCode() == 'ERR-CONDUIT-CALL') { if ($ex->getErrorCode() == 'ERR-CONDUIT-CALL') {
$reasons[] = pht( $reasons[] = pht(
'This version of Arcanist is more recent than the version of '. 'This software version on the server you are connecting to is out '.
'Phabricator you are connecting to: the Phabricator install is '. 'of date and does not have support for identifying repositories '.
'out of date and does not have support for identifying '. 'by callsign or URI. Update the server sofwware to enable these '.
'repositories by callsign or URI. Update Phabricator to enable '. 'features.');
'these features.');
return array(null, $reasons); return array(null, $reasons);
} }
throw $ex; throw $ex;
@ -2204,9 +2203,8 @@ abstract class ArcanistWorkflow extends Phobject {
throw new ArcanistUsageException( throw new ArcanistUsageException(
pht( pht(
"Unable to find a browser command to run. Set '%s' in your ". 'Unable to find a browser command to run. Set "browser" in your '.
"Arcanist config to specify a command to use.", 'configuration to specify a command to use.'));
'browser'));
} }