From 0584d4a06f533c3ab9654216ee201d2a0dd699e0 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 3 Feb 2015 06:54:46 +1100 Subject: [PATCH] `pht`ize strings in `ArcanistSettings` Summary: Self-explanatory. Test Plan: Eyeball it. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D11610 --- src/configuration/ArcanistSettings.php | 141 ++++++++++++++----------- 1 file changed, 80 insertions(+), 61 deletions(-) diff --git a/src/configuration/ArcanistSettings.php b/src/configuration/ArcanistSettings.php index b4c54a9f..ad5f7626 100644 --- a/src/configuration/ArcanistSettings.php +++ b/src/configuration/ArcanistSettings.php @@ -6,38 +6,40 @@ final class ArcanistSettings { return array( 'default' => array( 'type' => 'string', - 'help' => + 'help' => pht( 'The URI of a Phabricator install to connect to by default, if '. - 'arc is run in a project without a Phabricator URI or run outside '. + '%s is run in a project without a Phabricator URI or run outside '. 'of a project.', + 'arc'), 'example' => '"http://phabricator.example.com/"', ), 'base' => array( 'type' => 'string', - 'help' => + 'help' => pht( 'Base commit ruleset to invoke when determining the start of a '. 'commit range. See "Arcanist User Guide: Commit Ranges" for '. - 'details.', + 'details.'), 'example' => '"arc:amended, arc:prompt"', ), 'load' => array( 'type' => 'list', 'legacy' => 'phutil_libraries', - 'help' => + 'help' => pht( 'A list of paths to phutil libraries that should be loaded at '. - 'startup. This can be used to make classes available, like lint or '. - 'unit test engines.', - 'example' => '["/var/arc/customlib/src"]', + 'startup. This can be used to make classes available, like lint '. + 'or unit test engines.'), 'default' => array(), + 'example' => '["/var/arc/customlib/src"]', ), 'repository.callsign' => array( 'type' => 'string', 'example' => '"X"', 'help' => pht( 'Associate the working copy with a specific Phabricator repository. '. - 'Normally, arc can figure this association out on its own, but if '. + 'Normally, %s can figure this association out on its own, but if '. 'your setup is unusual you can use this option to tell it what the '. - 'desired value is.'), + 'desired value is.', + 'arc'), ), 'phabricator.uri' => array( 'type' => 'string', @@ -59,116 +61,122 @@ final class ArcanistSettings { 'lint.engine' => array( 'type' => 'string', 'legacy' => 'lint_engine', - 'help' => + 'help' => pht( 'The name of a default lint engine to use, if no lint engine is '. - 'specified by the current project.', + 'specified by the current project.'), 'example' => '"ExampleLintEngine"', ), 'unit.engine' => array( 'type' => 'string', 'legacy' => 'unit_engine', - 'help' => + 'help' => pht( 'The name of a default unit test engine to use, if no unit test '. - 'engine is specified by the current project.', + 'engine is specified by the current project.'), 'example' => '"ExampleUnitTestEngine"', ), 'arc.feature.start.default' => array( 'type' => 'string', - 'help' => + 'help' => pht( 'The name of the default branch to create the new feature branch '. - 'off of.', + 'off of.'), 'example' => '"develop"', ), 'arc.land.onto.default' => array( 'type' => 'string', - 'help' => + 'help' => pht( 'The name of the default branch to land changes onto when '. - '`arc land` is run.', + '`%s` is run.', + 'arc land'), 'example' => '"develop"', ), 'arc.land.update.default' => array( 'type' => 'string', - 'help' => + 'help' => pht( 'The default strategy to use when arc land updates the feature '. - 'branch. Supports \'rebase\' and \'merge\' strategies.', + 'branch. Supports "rebase" and "merge" strategies.'), 'example' => '"rebase"', ), 'arc.lint.cache' => array( 'type' => 'bool', - 'help' => - "Enable the lint cache by default. When enabled, 'arc lint' ". - "attempts to use cached results if possible. Currently, the cache ". - "is not always invalidated correctly and may cause 'arc lint' to ". - "report incorrect results, particularly while developing linters. ". - "This is probably worth enabling only if your linters are very slow.", - 'example' => 'false', + 'help' => pht( + 'Enable the lint cache by default. When enabled, `%s` attempts to '. + 'use cached results if possible. Currently, the cache is not always '. + 'invalidated correctly and may cause `%s` to report incorrect '. + 'results, particularly while developing linters. This is probably '. + 'worth enabling only if your linters are very slow.', + 'arc lint', + 'arc lint'), 'default' => false, + 'example' => 'false', ), 'history.immutable' => array( 'type' => 'bool', 'legacy' => 'immutable_history', - 'help' => - 'If true, arc will never change repository history (e.g., through '. + 'help' => pht( + 'If true, %s will never change repository history (e.g., through '. 'amending or rebasing). Defaults to true in Mercurial and false in '. 'Git. This setting has no effect in Subversion.', + 'arc'), 'example' => 'false', ), 'editor' => array( 'type' => 'string', - 'help' => - "Command to use to invoke an interactive editor, like 'nano' or ". - "'vim'. This setting overrides the EDITOR environmental variable.", + 'help' => pht( + 'Command to use to invoke an interactive editor, like `%s` or `%s`. '. + 'This setting overrides the %s environmental variable.', + 'nano', + 'vim', + 'EDITOR'), 'example' => '"nano"', ), 'https.cabundle' => array( 'type' => 'string', - 'help' => + 'help' => pht( "Path to a custom CA bundle file to be used for arcanist's cURL ". "calls. This is used primarily when your conduit endpoint is ". - "behind https signed by your organization's internal CA.", + "behind HTTPS signed by your organization's internal CA."), 'example' => 'support/yourca.pem', ), 'https.blindly-trust-domains' => array( 'type' => 'list', - 'help' => 'List of domains to blindly trust SSL certificates for. '. - 'Disables peer verification.', - 'example' => '["secure.mycompany.com"]', + 'help' => pht( + 'List of domains to blindly trust SSL certificates for. '. + 'Disables peer verification.'), 'default' => array(), + 'example' => '["secure.mycompany.com"]', ), 'browser' => array( 'type' => 'string', - 'help' => - 'Command to use to invoke a web browser.', + 'help' => pht('Command to use to invoke a web browser.'), 'example' => '"gnome-www-browser"', ), 'events.listeners' => array( 'type' => 'list', - 'help' => 'List of event listener classes to install at startup.', - 'example' => '["ExampleEventListener"]', + 'help' => pht('List of event listener classes to install at startup.'), 'default' => array(), + 'example' => '["ExampleEventListener"]', ), 'http.basicauth.user' => array( 'type' => 'string', - 'help' => - 'Username to use for basic auth over http transports', + 'help' => pht('Username to use for basic auth over HTTP transports.'), 'example' => '"bob"', ), 'http.basicauth.pass' => array( 'type' => 'string', - 'help' => - 'Password to use for basic auth over http transports', + 'help' => pht('Password to use for basic auth over HTTP transports.'), 'example' => '"bobhasasecret"', ), 'arc.autostash' => array( 'type' => 'bool', - 'help' => - 'Whether arc should permit the automatic stashing of changes in '. - 'the working directory when requiring a clean working copy. '. - 'This option should only be used when users understand how '. - 'to restore their working directory from the local stash if '. - 'an Arcanist operation causes an unrecoverable error.', - 'example' => 'false', + 'help' => pht( + 'Whether %s should permit the automatic stashing of changes in the '. + 'working directory when requiring a clean working copy. This option '. + 'should only be used when users understand how to restore their '. + 'working directory from the local stash if an Arcanist operation '. + 'causes an unrecoverable error.', + 'arc'), 'default' => false, + 'example' => 'false', ), ); } @@ -228,8 +236,9 @@ final class ArcanistSettings { $value = true; } else { throw new ArcanistUsageException( - "Type of setting '{$key}' must be boolean, like 'true' or ". - "'false'."); + pht( + "Type of setting '%s' must be boolean, like 'true' or 'false'.", + $key)); } break; case 'list': @@ -245,15 +254,19 @@ final class ArcanistSettings { } } - $list_example = '["apple", "banana", "cherry"]'; throw new ArcanistUsageException( - "Type of setting '{$key}' must be list. You can specify a list ". - "in JSON, like: {$list_example}"); + pht( + "Type of setting '%s' must be list. You can specify a list ". + "in JSON, like: %s", + $key, + '["apple", "banana", "cherry"]')); case 'string': if (!is_scalar($value)) { throw new ArcanistUsageException( - "Type of setting '{$key}' must be string."); + pht( + "Type of setting '%s' must be string.", + $key)); } $value = (string)$value; break; @@ -270,19 +283,25 @@ final class ArcanistSettings { case 'string': if (!is_string($value)) { throw new ArcanistUsageException( - "Type of setting '{$key}' must be string."); + pht( + "Type of setting '%s' must be string.", + $key)); } break; case 'bool': if ($value !== true && $value !== false) { throw new ArcanistUsageException( - "Type of setting '{$key}' must be boolean."); + pht( + "Type of setting '%s' must be boolean.", + $key)); } break; case 'list': if (!is_array($value)) { throw new ArcanistUsageException( - "Type of setting '{$key}' must be list."); + pht( + "Type of setting '%s' must be list.", + $key)); } break; case 'wild':