]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Fix `pht` method calls
authorJoshua Spence <josh@joshuaspence.com>
Tue, 10 Feb 2015 07:45:30 +0000 (18:45 +1100)
committerJoshua Spence <josh@joshuaspence.com>
Tue, 10 Feb 2015 07:48:38 +0000 (18:48 +1100)
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

scripts/__init_script__.php
src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
src/workflow/ArcanistCommitWorkflow.php
src/workflow/ArcanistCoverWorkflow.php
src/workflow/ArcanistDiffWorkflow.php
src/workflow/ArcanistWorkflow.php

index 9f7486b686b35a38f88cd939a95278b1a70c955c..cb55a29019dc90274a62ede5ce0c4c9ce746501a 100644 (file)
@@ -53,23 +53,24 @@ if (!@constant('__LIBPHUTIL__')) {
 
 PhutilTranslator::getInstance()
   ->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:',
       '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?',
+    'These %s path(s) will NOT be committed. Commit this revision '.
+    'anyway?' => array(
+      '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 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 %s 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.',
@@ -78,23 +79,23 @@ PhutilTranslator::getInstance()
         '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(
+    '%d AFFECTED FILE(S)' => array('AFFECTED FILE', 'AFFECTED FILES'),
+    '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 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 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 these files to the commit?',
     ),
 
-    'line(s)' => array('line', 'lines'),
+    '%s line(s)' => array('line', 'lines'),
 
     '%d test(s)' => array('%d test', '%d tests'),
 
index dbd60638866ab12d0f7d58db5083d55bae7348b8..352bbc95aedca1db42d505e5d8c5882d8e713cdd 100644 (file)
@@ -40,7 +40,7 @@ final class ArcanistConfigurationDrivenLintEngine extends ArcanistLintEngine {
         ));
     } catch (PhutilTypeCheckException $ex) {
       throw new PhutilProxyException(
-        pht("Error in parsing '%s' file."),
+        pht("Error in parsing '%s' file.", $config_path),
         $ex);
     }
 
index 6ac44102315d201f8d4cc104cbe644ff36a8e375..6c727b5ab8bc6c6c9e9d854c14d328c9983c47ff 100644 (file)
@@ -212,11 +212,11 @@ EOTEXT
 
     if ($modified_but_not_included) {
       $prefix = pht(
-        'Locally modified path(s) are not included in this revision:',
-        count($modified_but_not_included));
+        '%s locally modified path(s) are not included in this revision:',
+        new PhutilNumber(count($modified_but_not_included)));
       $prompt = pht(
-        'They will NOT be committed. Commit this revision anyway?',
-        count($modified_but_not_included));
+        'These %s path(s) will NOT be committed. Commit this revision anyway?',
+        new PhutilNumber(count($modified_but_not_included)));
       $this->promptFileWarning($prefix, $prompt, $modified_but_not_included);
     }
 
@@ -238,8 +238,8 @@ EOTEXT
 
     if ($do_not_exist) {
       $prefix = pht(
-        'Revision includes changes to path(s) that do not exist:',
-        count($do_not_exist));
+        'Revision includes changes to %s path(s) that do not exist:',
+        new PhutilNumber(count($do_not_exist)));
       $prompt = 'Commit this revision anyway?';
       $this->promptFileWarning($prefix, $prompt, $do_not_exist);
     }
index bbe3e05bf8ee6291a8825b1dd1d83daac77dceb3..5e984cf9074c9160bed793328dc15c02b5d0db10 100644 (file)
@@ -118,7 +118,9 @@ EOTEXT
           "**%s**\n",
           $author);
         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']);
           echo "  {$file}: {$line_noun} {$lines}\n";
         }
index 01742084b43d6273ae6cd6cf8961eba9a11cbd50..5aeb69cd48c6710f28fdb32cc12d15175aef380d 100644 (file)
@@ -1042,19 +1042,20 @@ EOTEXT
     if ($utf8_problems) {
       $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".
+          '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 these files, or continue. If you continue, these files '.
+          'will be marked as binary.',
+          new PhutilNumber(count($utf8_problems))).
+        "\n\n".
         "You can learn more about how Phabricator handles character encodings ".
         "(and how to configure encoding settings and detect and correct ".
         "encoding problems) by reading 'User Guide: UTF-8 and Character ".
         "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(
-        'Do you want to mark these files as binary and continue?',
-        count($utf8_problems));
+        'Do you want to mark these %s file(s) as binary and continue?',
+        new PhutilNumber(count($utf8_problems)));
 
       echo phutil_console_format("**Invalid Content Encoding (Non-UTF8)**\n");
       echo phutil_console_wrap($utf8_warning);
index 4944d7028e86a1b9877027b5be2cbf17b2da0bf4..5e8fa8b0ebd01791fb24ea6b2346d2fc8ab34bf4 100644 (file)
@@ -1049,12 +1049,12 @@ abstract class ArcanistWorkflow extends Phobject {
   private function getAskForAddPrompt(array $files) {
     if ($this->getShouldAmend()) {
       $prompt = pht(
-        'Do you want to amend these files to the commit?',
-        count($files));
+        'Do you want to amend these %s file(s) to the commit?',
+        new PhutilNumber(count($files)));
     } else {
       $prompt = pht(
-        'Do you want to add these files to the commit?',
-        count($files));
+        'Do you want to add these %s file(s) to the commit?',
+        new PhutilNumber(count($files)));
     }
     return $prompt;
   }