Skip to content

Commit c28cbc5

Browse files
dschogitster
authored andcommitted
sequencer: mark action_name() for translation
The definition of this function goes back all the way to 043a449 (sequencer: factor code out of revert builtin, 2012-01-11), long before a serious effort was made to translate all the error messages. It is slightly out of the context of the current patch series (whose purpose it is to re-implement the performance critical parts of the interactive rebase in C) to make the error messages in the sequencer translatable, but what the heck. We'll just do it while we're looking at this part of the code. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2eeaf1b commit c28cbc5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

sequencer.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ int sequencer_remove_state(struct replay_opts *opts)
168168

169169
static const char *action_name(const struct replay_opts *opts)
170170
{
171-
return opts->action == REPLAY_REVERT ? "revert" : "cherry-pick";
171+
return opts->action == REPLAY_REVERT ? N_("revert") : N_("cherry-pick");
172172
}
173173

174174
struct commit_message {
@@ -300,10 +300,10 @@ static struct tree *empty_tree(void)
300300
static int error_dirty_index(struct replay_opts *opts)
301301
{
302302
if (read_cache_unmerged())
303-
return error_resolve_conflict(action_name(opts));
303+
return error_resolve_conflict(_(action_name(opts)));
304304

305305
error(_("Your local changes would be overwritten by %s."),
306-
action_name(opts));
306+
_(action_name(opts)));
307307

308308
if (advice_commit_before_merge)
309309
advise(_("Commit your changes or stash them to proceed."));
@@ -321,7 +321,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,
321321
if (checkout_fast_forward(from, to, 1))
322322
return -1; /* the callee should have complained already */
323323

324-
strbuf_addf(&sb, _("%s: fast-forward"), action_name(opts));
324+
strbuf_addf(&sb, _("%s: fast-forward"), _(action_name(opts)));
325325

326326
transaction = ref_transaction_begin(&err);
327327
if (!transaction ||
@@ -397,7 +397,7 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
397397
write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
398398
/* TRANSLATORS: %s will be "revert" or "cherry-pick" */
399399
return error(_("%s: Unable to write new index file"),
400-
action_name(opts));
400+
_(action_name(opts)));
401401
rollback_lock_file(&index_lock);
402402

403403
if (opts->signoff)
@@ -835,14 +835,14 @@ static int read_and_refresh_cache(struct replay_opts *opts)
835835
if (read_index_preload(&the_index, NULL) < 0) {
836836
rollback_lock_file(&index_lock);
837837
return error(_("git %s: failed to read the index"),
838-
action_name(opts));
838+
_(action_name(opts)));
839839
}
840840
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
841841
if (the_index.cache_changed && index_fd >= 0) {
842842
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK)) {
843843
rollback_lock_file(&index_lock);
844844
return error(_("git %s: failed to refresh the index"),
845-
action_name(opts));
845+
_(action_name(opts)));
846846
}
847847
}
848848
rollback_lock_file(&index_lock);

0 commit comments

Comments
 (0)