]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use pht()
authorvrana <jakubv@fb.com>
Tue, 12 Jun 2012 01:33:19 +0000 (18:33 -0700)
committervrana <jakubv@fb.com>
Thu, 14 Jun 2012 23:26:11 +0000 (16:26 -0700)
Test Plan: `arc cover`

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin
Maniphest Tasks: T1139

Differential Revision: https://secure.phabricator.com/D2716

scripts/__init_script__.php
src/workflow/ArcanistCommitWorkflow.php
src/workflow/ArcanistCoverWorkflow.php
src/workflow/ArcanistDiffWorkflow.php

index c099d526be03e7214082fc0e664e398b36469a9b..70708eca1563697d81d96198b6033510c46cfdc7 100644 (file)
@@ -28,4 +28,40 @@ if (!@constant('__LIBPHUTIL__')) {
   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/');
index cfdc45c560b75bd67f94930f4430aba43e71a4af..eb4a18c955131355f0550e6168c272bdfd3e3bb0 100644 (file)
@@ -227,13 +227,12 @@ EOTEXT
     }
 
     if ($modified_but_not_included) {
-      if (count($modified_but_not_included) == 1) {
-        $prefix = "A locally modified path is not included in this revision:";
-        $prompt = "It will NOT be committed. Commit this revision anyway?";
-      } else {
-        $prefix = "Locally modified paths are not included in this revision:";
-        $prompt = "They will NOT be committed. Commit this revision anyway?";
-      }
+      $prefix = pht(
+        'Locally modified path(s) are not included in this revision:',
+        count($modified_but_not_included));
+      $prompt = pht(
+        'They will NOT be committed. Commit this revision anyway?',
+        count($modified_but_not_included));
       $this->promptFileWarning($prefix, $prompt, $modified_but_not_included);
     }
 
@@ -254,13 +253,10 @@ EOTEXT
     }
 
     if ($do_not_exist) {
-      if (count($do_not_exist) == 1) {
-        $prefix = "Revision includes changes to a path that does not exist:";
-        $prompt = "Commit this revision anyway?";
-      } else {
-        $prefix = "Revision includes changes to paths that do not exist:";
-        $prompt = "Commit this revision anyway?";
-      }
+      $prefix = pht(
+        'Revision includes changes to path(s) that do not exist:',
+        count($do_not_exist));
+      $prompt = "Commit this revision anyway?";
       $this->promptFileWarning($prefix, $prompt, $do_not_exist);
     }
 
index 53c95f0214a2195894c3363ec9d0e71d31e1e8ac..12e8f399f129d90192ec933f849be2d8e99bfe91 100644 (file)
@@ -135,7 +135,7 @@ EOTEXT
           "**%s**\n",
           $author);
         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']);
           echo "  {$file}: {$line_noun} {$lines}\n";
         }
index 28f4bdd95cae32d53766f2a77f52c1d60a5a04d1..48404bca00674e87118da82812c09a74aca35a0e 100644 (file)
@@ -847,31 +847,21 @@ EOTEXT
     // and treat them as binary changes. See D327 for discussion of why Arcanist
     // has this behavior.
     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 ".
         "(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";
-      if (count($utf8_problems) == 1) {
-        $utf8_warning =
-          "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.\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?";
-      }
+        "    ".pht('AFFECTED FILE(S)', count($utf8_problems))."\n";
+      $confirm = pht(
+        'Do you want to mark these files as binary and continue?',
+        count($utf8_problems));
 
       echo phutil_console_format("**Invalid Content Encoding (Non-UTF8)**\n");
       echo phutil_console_wrap($utf8_warning);