Skip to content

Commit d21d5dd

Browse files
committed
Merge branch 'ja/i18n-common-messages'
Unify more messages to help l10n. * ja/i18n-common-messages: i18n: fix some misformated placeholders in command synopsis i18n: remove from i18n strings that do not hold translatable parts i18n: factorize "invalid value" messages i18n: factorize more 'incompatible options' messages
2 parents a47fcfe + 9164d97 commit d21d5dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+137
-85
lines changed

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
static char const * const archive_usage[] = {
1414
N_("git archive [<options>] <tree-ish> [<path>...]"),
15-
N_("git archive --list"),
15+
"git archive --list",
1616
N_("git archive --remote <repo> [--exec <cmd>] [<options>] <tree-ish> [<path>...]"),
1717
N_("git archive --remote <repo> [--exec <cmd>] --list"),
1818
NULL

builtin/am.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static int am_option_parse_empty(const struct option *opt,
199199
else if (!strcmp(arg, "keep"))
200200
*opt_value = KEEP_EMPTY_COMMIT;
201201
else
202-
return error(_("Invalid value for --empty: %s"), arg);
202+
return error(_("invalid value for '%s': '%s'"), "--empty", arg);
203203

204204
return 0;
205205
}
@@ -2239,7 +2239,8 @@ static int parse_opt_patchformat(const struct option *opt, const char *arg, int
22392239
* when you add new options
22402240
*/
22412241
else
2242-
return error(_("Invalid value for --patch-format: %s"), arg);
2242+
return error(_("invalid value for '%s': '%s'"),
2243+
"--patch-format", arg);
22432244
return 0;
22442245
}
22452246

@@ -2282,7 +2283,8 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
22822283
break;
22832284
}
22842285
if (new_value >= ARRAY_SIZE(valid_modes))
2285-
return error(_("Invalid value for --show-current-patch: %s"), arg);
2286+
return error(_("invalid value for '%s': '%s'"),
2287+
"--show-current-patch", arg);
22862288
}
22872289

22882290
if (resume->mode == RESUME_SHOW_PATCH && new_value != resume->sub_mode)

builtin/bisect--helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ static GIT_PATH_FUNC(git_path_bisect_run, "BISECT_RUN")
2222

2323
static const char * const git_bisect_helper_usage[] = {
2424
N_("git bisect--helper --bisect-reset [<commit>]"),
25-
N_("git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]"),
25+
"git bisect--helper --bisect-terms [--term-good | --term-old | --term-bad | --term-new]",
2626
N_("git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}=<term>]"
2727
" [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<paths>...]"),
28-
N_("git bisect--helper --bisect-next"),
28+
"git bisect--helper --bisect-next",
2929
N_("git bisect--helper --bisect-state (bad|new) [<rev>]"),
3030
N_("git bisect--helper --bisect-state (good|old) [<rev>...]"),
3131
N_("git bisect--helper --bisect-replay <filename>"),
3232
N_("git bisect--helper --bisect-skip [(<rev>|<range>)...]"),
33-
N_("git bisect--helper --bisect-visualize"),
33+
"git bisect--helper --bisect-visualize",
3434
N_("git bisect--helper --bisect-run <cmd>..."),
3535
NULL
3636
};

builtin/blame.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,8 @@ static int git_blame_config(const char *var, const char *value, void *cb)
721721
}
722722
if (!strcmp(var, "color.blame.repeatedlines")) {
723723
if (color_parse_mem(value, strlen(value), repeated_meta_color))
724-
warning(_("invalid color '%s' in color.blame.repeatedLines"),
725-
value);
724+
warning(_("invalid value for '%s': '%s'"),
725+
"color.blame.repeatedLines", value);
726726
return 0;
727727
}
728728
if (!strcmp(var, "color.blame.highlightrecent")) {
@@ -739,7 +739,8 @@ static int git_blame_config(const char *var, const char *value, void *cb)
739739
coloring_mode &= ~(OUTPUT_COLOR_LINE |
740740
OUTPUT_SHOW_AGE_WITH_COLOR);
741741
} else {
742-
warning(_("invalid value for blame.coloring"));
742+
warning(_("invalid value for '%s': '%s'"),
743+
"blame.coloring", value);
743744
return 0;
744745
}
745746
}

builtin/commit.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,16 +1242,14 @@ static int parse_and_validate_options(int argc, const char *argv[],
12421242
struct commit *current_head,
12431243
struct wt_status *s)
12441244
{
1245-
int f = 0;
1246-
12471245
argc = parse_options(argc, argv, prefix, options, usage, 0);
12481246
finalize_deferred_config(s);
12491247

12501248
if (force_author && !strchr(force_author, '>'))
12511249
force_author = find_author_by_nickname(force_author);
12521250

12531251
if (force_author && renew_authorship)
1254-
die(_("Using both --reset-author and --author does not make sense"));
1252+
die(_("options '%s' and '%s' cannot be used together"), "--reset-author", "--author");
12551253

12561254
if (logfile || have_option_m || use_message)
12571255
use_editor = 0;
@@ -1268,20 +1266,16 @@ static int parse_and_validate_options(int argc, const char *argv[],
12681266
die(_("You are in the middle of a rebase -- cannot amend."));
12691267
}
12701268
if (fixup_message && squash_message)
1271-
die(_("Options --squash and --fixup cannot be used together"));
1272-
if (use_message)
1273-
f++;
1274-
if (edit_message)
1275-
f++;
1276-
if (fixup_message)
1277-
f++;
1278-
if (logfile)
1279-
f++;
1280-
if (f > 1)
1281-
die(_("Only one of -c/-C/-F/--fixup can be used."));
1282-
if (have_option_m && (edit_message || use_message || logfile))
1283-
die((_("Option -m cannot be combined with -c/-C/-F.")));
1284-
if (f || have_option_m)
1269+
die(_("options '%s' and '%s' cannot be used together"), "--squash", "--fixup");
1270+
die_for_incompatible_opt4(!!use_message, "-C",
1271+
!!edit_message, "-c",
1272+
!!logfile, "-F",
1273+
!!fixup_message, "--fixup");
1274+
die_for_incompatible_opt4(have_option_m, "-m",
1275+
!!edit_message, "-c",
1276+
!!use_message, "-C",
1277+
!!logfile, "-F");
1278+
if (use_message || edit_message || logfile ||fixup_message || have_option_m)
12851279
template_file = NULL;
12861280
if (edit_message)
12871281
use_message = edit_message;
@@ -1306,9 +1300,10 @@ static int parse_and_validate_options(int argc, const char *argv[],
13061300
if (patch_interactive)
13071301
interactive = 1;
13081302

1309-
if (also + only + all + interactive > 1)
1310-
die(_("Only one of --include/--only/--all/--interactive/--patch can be used."));
1311-
1303+
die_for_incompatible_opt4(also, "-i/--include",
1304+
only, "-o/--only",
1305+
all, "-a/--all",
1306+
interactive, "--interactive/-p/--patch");
13121307
if (fixup_message) {
13131308
/*
13141309
* We limit --fixup's suboptions to only alpha characters.

builtin/count-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int print_alternate(struct object_directory *odb, void *data)
8787
}
8888

8989
static char const * const count_objects_usage[] = {
90-
N_("git count-objects [-v] [-H | --human-readable]"),
90+
"git count-objects [-v] [-H | --human-readable]",
9191
NULL
9292
};
9393

builtin/difftool.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,9 @@ int cmd_difftool(int argc, const char **argv, const char *prefix)
732732
} else if (dir_diff)
733733
die(_("options '%s' and '%s' cannot be used together"), "--dir-diff", "--no-index");
734734

735-
if (use_gui_tool + !!difftool_cmd + !!extcmd > 1)
736-
die(_("options '%s', '%s', and '%s' cannot be used together"), "--gui", "--tool", "--extcmd");
735+
die_for_incompatible_opt3(use_gui_tool, "--gui",
736+
!!difftool_cmd, "--tool",
737+
!!extcmd, "--extcmd");
737738

738739
if (use_gui_tool)
739740
setenv("GIT_MERGETOOL_GUI", "true", 1);

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "commit-slab.h"
2727

2828
static const char *fast_export_usage[] = {
29-
N_("git fast-export [rev-list-opts]"),
29+
N_("git fast-export [<rev-list-opts>]"),
3030
NULL
3131
};
3232

builtin/fetch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ static void prepare_format_display(struct ref *ref_map)
764764
else if (!strcasecmp(format, "compact"))
765765
compact_format = 1;
766766
else
767-
die(_("configuration fetch.output contains invalid value %s"),
768-
format);
767+
die(_("invalid value for '%s': '%s'"),
768+
"fetch.output", format);
769769

770770
for (rm = ref_map; rm; rm = rm->next) {
771771
if (rm->status == REF_STATUS_REJECT_SHALLOW ||

builtin/grep.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,11 +1167,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
11671167
if (!show_in_pager && !opt.status_only)
11681168
setup_pager();
11691169

1170-
if (!use_index && (untracked || cached))
1171-
die(_("--cached or --untracked cannot be used with --no-index"));
1172-
1173-
if (untracked && cached)
1174-
die(_("--untracked cannot be used with --cached"));
1170+
die_for_incompatible_opt3(!use_index, "--no-index",
1171+
untracked, "--untracked",
1172+
cached, "--cached");
11751173

11761174
if (!use_index || untracked) {
11771175
int use_exclude = (opt_exclude < 0) ? use_index : !!opt_exclude;

0 commit comments

Comments
 (0)