summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-05-17 15:22:29 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-05-17 15:22:30 -0700
commitc0b5c62d1225deb1ebc017d349b24b72c7e16614 (patch)
tree93148bf46922d075cf0c798d7fe9c6b37f0535e4 /parse-options.c
parentMerge branch 'rs/xdiff-lose-emit-func' (diff)
parenti18n: apply: mark parseopt strings for translation (diff)
downloadtgif-c0b5c62d1225deb1ebc017d349b24b72c7e16614.tar.xz
Merge branch 'nd/i18n-parseopt'
Text from "git cmd --help" are getting prepared for i18n. By Nguyễn Thái Ngọc Duy * nd/i18n-parseopt: i18n: apply: mark parseopt strings for translation i18n: parseopt: lookup help and argument translations when showing usage
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/parse-options.c b/parse-options.c
index 850cfa78c9..ab70c29c49 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -490,7 +490,7 @@ static int usage_argh(const struct option *opts, FILE *outfile)
s = literal ? "[%s]" : "[<%s>]";
else
s = literal ? " %s" : " <%s>";
- return fprintf(outfile, s, opts->argh ? opts->argh : "...");
+ return fprintf(outfile, s, opts->argh ? _(opts->argh) : _("..."));
}
#define USAGE_OPTS_WIDTH 24
@@ -508,13 +508,16 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
if (!err && ctx && ctx->flags & PARSE_OPT_SHELL_EVAL)
fprintf(outfile, "cat <<\\EOF\n");
- fprintf(outfile, "usage: %s\n", *usagestr++);
+ fprintf_ln(outfile, _("usage: %s"), _(*usagestr++));
while (*usagestr && **usagestr)
- fprintf(outfile, " or: %s\n", *usagestr++);
+ /* TRANSLATORS: the colon here should align with the
+ one in "usage: %s" translation */
+ fprintf_ln(outfile, _(" or: %s"), _(*usagestr++));
while (*usagestr) {
- fprintf(outfile, "%s%s\n",
- **usagestr ? " " : "",
- *usagestr);
+ if (**usagestr)
+ fprintf_ln(outfile, _(" %s"), _(*usagestr));
+ else
+ putchar('\n');
usagestr++;
}
@@ -528,7 +531,7 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
if (opts->type == OPTION_GROUP) {
fputc('\n', outfile);
if (*opts->help)
- fprintf(outfile, "%s\n", opts->help);
+ fprintf(outfile, "%s\n", _(opts->help));
continue;
}
if (!full && (opts->flags & PARSE_OPT_HIDDEN))
@@ -558,7 +561,7 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
fputc('\n', outfile);
pad = USAGE_OPTS_WIDTH;
}
- fprintf(outfile, "%*s%s\n", pad + USAGE_GAP, "", opts->help);
+ fprintf(outfile, "%*s%s\n", pad + USAGE_GAP, "", _(opts->help));
}
fputc('\n', outfile);