From 91b2d65e9dccae981f308a659d6c7bdd32285598 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Fri, 5 Sep 2003 13:24:15 +0000 Subject: [PATCH] Use ngettext where appropriate. --- src/buffer.c | 21 +++++++++++++++++---- src/compare.c | 19 +++++++++++++++---- src/create.c | 4 +++- src/misc.c | 17 +++++++++++++---- src/tar.c | 4 +++- src/update.c | 5 ++++- 6 files changed, 55 insertions(+), 15 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index ab06752..fd16b6f 100644 --- a/src/buffer.c +++ b/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++; diff --git a/src/compare.c b/src/compare.c index 2c3a21d..4ae3392 100644 --- a/src/compare.c +++ b/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; diff --git a/src/create.c b/src/create.c index b0fa1e8..910b4a2 100644 --- a/src/create.c +++ b/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) diff --git a/src/misc.c b/src/misc.c index 8112ee8..678976e 100644 --- a/src/misc.c +++ b/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)); } diff --git a/src/tar.c b/src/tar.c index e0e731b..dcf6a3e 100644 --- a/src/tar.c +++ b/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)); } diff --git a/src/update.c b/src/update.c index 5363ece..c7e0319 100644 --- a/src/update.c +++ b/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))); -- 2.45.2