mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-08 16:02:39 +01:00
Fix pht
method calls
Summary: Ref T7046. This is mainly a proof-of-concept for D11661. Test Plan: `arc lint` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T7046 Differential Revision: https://secure.phabricator.com/D11683
This commit is contained in:
parent
d8ba7e6f71
commit
17ec3859cd
6 changed files with 38 additions and 34 deletions
|
@ -53,20 +53,21 @@ if (!@constant('__LIBPHUTIL__')) {
|
||||||
|
|
||||||
PhutilTranslator::getInstance()
|
PhutilTranslator::getInstance()
|
||||||
->addTranslations(array(
|
->addTranslations(array(
|
||||||
'Locally modified path(s) are not included in this revision:' => array(
|
'%s locally modified path(s) are not included in this revision:' => array(
|
||||||
'A locally modified path is not included in this revision:',
|
'A locally modified path is not included in this revision:',
|
||||||
'Locally modified paths are not included in this revision:',
|
'Locally modified paths are not included in this revision:',
|
||||||
),
|
),
|
||||||
'They will NOT be committed. Commit this revision anyway?' => array(
|
'These %s path(s) will NOT be committed. Commit this revision '.
|
||||||
'It will NOT be committed. Commit this revision anyway?',
|
'anyway?' => array(
|
||||||
'They will NOT be committed. Commit this revision anyway?',
|
'This path will NOT be committed. Commit this revision anyway?',
|
||||||
|
'These paths will NOT be committed. Commit this revision anyway?',
|
||||||
),
|
),
|
||||||
'Revision includes changes to path(s) that do not exist:' => array(
|
'Revision includes changes to %s path(s) that do not exist:' => array(
|
||||||
'Revision includes changes to a path that does not exist:',
|
'Revision includes changes to a path that does not exist:',
|
||||||
'Revision includes changes to paths that do not exist:',
|
'Revision includes changes to paths that do not exist:',
|
||||||
),
|
),
|
||||||
|
|
||||||
'This diff includes file(s) which are not valid UTF-8 (they contain '.
|
'This diff includes %s file(s) which are not valid UTF-8 (they contain '.
|
||||||
'invalid byte sequences). You can either stop this workflow and fix '.
|
'invalid byte sequences). You can either stop this workflow and fix '.
|
||||||
'these files, or continue. If you continue, these files will be '.
|
'these files, or continue. If you continue, these files will be '.
|
||||||
'marked as binary.' => array(
|
'marked as binary.' => array(
|
||||||
|
@ -78,23 +79,23 @@ PhutilTranslator::getInstance()
|
||||||
'these files, or continue. If you continue, these files will be '.
|
'these files, or continue. If you continue, these files will be '.
|
||||||
'marked as binary.',
|
'marked as binary.',
|
||||||
),
|
),
|
||||||
'AFFECTED FILE(S)' => array('AFFECTED FILE', 'AFFECTED FILES'),
|
'%d AFFECTED FILE(S)' => array('AFFECTED FILE', 'AFFECTED FILES'),
|
||||||
'Do you want to mark these files as binary and continue?' => array(
|
'Do you want to mark these %s file(s) as binary and continue?' => array(
|
||||||
'Do you want to mark this file as binary and continue?',
|
'Do you want to mark this file as binary and continue?',
|
||||||
'Do you want to mark these files as binary and continue?',
|
'Do you want to mark these files as binary and continue?',
|
||||||
),
|
),
|
||||||
|
|
||||||
'Do you want to amend these files to the commit?' => array(
|
'Do you want to amend these %s file(s) to the commit?' => array(
|
||||||
'Do you want to amend this file to the commit?',
|
'Do you want to amend this file to the commit?',
|
||||||
'Do you want to amend these files to the commit?',
|
'Do you want to amend these files to the commit?',
|
||||||
),
|
),
|
||||||
|
|
||||||
'Do you want to add these files to the commit?' => array(
|
'Do you want to add these %s file(s) to the commit?' => array(
|
||||||
'Do you want to add this file to the commit?',
|
'Do you want to add this file to the commit?',
|
||||||
'Do you want to add these files to the commit?',
|
'Do you want to add these files to the commit?',
|
||||||
),
|
),
|
||||||
|
|
||||||
'line(s)' => array('line', 'lines'),
|
'%s line(s)' => array('line', 'lines'),
|
||||||
|
|
||||||
'%d test(s)' => array('%d test', '%d tests'),
|
'%d test(s)' => array('%d test', '%d tests'),
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class ArcanistConfigurationDrivenLintEngine extends ArcanistLintEngine {
|
||||||
));
|
));
|
||||||
} catch (PhutilTypeCheckException $ex) {
|
} catch (PhutilTypeCheckException $ex) {
|
||||||
throw new PhutilProxyException(
|
throw new PhutilProxyException(
|
||||||
pht("Error in parsing '%s' file."),
|
pht("Error in parsing '%s' file.", $config_path),
|
||||||
$ex);
|
$ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,11 +212,11 @@ EOTEXT
|
||||||
|
|
||||||
if ($modified_but_not_included) {
|
if ($modified_but_not_included) {
|
||||||
$prefix = pht(
|
$prefix = pht(
|
||||||
'Locally modified path(s) are not included in this revision:',
|
'%s locally modified path(s) are not included in this revision:',
|
||||||
count($modified_but_not_included));
|
new PhutilNumber(count($modified_but_not_included)));
|
||||||
$prompt = pht(
|
$prompt = pht(
|
||||||
'They will NOT be committed. Commit this revision anyway?',
|
'These %s path(s) will NOT be committed. Commit this revision anyway?',
|
||||||
count($modified_but_not_included));
|
new PhutilNumber(count($modified_but_not_included)));
|
||||||
$this->promptFileWarning($prefix, $prompt, $modified_but_not_included);
|
$this->promptFileWarning($prefix, $prompt, $modified_but_not_included);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +238,8 @@ EOTEXT
|
||||||
|
|
||||||
if ($do_not_exist) {
|
if ($do_not_exist) {
|
||||||
$prefix = pht(
|
$prefix = pht(
|
||||||
'Revision includes changes to path(s) that do not exist:',
|
'Revision includes changes to %s path(s) that do not exist:',
|
||||||
count($do_not_exist));
|
new PhutilNumber(count($do_not_exist)));
|
||||||
$prompt = 'Commit this revision anyway?';
|
$prompt = 'Commit this revision anyway?';
|
||||||
$this->promptFileWarning($prefix, $prompt, $do_not_exist);
|
$this->promptFileWarning($prefix, $prompt, $do_not_exist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,9 @@ EOTEXT
|
||||||
"**%s**\n",
|
"**%s**\n",
|
||||||
$author);
|
$author);
|
||||||
foreach ($files as $file => $info) {
|
foreach ($files as $file => $info) {
|
||||||
$line_noun = pht('line(s)', count($info['lines']));
|
$line_noun = pht(
|
||||||
|
'%s line(s)',
|
||||||
|
new PhutilNumber(count($info['lines'])));
|
||||||
$lines = $this->readableSequenceFromLineNumbers($info['lines']);
|
$lines = $this->readableSequenceFromLineNumbers($info['lines']);
|
||||||
echo " {$file}: {$line_noun} {$lines}\n";
|
echo " {$file}: {$line_noun} {$lines}\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1042,19 +1042,20 @@ EOTEXT
|
||||||
if ($utf8_problems) {
|
if ($utf8_problems) {
|
||||||
$utf8_warning =
|
$utf8_warning =
|
||||||
pht(
|
pht(
|
||||||
'This diff includes file(s) which are not valid UTF-8 (they contain '.
|
'This diff includes %s file(s) which are not valid UTF-8 (they '.
|
||||||
'invalid byte sequences). You can either stop this workflow and '.
|
'contain invalid byte sequences). You can either stop this workflow '.
|
||||||
'fix these files, or continue. If you continue, these files will '.
|
'and fix these files, or continue. If you continue, these files '.
|
||||||
'be marked as binary.',
|
'will be marked as binary.',
|
||||||
count($utf8_problems))."\n\n".
|
new PhutilNumber(count($utf8_problems))).
|
||||||
|
"\n\n".
|
||||||
"You can learn more about how Phabricator handles character encodings ".
|
"You can learn more about how Phabricator handles character encodings ".
|
||||||
"(and how to configure encoding settings and detect and correct ".
|
"(and how to configure encoding settings and detect and correct ".
|
||||||
"encoding problems) by reading 'User Guide: UTF-8 and Character ".
|
"encoding problems) by reading 'User Guide: UTF-8 and Character ".
|
||||||
"Encoding' in the Phabricator documentation.\n\n".
|
"Encoding' in the Phabricator documentation.\n\n".
|
||||||
" ".pht('AFFECTED FILE(S)', count($utf8_problems))."\n";
|
" ".pht('%d AFFECTED FILE(S)', count($utf8_problems))."\n";
|
||||||
$confirm = pht(
|
$confirm = pht(
|
||||||
'Do you want to mark these files as binary and continue?',
|
'Do you want to mark these %s file(s) as binary and continue?',
|
||||||
count($utf8_problems));
|
new PhutilNumber(count($utf8_problems)));
|
||||||
|
|
||||||
echo phutil_console_format("**Invalid Content Encoding (Non-UTF8)**\n");
|
echo phutil_console_format("**Invalid Content Encoding (Non-UTF8)**\n");
|
||||||
echo phutil_console_wrap($utf8_warning);
|
echo phutil_console_wrap($utf8_warning);
|
||||||
|
|
|
@ -1049,12 +1049,12 @@ abstract class ArcanistWorkflow extends Phobject {
|
||||||
private function getAskForAddPrompt(array $files) {
|
private function getAskForAddPrompt(array $files) {
|
||||||
if ($this->getShouldAmend()) {
|
if ($this->getShouldAmend()) {
|
||||||
$prompt = pht(
|
$prompt = pht(
|
||||||
'Do you want to amend these files to the commit?',
|
'Do you want to amend these %s file(s) to the commit?',
|
||||||
count($files));
|
new PhutilNumber(count($files)));
|
||||||
} else {
|
} else {
|
||||||
$prompt = pht(
|
$prompt = pht(
|
||||||
'Do you want to add these files to the commit?',
|
'Do you want to add these %s file(s) to the commit?',
|
||||||
count($files));
|
new PhutilNumber(count($files)));
|
||||||
}
|
}
|
||||||
return $prompt;
|
return $prompt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue