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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Oct 21, 2016 at 14:26 UTC
c28cbc5ea673da46acb9f4b4fcc3e761b6661513
1 file changed
+7
-7
sequencer.c
+7
-7
@@ -168,7 +168,7 @@ int sequencer_remove_state(struct replay_opts *opts)
168
169
static const char *action_name(const struct replay_opts *opts)
170
{
171
- return opts->action == REPLAY_REVERT ? "revert" : "cherry-pick";
171
+ return opts->action == REPLAY_REVERT ? N_("revert") : N_("cherry-pick");
172
}
173
174
struct commit_message {
@@ -300,10 +300,10 @@ static struct tree *empty_tree(void)
300
static int error_dirty_index(struct replay_opts *opts)
301
{
302
if (read_cache_unmerged())
303
- return error_resolve_conflict(action_name(opts));
303
+ return error_resolve_conflict(_(action_name(opts)));
304
305
error(_("Your local changes would be overwritten by %s."),
306
- action_name(opts));
306
+ _(action_name(opts)));
307
308
if (advice_commit_before_merge)
309
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,
321
if (checkout_fast_forward(from, to, 1))
322
return -1; /* the callee should have complained already */
323
324
- strbuf_addf(&sb, _("%s: fast-forward"), action_name(opts));
324
+ strbuf_addf(&sb, _("%s: fast-forward"), _(action_name(opts)));
325
326
transaction = ref_transaction_begin(&err);
327
if (!transaction ||
@@ -397,7 +397,7 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
397
write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
398
/* TRANSLATORS: %s will be "revert" or "cherry-pick" */
399
return error(_("%s: Unable to write new index file"),
400
- action_name(opts));
400
+ _(action_name(opts)));
401
rollback_lock_file(&index_lock);
402
403
if (opts->signoff)
@@ -835,14 +835,14 @@ static int read_and_refresh_cache(struct replay_opts *opts)
835
if (read_index_preload(&the_index, NULL) < 0) {
836
rollback_lock_file(&index_lock);
837
return error(_("git %s: failed to read the index"),
838
- action_name(opts));
838
+ _(action_name(opts)));
839
}
840
refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
841
if (the_index.cache_changed && index_fd >= 0) {
842
if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK)) {
843
rollback_lock_file(&index_lock);
844
return error(_("git %s: failed to refresh the index"),
845
- action_name(opts));
845
+ _(action_name(opts)));
846
}
847
}
848
rollback_lock_file(&index_lock);