mirror of
https://git.tukaani.org/xz.git
synced 2025-02-22 00:18:15 +00:00
lzmainfo: Use tuklib_mbstr_wrap for --help text
Some languages have so long strings that they need to be wrapped.
This commit is contained in:
parent
c56eb47076
commit
7d73ff7a9d
@ -2016,8 +2016,12 @@ if(XZ_TOOL_LZMAINFO AND HAVE_DECODERS)
|
|||||||
src/common/sysdefs.h
|
src/common/sysdefs.h
|
||||||
src/common/tuklib_common.h
|
src/common/tuklib_common.h
|
||||||
src/common/tuklib_config.h
|
src/common/tuklib_config.h
|
||||||
|
src/common/tuklib_mbstr.h
|
||||||
src/common/tuklib_mbstr_nonprint.c
|
src/common/tuklib_mbstr_nonprint.c
|
||||||
src/common/tuklib_mbstr_nonprint.h
|
src/common/tuklib_mbstr_nonprint.h
|
||||||
|
src/common/tuklib_mbstr_width.c
|
||||||
|
src/common/tuklib_mbstr_wrap.c
|
||||||
|
src/common/tuklib_mbstr_wrap.h
|
||||||
src/common/tuklib_exit.c
|
src/common/tuklib_exit.c
|
||||||
src/common/tuklib_exit.h
|
src/common/tuklib_exit.h
|
||||||
src/common/tuklib_gettext.h
|
src/common/tuklib_gettext.h
|
||||||
|
@ -7,6 +7,8 @@ lzmainfo_SOURCES = \
|
|||||||
lzmainfo.c \
|
lzmainfo.c \
|
||||||
../common/tuklib_progname.c \
|
../common/tuklib_progname.c \
|
||||||
../common/tuklib_mbstr_nonprint.c \
|
../common/tuklib_mbstr_nonprint.c \
|
||||||
|
../common/tuklib_mbstr_width.c \
|
||||||
|
../common/tuklib_mbstr_wrap.c \
|
||||||
../common/tuklib_exit.c
|
../common/tuklib_exit.c
|
||||||
|
|
||||||
if COND_W32
|
if COND_W32
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "tuklib_gettext.h"
|
#include "tuklib_gettext.h"
|
||||||
#include "tuklib_progname.h"
|
#include "tuklib_progname.h"
|
||||||
#include "tuklib_mbstr_nonprint.h"
|
#include "tuklib_mbstr_nonprint.h"
|
||||||
|
#include "tuklib_mbstr_wrap.h"
|
||||||
#include "tuklib_exit.h"
|
#include "tuklib_exit.h"
|
||||||
|
|
||||||
#ifdef TUKLIB_DOSLIKE
|
#ifdef TUKLIB_DOSLIKE
|
||||||
@ -30,21 +31,36 @@ tuklib_attr_noreturn
|
|||||||
static void
|
static void
|
||||||
help(void)
|
help(void)
|
||||||
{
|
{
|
||||||
// We don't need automatic word-wrapping here. A few strings are
|
// A few languages use so long strings that we need automatic
|
||||||
// the same as in xz/message.c but here we need to add the newlines
|
// wrapping. A few strings are the same as in xz/message.c and
|
||||||
// with putchar('\n'). This way translators won't get two variants
|
// should be kept in sync.
|
||||||
// of the same string: one without and another with \n at the end.
|
static const struct tuklib_wrap_opt wrap0 = { 0, 0, 0, 0, 79 };
|
||||||
|
int e = 0;
|
||||||
|
|
||||||
printf(_("Usage: %s [--help] [--version] [FILE]...\n"), progname);
|
printf(_("Usage: %s [--help] [--version] [FILE]...\n"), progname);
|
||||||
puts(_("Show information stored in the .lzma file header."));
|
|
||||||
puts(_("With no FILE, or when FILE is -, read standard input."));
|
e |= tuklib_wraps(stdout, &wrap0,
|
||||||
|
W_("Show information stored in the .lzma file header."));
|
||||||
|
e |= tuklib_wraps(stdout, &wrap0,
|
||||||
|
W_("With no FILE, or when FILE is -, read standard input."));
|
||||||
|
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
||||||
printf(_("Report bugs to <%s> (in English or Finnish)."),
|
e |= tuklib_wrapf(stdout, &wrap0,
|
||||||
|
W_("Report bugs to <%s> (in English or Finnish)."),
|
||||||
PACKAGE_BUGREPORT);
|
PACKAGE_BUGREPORT);
|
||||||
putchar('\n');
|
|
||||||
printf(_("%s home page: <%s>"), PACKAGE_NAME, PACKAGE_URL);
|
e |= tuklib_wrapf(stdout, &wrap0,
|
||||||
putchar('\n');
|
W_("%s home page: <%s>"), PACKAGE_NAME, PACKAGE_URL);
|
||||||
|
|
||||||
|
if (e != 0) {
|
||||||
|
// Avoid new translatable strings by printing the message
|
||||||
|
// in pieces.
|
||||||
|
fprintf(stderr, _("%s: "), progname);
|
||||||
|
fprintf(stderr, _("Error printing the help text "
|
||||||
|
"(error code %d)"), e);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, true);
|
tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user