Browse Source

Use ngettext where appropriate.

Sergey Poznyakoff 21 years ago
parent
commit
91b2d65e9d
6 changed files with 55 additions and 15 deletions
  1. 17 4
      src/buffer.c
  2. 15 4
      src/compare.c
  3. 3 1
      src/create.c
  4. 13 4
      src/misc.c
  5. 3 1
      src/tar.c
  6. 4 1
      src/update.c

+ 17 - 4
src/buffer.c

@@ -1055,8 +1055,15 @@ short_read (ssize_t status)
 	break;
 
       if (! read_full_records_option)
-	FATAL_ERROR ((0, 0, _("Unaligned block (%lu bytes) in archive"),
-		      (unsigned long) (record_size - left)));
+	{
+	  unsigned long rest = record_size - left;
+	  
+	  FATAL_ERROR ((0, 0,
+			ngettext ("Unaligned block (%lu byte) in archive",
+				  "Unaligned block (%lu bytes) in archive",
+				  rest),
+			rest));
+	}
 
       /* User warned us about this.  Fix up.  */
 
@@ -1069,8 +1076,14 @@ short_read (ssize_t status)
 
   if (!read_full_records_option && verbose_option
       && record_start_block == 0 && status > 0)
-    WARN ((0, 0, _("Record size = %lu blocks"),
-	   (unsigned long) ((record_size - left) / BLOCKSIZE)));
+    {
+      unsigned long rsize = (record_size - left) / BLOCKSIZE;
+      WARN ((0, 0,
+	     ngettext ("Record size = %lu block",
+		       "Record size = %lu blocks",
+		       rsize),
+	     rsize));
+    }
 
   record_end = record_start + (record_size - left) / BLOCKSIZE;
   records_read++;

+ 15 - 4
src/compare.c

@@ -97,7 +97,10 @@ process_rawdata (size_t bytes, char *buffer)
 	}
       else
 	{
-	  sprintf (message, _("Could only read %lu of %lu bytes"),
+	  sprintf (message,
+		   ngettext ("Could only read %lu of %lu byte",
+			     "Could only read %lu of %lu bytes",
+			     bytes),
 		   (unsigned long) status, (unsigned long) bytes);
 	  report_difference (message);
 	}
@@ -236,7 +239,10 @@ diff_sparse_files (void)
 		{
 		  char message[MESSAGE_BUFFER_SIZE];
 
-		  sprintf (message, _("Could only read %lu of %lu bytes"),
+		  sprintf (message,
+			   ngettext ("Could only read %lu of %lu byte",
+				     "Could only read %lu of %lu bytes",
+				     chunk_size),
 			   (unsigned long) status, (unsigned long) chunk_size);
 		  report_difference (message);
 		}
@@ -268,7 +274,10 @@ diff_sparse_files (void)
 	    {
 	      char message[MESSAGE_BUFFER_SIZE];
 
-	      sprintf (message, _("Could only read %lu of %lu bytes"),
+	      sprintf (message,
+		       ngettext ("Could only read %lu of %lu byte",
+				 "Could only read %lu of %lu bytes",
+				 chunk_size),
 		       (unsigned long) status, (unsigned long) chunk_size);
 	      report_difference (message);
 	    }
@@ -714,7 +723,9 @@ verify_volume (void)
 	  while (status == HEADER_FAILURE);
 
 	  ERROR ((0, 0,
-		  _("VERIFY FAILURE: %d invalid header(s) detected"), counter));
+		  ngettext ("VERIFY FAILURE: %d invalid header detected",
+			    "VERIFY FAILURE: %d invalid headers detected",
+			    counter), counter));
 	}
       if (status == HEADER_ZERO_BLOCK || status == HEADER_END_OF_FILE)
 	break;

+ 3 - 1
src/create.c

@@ -1497,7 +1497,9 @@ dump_file (char *p, int top_level, dev_t parent_device)
 		    char buf[UINTMAX_STRSIZE_BOUND];
 		    memset (start->buffer + count, 0, bufsize - count);
 		    WARN ((0, 0,
-			   _("%s: File shrank by %s bytes; padding with zeros"),
+			   ngettext ("%s: File shrank by %s byte; padding with zeros",
+				     "%s: File shrank by %s bytes; padding with zeros",
+				     sizeleft),
 			   quotearg_colon (p),
 			   STRINGIFY_BIGINT (sizeleft, buf)));
 		    if (! ignore_failed_read_option)

+ 13 - 4
src/misc.c

@@ -660,7 +660,9 @@ read_error_details (char const *name, off_t offset, size_t size)
   char buf[UINTMAX_STRSIZE_BOUND];
   int e = errno;
   ERROR ((0, e,
-	  _("%s: Read error at byte %s, reading %lu bytes"),
+	  ngettext ("%s: Read error at byte %s, reading %lu byte",
+		    "%s: Read error at byte %s, reading %lu bytes",
+		    size),
 	  quotearg_colon (name), STRINGIFY_BIGINT (offset, buf),
 	  (unsigned long) size));
 }
@@ -671,7 +673,9 @@ read_warn_details (char const *name, off_t offset, size_t size)
   char buf[UINTMAX_STRSIZE_BOUND];
   int e = errno;
   WARN ((0, e,
-	 _("%s: Warning: Read error at byte %s, reading %lu bytes"),
+	 ngettext ("%s: Warning: Read error at byte %s, reading %lu byte",
+		   "%s: Warning: Read error at byte %s, reading %lu bytes",
+		   size),
 	 quotearg_colon (name), STRINGIFY_BIGINT (offset, buf),
 	 (unsigned long) size));
 }
@@ -688,7 +692,9 @@ read_fatal_details (char const *name, off_t offset, size_t size)
   char buf[UINTMAX_STRSIZE_BOUND];
   int e = errno;
   FATAL_ERROR ((0, e,
-		_("%s: Read error at byte %s, reading %lu bytes"),
+		ngettext ("%s: Read error at byte %s, reading %lu byte",
+			  "%s: Read error at byte %s, reading %lu bytes",
+			  size),
 		quotearg_colon (name), STRINGIFY_BIGINT (offset, buf),
 		(unsigned long) size));
 }
@@ -811,7 +817,10 @@ write_error_details (char const *name, ssize_t status, size_t size)
   if (status < 0)
     write_error (name);
   else
-    ERROR ((0, 0, _("%s: Wrote only %lu of %lu bytes"),
+    ERROR ((0, 0,
+	    ngettext ("%s: Wrote only %lu of %lu byte",
+		      "%s: Wrote only %lu of %lu bytes",
+		      record_size),
 	    name, (unsigned long) status, (unsigned long) record_size));
 }
 

+ 3 - 1
src/tar.c

@@ -1283,7 +1283,9 @@ see the file named COPYING for details."));
 	    : 0));
       if (volume_label_max_len < strlen (volume_label_option))
 	USAGE_ERROR ((0, 0,
-		      _("%s: Volume label is too long (limit is %lu bytes)"),
+		      ngettext ("%s: Volume label is too long (limit is %lu byte)",
+				"%s: Volume label is too long (limit is %lu bytes)",
+				volume_label_max_len),
 		      quotearg_colon (volume_label_option),
 		      (unsigned long) volume_label_max_len));
     }

+ 4 - 1
src/update.c

@@ -80,7 +80,10 @@ append_file (char *path)
 	    read_fatal_details (path, stat_data.st_size - bytes_left,
 				buffer_size);
 	  if (status == 0)
-	    FATAL_ERROR ((0, 0, _("%s: File shrank by %s bytes"),
+	    FATAL_ERROR ((0, 0,
+			  ngettext ("%s: File shrank by %s byte",
+				    "%s: File shrank by %s bytes",
+				    bytes_left),
 			  quotearg_colon (path),
 			  STRINGIFY_BIGINT (bytes_left, buf)));