1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +01:00

Use pht()

Test Plan: `arc cover`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1139

Differential Revision: https://secure.phabricator.com/D2716
This commit is contained in:
vrana 2012-06-11 18:33:19 -07:00
parent 4448bd09c7
commit 57499106ec
4 changed files with 58 additions and 36 deletions

View file

@ -28,4 +28,40 @@ if (!@constant('__LIBPHUTIL__')) {
exit(1); exit(1);
} }
PhutilTranslator::getInstance()
->addTranslations(array(
'Locally modified path(s) are not included in this revision:' => array(
'A locally modified path is not included in this revision:',
'Locally modified paths are not included in this revision:',
),
'They will NOT be committed. Commit this revision anyway?' => array(
'It will NOT be committed. Commit this revision anyway?',
'They will NOT be committed. Commit this revision anyway?',
),
'Revision includes changes to path(s) that do not exist:' => array(
'Revision includes changes to a path that does not exist:',
'Revision includes changes to paths that do not exist:',
),
'This diff includes file(s) which are not valid UTF-8 (they contain '.
'invalid byte sequences). You can either stop this workflow and fix '.
'these files, or continue. If you continue, these files will be '.
'marked as binary.' => array(
'This diff includes a file which is not valid UTF-8 (it has invalid '.
'byte sequences). You can either stop this workflow and fix it, or '.
'continue. If you continue, this file will be marked as binary.',
'This diff includes files which are not valid UTF-8 (they contain '.
'invalid byte sequences). You can either stop this workflow and fix '.
'these files, or continue. If you continue, these files will be '.
'marked as binary.',
),
'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 this file as binary and continue?',
'Do you want to mark these files as binary and continue?',
),
'line(s)' => array('line', 'lines'),
));
phutil_load_library(dirname(dirname(__FILE__)).'/src/'); phutil_load_library(dirname(dirname(__FILE__)).'/src/');

View file

@ -227,13 +227,12 @@ EOTEXT
} }
if ($modified_but_not_included) { if ($modified_but_not_included) {
if (count($modified_but_not_included) == 1) { $prefix = pht(
$prefix = "A locally modified path is not included in this revision:"; 'Locally modified path(s) are not included in this revision:',
$prompt = "It will NOT be committed. Commit this revision anyway?"; count($modified_but_not_included));
} else { $prompt = pht(
$prefix = "Locally modified paths are not included in this revision:"; 'They will NOT be committed. Commit this revision anyway?',
$prompt = "They will NOT be committed. Commit this revision anyway?"; count($modified_but_not_included));
}
$this->promptFileWarning($prefix, $prompt, $modified_but_not_included); $this->promptFileWarning($prefix, $prompt, $modified_but_not_included);
} }
@ -254,13 +253,10 @@ EOTEXT
} }
if ($do_not_exist) { if ($do_not_exist) {
if (count($do_not_exist) == 1) { $prefix = pht(
$prefix = "Revision includes changes to a path that does not exist:"; 'Revision includes changes to path(s) that do not exist:',
count($do_not_exist));
$prompt = "Commit this revision anyway?"; $prompt = "Commit this revision anyway?";
} else {
$prefix = "Revision includes changes to paths that do not exist:";
$prompt = "Commit this revision anyway?";
}
$this->promptFileWarning($prefix, $prompt, $do_not_exist); $this->promptFileWarning($prefix, $prompt, $do_not_exist);
} }

View file

@ -135,7 +135,7 @@ EOTEXT
"**%s**\n", "**%s**\n",
$author); $author);
foreach ($files as $file => $info) { foreach ($files as $file => $info) {
$line_noun = count($info['lines']) == 1 ? 'line' : 'lines'; $line_noun = pht('line(s)', 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";
} }

View file

@ -847,31 +847,21 @@ EOTEXT
// and treat them as binary changes. See D327 for discussion of why Arcanist // and treat them as binary changes. See D327 for discussion of why Arcanist
// has this behavior. // has this behavior.
if ($utf8_problems) { if ($utf8_problems) {
$learn_more = $utf8_warning =
pht(
"This diff includes file(s) which are not valid UTF-8 (they contain ".
"invalid byte sequences). You can either stop this workflow and ".
"fix these files, or continue. If you continue, these files will ".
"be marked as binary.",
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";
if (count($utf8_problems) == 1) { " ".pht('AFFECTED FILE(S)', count($utf8_problems))."\n";
$utf8_warning = $confirm = pht(
"This diff includes a file which is not valid UTF-8 (it has invalid ". 'Do you want to mark these files as binary and continue?',
"byte sequences). You can either stop this workflow and fix it, or ". count($utf8_problems));
"continue. If you continue, this file will be marked as binary.\n\n".
$learn_more.
" AFFECTED FILE\n";
$confirm = "Do you want to mark this file as binary and continue?";
} else {
$utf8_warning =
"This diff includes files which are not valid UTF-8 (they contain ".
"invalid byte sequences). You can either stop this workflow and fix ".
"these files, or continue. If you continue, these files will be ".
"marked as binary.\n\n".
$learn_more.
" AFFECTED FILES\n";
$confirm = "Do you want to mark these files as binary and continue?";
}
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);