i18n: remote: mark strings for translation
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Apr 23, 2012 at 19:30 UTC
bb16d5dd30452660e609705252c65aa493bd59e2
1 file changed
+121
-106
builtin/remote.c
+121
-106
@@ -95,9 +95,9 @@ static int fetch_remote(const char *name)
95
argv[1] = "-v";
96
argv[2] = name;
97
}
98
- printf("Updating %s\n", name);
98
+ printf_ln(_("Updating %s"), name);
99
if (run_command_v_opt(argv, RUN_GIT_CMD))
100
- return error("Could not fetch %s", name);
100
+ return error(_("Could not fetch %s"), name);
101
return 0;
102
}
103
@@ -127,8 +127,8 @@ static int add_branch(const char *key, const char *branchname,
127
}
128
129
static const char mirror_advice[] =
130
-"--mirror is dangerous and deprecated; please\n"
131
-"\t use --mirror=fetch or --mirror=push instead";
130
+N_("--mirror is dangerous and deprecated; please\n"
131
+ "\t use --mirror=fetch or --mirror=push instead");
132
133
static int parse_mirror_opt(const struct option *opt, const char *arg, int not)
134
{
@@ -136,7 +136,7 @@ static int parse_mirror_opt(const struct option *opt, const char *arg, int not)
136
if (not)
137
*mirror = MIRROR_NONE;
138
else if (!arg) {
139
- warning("%s", mirror_advice);
139
+ warning("%s", _(mirror_advice));
140
*mirror = MIRROR_BOTH;
141
}
142
else if (!strcmp(arg, "fetch"))
@@ -144,7 +144,7 @@ static int parse_mirror_opt(const struct option *opt, const char *arg, int not)
144
else if (!strcmp(arg, "push"))
145
*mirror = MIRROR_PUSH;
146
else
147
- return error("unknown mirror argument: %s", arg);
147
+ return error(_("unknown mirror argument: %s"), arg);
148
return 0;
149
}
150
@@ -182,9 +182,9 @@ static int add(int argc, const char **argv)
182
usage_with_options(builtin_remote_add_usage, options);
183
184
if (mirror && master)
185
- die("specifying a master branch makes no sense with --mirror");
185
+ die(_("specifying a master branch makes no sense with --mirror"));
186
if (mirror && !(mirror & MIRROR_FETCH) && track.nr)
187
- die("specifying branches to track makes sense only with fetch mirrors");
187
+ die(_("specifying branches to track makes sense only with fetch mirrors"));
188
189
name = argv[0];
190
url = argv[1];
@@ -192,11 +192,11 @@ static int add(int argc, const char **argv)
192
remote = remote_get(name);
193
if (remote && (remote->url_nr > 1 || strcmp(name, remote->url[0]) ||
194
remote->fetch_refspec_nr))
195
- die("remote %s already exists.", name);
195
+ die(_("remote %s already exists."), name);
196
197
strbuf_addf(&buf2, "refs/heads/test:refs/remotes/%s/test", name);
198
if (!valid_fetch_refspec(buf2.buf))
199
- die("'%s' is not a valid remote name", name);
199
+ die(_("'%s' is not a valid remote name"), name);
200
201
strbuf_addf(&buf, "remote.%s.url", name);
202
if (git_config_set(buf.buf, url))
@@ -240,7 +240,7 @@ static int add(int argc, const char **argv)
240
strbuf_addf(&buf2, "refs/remotes/%s/%s", name, master);
241
242
if (create_symref(buf.buf, buf2.buf, "remote add"))
243
- return error("Could not setup master '%s'", master);
243
+ return error(_("Could not setup master '%s'"), master);
244
}
245
246
strbuf_release(&buf);
@@ -296,7 +296,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)
296
info = item->util;
297
if (type == REMOTE) {
298
if (info->remote_name)
299
- warning("more than one %s", orig_key);
299
+ warning(_("more than one %s"), orig_key);
300
info->remote_name = xstrdup(value);
301
} else if (type == MERGE) {
302
char *space = strchr(value, ' ');
@@ -336,7 +336,7 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
336
337
for (i = 0; i < states->remote->fetch_refspec_nr; i++)
338
if (get_fetch_map(remote_refs, states->remote->fetch + i, &tail, 1))
339
- die("Could not get fetch map for refspec %s",
339
+ die(_("Could not get fetch map for refspec %s"),
340
states->remote->fetch_refspec[i]);
341
342
states->new.strdup_strings = 1;
@@ -437,7 +437,7 @@ static int get_push_ref_states_noquery(struct ref_states *states)
437
438
states->push.strdup_strings = 1;
439
if (!remote->push_refspec_nr) {
440
- item = string_list_append(&states->push, "(matching)");
440
+ item = string_list_append(&states->push, _("(matching)"));
441
info = item->util = xcalloc(sizeof(struct push_info), 1);
442
info->status = PUSH_STATUS_NOTQUERIED;
443
info->dest = xstrdup(item->string);
@@ -445,11 +445,11 @@ static int get_push_ref_states_noquery(struct ref_states *states)
445
for (i = 0; i < remote->push_refspec_nr; i++) {
446
struct refspec *spec = remote->push + i;
447
if (spec->matching)
448
- item = string_list_append(&states->push, "(matching)");
448
+ item = string_list_append(&states->push, _("(matching)"));
449
else if (strlen(spec->src))
450
item = string_list_append(&states->push, spec->src);
451
else
452
- item = string_list_append(&states->push, "(delete)");
452
+ item = string_list_append(&states->push, _("(delete)"));
453
454
info = item->util = xcalloc(sizeof(struct push_info), 1);
455
info->forced = spec->force;
@@ -592,19 +592,19 @@ static int migrate_file(struct remote *remote)
592
strbuf_addf(&buf, "remote.%s.url", remote->name);
593
for (i = 0; i < remote->url_nr; i++)
594
if (git_config_set_multivar(buf.buf, remote->url[i], "^$", 0))
595
- return error("Could not append '%s' to '%s'",
595
+ return error(_("Could not append '%s' to '%s'"),
596
remote->url[i], buf.buf);
597
strbuf_reset(&buf);
598
strbuf_addf(&buf, "remote.%s.push", remote->name);
599
for (i = 0; i < remote->push_refspec_nr; i++)
600
if (git_config_set_multivar(buf.buf, remote->push_refspec[i], "^$", 0))
601
- return error("Could not append '%s' to '%s'",
601
+ return error(_("Could not append '%s' to '%s'"),
602
remote->push_refspec[i], buf.buf);
603
strbuf_reset(&buf);
604
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
605
for (i = 0; i < remote->fetch_refspec_nr; i++)
606
if (git_config_set_multivar(buf.buf, remote->fetch_refspec[i], "^$", 0))
607
- return error("Could not append '%s' to '%s'",
607
+ return error(_("Could not append '%s' to '%s'"),
608
remote->fetch_refspec[i], buf.buf);
609
if (remote->origin == REMOTE_REMOTES)
610
path = git_path("remotes/%s", remote->name);
@@ -636,30 +636,30 @@ static int mv(int argc, const char **argv)
636
637
oldremote = remote_get(rename.old);
638
if (!oldremote)
639
- die("No such remote: %s", rename.old);
639
+ die(_("No such remote: %s"), rename.old);
640
641
if (!strcmp(rename.old, rename.new) && oldremote->origin != REMOTE_CONFIG)
642
return migrate_file(oldremote);
643
644
newremote = remote_get(rename.new);
645
if (newremote && (newremote->url_nr > 1 || newremote->fetch_refspec_nr))
646
- die("remote %s already exists.", rename.new);
646
+ die(_("remote %s already exists."), rename.new);
647
648
strbuf_addf(&buf, "refs/heads/test:refs/remotes/%s/test", rename.new);
649
if (!valid_fetch_refspec(buf.buf))
650
- die("'%s' is not a valid remote name", rename.new);
650
+ die(_("'%s' is not a valid remote name"), rename.new);
651
652
strbuf_reset(&buf);
653
strbuf_addf(&buf, "remote.%s", rename.old);
654
strbuf_addf(&buf2, "remote.%s", rename.new);
655
if (git_config_rename_section(buf.buf, buf2.buf) < 1)
656
- return error("Could not rename config section '%s' to '%s'",
656
+ return error(_("Could not rename config section '%s' to '%s'"),
657
buf.buf, buf2.buf);
658
659
strbuf_reset(&buf);
660
strbuf_addf(&buf, "remote.%s.fetch", rename.new);
661
if (git_config_set_multivar(buf.buf, NULL, NULL, 1))
662
- return error("Could not remove config section '%s'", buf.buf);
662
+ return error(_("Could not remove config section '%s'"), buf.buf);
663
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old);
664
for (i = 0; i < oldremote->fetch_refspec_nr; i++) {
665
char *ptr;
@@ -674,13 +674,13 @@ static int mv(int argc, const char **argv)
674
strlen(rename.old), rename.new,
675
strlen(rename.new));
676
} else
677
- warning("Not updating non-default fetch respec\n"
678
- "\t%s\n"
679
- "\tPlease update the configuration manually if necessary.",
677
+ warning(_("Not updating non-default fetch respec\n"
678
+ "\t%s\n"
679
+ "\tPlease update the configuration manually if necessary."),
680
buf2.buf);
681
682
if (git_config_set_multivar(buf.buf, buf2.buf, "^$", 0))
683
- return error("Could not append '%s'", buf.buf);
683
+ return error(_("Could not append '%s'"), buf.buf);
684
}
685
686
read_branches();
@@ -691,7 +691,7 @@ static int mv(int argc, const char **argv)
691
strbuf_reset(&buf);
692
strbuf_addf(&buf, "branch.%s.remote", item->string);
693
if (git_config_set(buf.buf, rename.new)) {
694
- return error("Could not set '%s'", buf.buf);
694
+ return error(_("Could not set '%s'"), buf.buf);
695
}
696
}
697
}
@@ -713,7 +713,7 @@ static int mv(int argc, const char **argv)
713
if (!(flag & REF_ISSYMREF))
714
continue;
715
if (delete_ref(item->string, NULL, REF_NODEREF))
716
- die("deleting '%s' failed", item->string);
716
+ die(_("deleting '%s' failed"), item->string);
717
}
718
for (i = 0; i < remote_branches.nr; i++) {
719
struct string_list_item *item = remote_branches.items + i;
@@ -728,7 +728,7 @@ static int mv(int argc, const char **argv)
728
strbuf_addf(&buf2, "remote: renamed %s to %s",
729
item->string, buf.buf);
730
if (rename_ref(item->string, buf.buf, buf2.buf))
731
- die("renaming '%s' failed", item->string);
731
+ die(_("renaming '%s' failed"), item->string);
732
}
733
for (i = 0; i < remote_branches.nr; i++) {
734
struct string_list_item *item = remote_branches.items + i;
@@ -747,7 +747,7 @@ static int mv(int argc, const char **argv)
747
strbuf_addf(&buf3, "remote: renamed %s to %s",
748
item->string, buf.buf);
749
if (create_symref(buf.buf, buf2.buf, buf3.buf))
750
- die("creating '%s' failed", buf.buf);
750
+ die(_("creating '%s' failed"), buf.buf);
751
}
752
return 0;
753
}
@@ -761,7 +761,7 @@ static int remove_branches(struct string_list *branches)
761
unsigned char *sha1 = item->util;
762
763
if (delete_ref(refname, sha1, 0))
764
- result |= error("Could not remove branch %s", refname);
764
+ result |= error(_("Could not remove branch %s"), refname);
765
}
766
return result;
767
}
@@ -789,14 +789,14 @@ static int rm(int argc, const char **argv)
789
790
remote = remote_get(argv[1]);
791
if (!remote)
792
- die("No such remote: %s", argv[1]);
792
+ die(_("No such remote: %s"), argv[1]);
793
794
known_remotes.to_delete = remote;
795
for_each_remote(add_known_remote, &known_remotes);
796
797
strbuf_addf(&buf, "remote.%s", remote->name);
798
if (git_config_rename_section(buf.buf, NULL) < 1)
799
- return error("Could not remove config section '%s'", buf.buf);
799
+ return error(_("Could not remove config section '%s'"), buf.buf);
800
801
read_branches();
802
for (i = 0; i < branch_list.nr; i++) {
@@ -830,11 +830,12 @@ static int rm(int argc, const char **argv)
830
string_list_clear(&branches, 1);
831
832
if (skipped.nr) {
833
- fprintf(stderr, skipped.nr == 1 ?
834
- "Note: A branch outside the refs/remotes/ hierarchy was not removed;\n"
835
- "to delete it, use:\n" :
836
- "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
837
- "to delete them, use:\n");
833
+ fprintf_ln(stderr,
834
+ Q_("Note: A branch outside the refs/remotes/ hierarchy was not removed;\n"
835
+ "to delete it, use:",
836
+ "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n"
837
+ "to delete them, use:",
838
+ skipped.nr));
839
for (i = 0; i < skipped.nr; i++)
840
fprintf(stderr, " git branch -d %s\n",
841
skipped.items[i].string);
@@ -886,7 +887,7 @@ static int get_remote_ref_states(const char *name,
887
888
states->remote = remote_get(name);
889
if (!states->remote)
889
- return error("No such remote: %s", name);
890
+ return error(_("No such remote: %s"), name);
891
892
read_branches();
893
@@ -939,14 +940,14 @@ static int show_remote_info_item(struct string_list_item *item, void *cb_data)
940
const char *fmt = "%s";
941
const char *arg = "";
942
if (string_list_has_string(&states->new, name)) {
942
- fmt = " new (next fetch will store in remotes/%s)";
943
+ fmt = _(" new (next fetch will store in remotes/%s)");
944
arg = states->remote->name;
945
} else if (string_list_has_string(&states->tracked, name))
945
- arg = " tracked";
946
+ arg = _(" tracked");
947
else if (string_list_has_string(&states->stale, name))
947
- arg = " stale (use 'git remote prune' to remove)";
948
+ arg = _(" stale (use 'git remote prune' to remove)");
949
else
949
- arg = " ???";
950
+ arg = _(" ???");
951
printf(" %-*s", info->width, name);
952
printf(fmt, arg);
953
printf("\n");
@@ -987,21 +988,21 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)
988
int i;
989
990
if (branch_info->rebase && branch_info->merge.nr > 1) {
990
- error("invalid branch.%s.merge; cannot rebase onto > 1 branch",
991
+ error(_("invalid branch.%s.merge; cannot rebase onto > 1 branch"),
992
item->string);
993
return 0;
994
}
995
996
printf(" %-*s ", show_info->width, item->string);
997
if (branch_info->rebase) {
997
- printf("rebases onto remote %s\n", merge->items[0].string);
998
+ printf_ln(_("rebases onto remote %s"), merge->items[0].string);
999
return 0;
1000
} else if (show_info->any_rebase) {
1000
- printf(" merges with remote %s\n", merge->items[0].string);
1001
- also = " and with remote";
1001
+ printf_ln(_(" merges with remote %s"), merge->items[0].string);
1002
+ also = _(" and with remote");
1003
} else {
1003
- printf("merges with remote %s\n", merge->items[0].string);
1004
- also = " and with remote";
1004
+ printf_ln(_("merges with remote %s"), merge->items[0].string);
1005
+ also = _(" and with remote");
1006
}
1007
for (i = 1; i < merge->nr; i++)
1008
printf(" %-*s %s %s\n", show_info->width, "", also,
@@ -1043,36 +1044,43 @@ static int show_push_info_item(struct string_list_item *item, void *cb_data)
1044
{
1045
struct show_info *show_info = cb_data;
1046
struct push_info *push_info = item->util;
1046
- char *src = item->string, *status = NULL;
1047
+ const char *src = item->string, *status = NULL;
1048
1049
switch (push_info->status) {
1050
case PUSH_STATUS_CREATE:
1050
- status = "create";
1051
+ status = _("create");
1052
break;
1053
case PUSH_STATUS_DELETE:
1053
- status = "delete";
1054
- src = "(none)";
1054
+ status = _("delete");
1055
+ src = _("(none)");
1056
break;
1057
case PUSH_STATUS_UPTODATE:
1057
- status = "up to date";
1058
+ status = _("up to date");
1059
break;
1060
case PUSH_STATUS_FASTFORWARD:
1060
- status = "fast-forwardable";
1061
+ status = _("fast-forwardable");
1062
break;
1063
case PUSH_STATUS_OUTOFDATE:
1063
- status = "local out of date";
1064
+ status = _("local out of date");
1065
break;
1066
case PUSH_STATUS_NOTQUERIED:
1067
break;
1068
}
1068
- if (status)
1069
- printf(" %-*s %s to %-*s (%s)\n", show_info->width, src,
1070
- push_info->forced ? "forces" : "pushes",
1071
- show_info->width2, push_info->dest, status);
1072
- else
1073
- printf(" %-*s %s to %s\n", show_info->width, src,
1074
- push_info->forced ? "forces" : "pushes",
1075
- push_info->dest);
1069
+ if (status) {
1070
+ if (push_info->forced)
1071
+ printf_ln(_(" %-*s forces to %-*s (%s)"), show_info->width, src,
1072
+ show_info->width2, push_info->dest, status);
1073
+ else
1074
+ printf_ln(_(" %-*s pushes to %-*s (%s)"), show_info->width, src,
1075
+ show_info->width2, push_info->dest, status);
1076
+ } else {
1077
+ if (push_info->forced)
1078
+ printf_ln(_(" %-*s forces to %s"), show_info->width, src,
1079
+ push_info->dest);
1080
+ else
1081
+ printf_ln(_(" %-*s pushes to %s"), show_info->width, src,
1082
+ push_info->dest);
1083
+ }
1084
return 0;
1085
}
1086
@@ -1107,9 +1115,9 @@ static int show(int argc, const char **argv)
1115
1116
get_remote_ref_states(*argv, &states, query_flag);
1117
1110
- printf("* remote %s\n", *argv);
1111
- printf(" Fetch URL: %s\n", states.remote->url_nr > 0 ?
1112
- states.remote->url[0] : "(no URL)");
1118
+ printf_ln(_("* remote %s"), *argv);
1119
+ printf_ln(_(" Fetch URL: %s"), states.remote->url_nr > 0 ?
1120
+ states.remote->url[0] : _("(no URL)"));
1121
if (states.remote->pushurl_nr) {
1122
url = states.remote->pushurl;
1123
url_nr = states.remote->pushurl_nr;
@@ -1118,18 +1126,18 @@ static int show(int argc, const char **argv)
1126
url_nr = states.remote->url_nr;
1127
}
1128
for (i = 0; i < url_nr; i++)
1121
- printf(" Push URL: %s\n", url[i]);
1129
+ printf_ln(_(" Push URL: %s"), url[i]);
1130
if (!i)
1123
- printf(" Push URL: %s\n", "(no URL)");
1131
+ printf_ln(_(" Push URL: %s"), "(no URL)");
1132
if (no_query)
1125
- printf(" HEAD branch: (not queried)\n");
1133
+ printf_ln(_(" HEAD branch: %s"), "(not queried)");
1134
else if (!states.heads.nr)
1127
- printf(" HEAD branch: (unknown)\n");
1135
+ printf_ln(_(" HEAD branch: %s"), "(unknown)");
1136
else if (states.heads.nr == 1)
1129
- printf(" HEAD branch: %s\n", states.heads.items[0].string);
1137
+ printf_ln(_(" HEAD branch: %s"), states.heads.items[0].string);
1138
else {
1131
- printf(" HEAD branch (remote HEAD is ambiguous,"
1132
- " may be one of the following):\n");
1139
+ printf(_(" HEAD branch (remote HEAD is ambiguous,"
1140
+ " may be one of the following):\n"));
1141
for (i = 0; i < states.heads.nr; i++)
1142
printf(" %s\n", states.heads.items[i].string);
1143
}
@@ -1140,9 +1148,10 @@ static int show(int argc, const char **argv)
1148
for_each_string_list(&states.tracked, add_remote_to_show_info, &info);
1149
for_each_string_list(&states.stale, add_remote_to_show_info, &info);
1150
if (info.list->nr)
1143
- printf(" Remote branch%s:%s\n",
1144
- info.list->nr > 1 ? "es" : "",
1145
- no_query ? " (status not queried)" : "");
1151
+ printf_ln(Q_(" Remote branch:%s",
1152
+ " Remote branches:%s",
1153
+ info.list->nr),
1154
+ no_query ? _(" (status not queried)") : "");
1155
for_each_string_list(info.list, show_remote_info_item, &info);
1156
string_list_clear(info.list, 0);
1157
@@ -1151,23 +1160,25 @@ static int show(int argc, const char **argv)
1160
info.any_rebase = 0;
1161
for_each_string_list(&branch_list, add_local_to_show_info, &info);
1162
if (info.list->nr)
1154
- printf(" Local branch%s configured for 'git pull':\n",
1155
- info.list->nr > 1 ? "es" : "");
1163
+ printf_ln(Q_(" Local branch configured for 'git pull':",
1164
+ " Local branches configured for 'git pull':",
1165
+ info.list->nr));
1166
for_each_string_list(info.list, show_local_info_item, &info);
1167
string_list_clear(info.list, 0);
1168
1169
/* git push info */
1170
if (states.remote->mirror)
1161
- printf(" Local refs will be mirrored by 'git push'\n");
1171
+ printf_ln(_(" Local refs will be mirrored by 'git push'"));
1172
1173
info.width = info.width2 = 0;
1174
for_each_string_list(&states.push, add_push_to_show_info, &info);
1175
qsort(info.list->items, info.list->nr,
1176
sizeof(*info.list->items), cmp_string_with_push);
1177
if (info.list->nr)
1168
- printf(" Local ref%s configured for 'git push'%s:\n",
1169
- info.list->nr > 1 ? "s" : "",
1170
- no_query ? " (status not queried)" : "");
1178
+ printf_ln(Q_(" Local ref configured for 'git push'%s:",
1179
+ " Local refs configured for 'git push'%s:",
1180
+ info.list->nr),
1181
+ no_query ? _(" (status not queried)") : "");
1182
for_each_string_list(info.list, show_push_info_item, &info);
1183
string_list_clear(info.list, 0);
1184
@@ -1202,10 +1213,10 @@ static int set_head(int argc, const char **argv)
1213
memset(&states, 0, sizeof(states));
1214
get_remote_ref_states(argv[0], &states, GET_HEAD_NAMES);
1215
if (!states.heads.nr)
1205
- result |= error("Cannot determine remote HEAD");
1216
+ result |= error(_("Cannot determine remote HEAD"));
1217
else if (states.heads.nr > 1) {
1207
- result |= error("Multiple remote HEAD branches. "
1208
- "Please choose one explicitly with:");
1218
+ result |= error(_("Multiple remote HEAD branches. "
1219
+ "Please choose one explicitly with:"));
1220
for (i = 0; i < states.heads.nr; i++)
1221
fprintf(stderr, " git remote set-head %s %s\n",
1222
argv[0], states.heads.items[i].string);
@@ -1214,7 +1225,7 @@ static int set_head(int argc, const char **argv)
1225
free_remote_ref_states(&states);
1226
} else if (opt_d && !opt_a && argc == 1) {
1227
if (delete_ref(buf.buf, NULL, REF_NODEREF))
1217
- result |= error("Could not delete %s", buf.buf);
1228
+ result |= error(_("Could not delete %s"), buf.buf);
1229
} else
1230
usage_with_options(builtin_remote_sethead_usage, options);
1231
@@ -1222,9 +1233,9 @@ static int set_head(int argc, const char **argv)
1233
strbuf_addf(&buf2, "refs/remotes/%s/%s", argv[0], head_name);
1234
/* make sure it's valid */
1235
if (!ref_exists(buf2.buf))
1225
- result |= error("Not a valid ref: %s", buf2.buf);
1236
+ result |= error(_("Not a valid ref: %s"), buf2.buf);
1237
else if (create_symref(buf.buf, buf2.buf, "remote set-head"))
1227
- result |= error("Could not setup %s", buf.buf);
1238
+ result |= error(_("Could not setup %s"), buf.buf);
1239
if (opt_a)
1240
printf("%s/HEAD set to %s\n", argv[0], head_name);
1241
free(head_name);
@@ -1260,18 +1271,18 @@ static int prune_remote(const char *remote, int dry_run)
1271
int result = 0, i;
1272
struct ref_states states;
1273
const char *dangling_msg = dry_run
1263
- ? " %s will become dangling!"
1264
- : " %s has become dangling!";
1274
+ ? _(" %s will become dangling!")
1275
+ : _(" %s has become dangling!");
1276
1277
memset(&states, 0, sizeof(states));
1278
get_remote_ref_states(remote, &states, GET_REF_STATES);
1279
1280
if (states.stale.nr) {
1270
- printf("Pruning %s\n", remote);
1271
- printf("URL: %s\n",
1281
+ printf_ln(_("Pruning %s"), remote);
1282
+ printf_ln(_("URL: %s"),
1283
states.remote->url_nr
1284
? states.remote->url[0]
1274
- : "(no URL)");
1285
+ : _("(no URL)"));
1286
}
1287
1288
for (i = 0; i < states.stale.nr; i++) {
@@ -1280,8 +1291,12 @@ static int prune_remote(const char *remote, int dry_run)
1291
if (!dry_run)
1292
result |= delete_ref(refname, NULL, 0);
1293
1283
- printf(" * [%s] %s\n", dry_run ? "would prune" : "pruned",
1284
- abbrev_ref(refname, "refs/remotes/"));
1294
+ if (dry_run)
1295
+ printf_ln(_(" * [would prune] %s"),
1296
+ abbrev_ref(refname, "refs/remotes/"));
1297
+ else
1298
+ printf_ln(_(" * [pruned] %s"),
1299
+ abbrev_ref(refname, "refs/remotes/"));
1300
warn_dangling_symref(stdout, dangling_msg, refname);
1301
}
1302
@@ -1369,7 +1384,7 @@ static int set_remote_branches(const char *remotename, const char **branches,
1384
strbuf_addf(&key, "remote.%s.fetch", remotename);
1385
1386
if (!remote_is_configured(remotename))
1372
- die("No such remote '%s'", remotename);
1387
+ die(_("No such remote '%s'"), remotename);
1388
remote = remote_get(remotename);
1389
1390
if (!add_mode && remove_all_fetch_refspecs(remotename, key.buf)) {
@@ -1396,7 +1411,7 @@ static int set_branches(int argc, const char **argv)
1411
argc = parse_options(argc, argv, NULL, options,
1412
builtin_remote_setbranches_usage, 0);
1413
if (argc == 0) {
1399
- error("no remote specified");
1414
+ error(_("no remote specified"));
1415
usage_with_options(builtin_remote_setbranches_usage, options);
1416
}
1417
argv[argc] = NULL;
@@ -1429,7 +1444,7 @@ static int set_url(int argc, const char **argv)
1444
PARSE_OPT_KEEP_ARGV0);
1445
1446
if (add_mode && delete_mode)
1432
- die("--add --delete doesn't make sense");
1447
+ die(_("--add --delete doesn't make sense"));
1448
1449
if (argc < 3 || argc > 4 || ((add_mode || delete_mode) && argc != 3))
1450
usage_with_options(builtin_remote_seturl_usage, options);
@@ -1443,7 +1458,7 @@ static int set_url(int argc, const char **argv)
1458
oldurl = newurl;
1459
1460
if (!remote_is_configured(remotename))
1446
- die("No such remote '%s'", remotename);
1461
+ die(_("No such remote '%s'"), remotename);
1462
remote = remote_get(remotename);
1463
1464
if (push_mode) {
@@ -1469,7 +1484,7 @@ static int set_url(int argc, const char **argv)
1484
1485
/* Old URL specified. Demand that one matches. */
1486
if (regcomp(&old_regex, oldurl, REG_EXTENDED))
1472
- die("Invalid old URL pattern: %s", oldurl);
1487
+ die(_("Invalid old URL pattern: %s"), oldurl);
1488
1489
for (i = 0; i < urlset_nr; i++)
1490
if (!regexec(&old_regex, urlset[i], 0, NULL, 0))
@@ -1477,9 +1492,9 @@ static int set_url(int argc, const char **argv)
1492
else
1493
negative_matches++;
1494
if (!delete_mode && !matches)
1480
- die("No such URL found: %s", oldurl);
1495
+ die(_("No such URL found: %s"), oldurl);
1496
if (delete_mode && !negative_matches && !push_mode)
1482
- die("Will not delete all non-push URLs");
1497
+ die(_("Will not delete all non-push URLs"));
1498
1499
regfree(&old_regex);
1500
@@ -1580,7 +1595,7 @@ int cmd_remote(int argc, const char **argv, const char *prefix)
1595
else if (!strcmp(argv[0], "update"))
1596
result = update(argc, argv);
1597
else {
1583
- error("Unknown subcommand: %s", argv[0]);
1598
+ error(_("Unknown subcommand: %s"), argv[0]);
1599
usage_with_options(builtin_remote_usage, options);
1600
}
1601