Skip to content

Commit 8900342

Browse files
pcloudsgitster
authored andcommitted
parse-options.c: mark more strings for translation
One error is updated to start with lowercase to be consistent with the rest. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48a5499 commit 8900342

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

parse-options.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ static int parse_long_opt(struct parse_opt_ctx_t *p, const char *arg,
319319
}
320320

321321
if (ambiguous_option) {
322-
error("Ambiguous option: %s "
323-
"(could be --%s%s or --%s%s)",
322+
error(_("ambiguous option: %s "
323+
"(could be --%s%s or --%s%s)"),
324324
arg,
325325
(ambiguous_flags & OPT_UNSET) ? "no-" : "",
326326
ambiguous_option->long_name,
@@ -353,15 +353,15 @@ static void check_typos(const char *arg, const struct option *options)
353353
return;
354354

355355
if (starts_with(arg, "no-")) {
356-
error ("did you mean `--%s` (with two dashes ?)", arg);
356+
error(_("did you mean `--%s` (with two dashes ?)"), arg);
357357
exit(129);
358358
}
359359

360360
for (; options->type != OPTION_END; options++) {
361361
if (!options->long_name)
362362
continue;
363363
if (starts_with(options->long_name, arg)) {
364-
error ("did you mean `--%s` (with two dashes ?)", arg);
364+
error(_("did you mean `--%s` (with two dashes ?)"), arg);
365365
exit(129);
366366
}
367367
}
@@ -644,11 +644,11 @@ int parse_options(int argc, const char **argv, const char *prefix,
644644
break;
645645
default: /* PARSE_OPT_UNKNOWN */
646646
if (ctx.argv[0][1] == '-') {
647-
error("unknown option `%s'", ctx.argv[0] + 2);
647+
error(_("unknown option `%s'"), ctx.argv[0] + 2);
648648
} else if (isascii(*ctx.opt)) {
649-
error("unknown switch `%c'", *ctx.opt);
649+
error(_("unknown switch `%c'"), *ctx.opt);
650650
} else {
651-
error("unknown non-ascii option in string: `%s'",
651+
error(_("unknown non-ascii option in string: `%s'"),
652652
ctx.argv[0]);
653653
}
654654
usage_with_options(usagestr, options);

t/t0040-parse-options.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ EOF
228228
test_expect_success 'detect possible typos' '
229229
test_must_fail test-tool parse-options -boolean >output 2>output.err &&
230230
test_must_be_empty output &&
231-
test_cmp typo.err output.err
231+
test_i18ncmp typo.err output.err
232232
'
233233

234234
cat >typo.err <<\EOF
@@ -238,7 +238,7 @@ EOF
238238
test_expect_success 'detect possible typos' '
239239
test_must_fail test-tool parse-options -ambiguous >output 2>output.err &&
240240
test_must_be_empty output &&
241-
test_cmp typo.err output.err
241+
test_i18ncmp typo.err output.err
242242
'
243243

244244
test_expect_success 'keep some options as arguments' '

0 commit comments

Comments
 (0)