i18n: advice: internationalize message for conflicts
Mark message for translation telling the user she has conflicts to resolve. Expose each particular use case, in order to enable translating entire sentences which would facilitate translating into other languages. Change "Pull" to lowercase to match other instances. Update test t5520-pull.sh, that relied on the old error message, to use the new one. Although we loose in source code conciseness, we would gain better translations because translators can 1) translate the entire sentence, including those terms concerning Git (committing, merging, etc) 2) have leeway to adapt to their languages. Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Vasco Almeida committed
Jun 17, 2016 at 20:20 UTC
8785c425320e9288d13f0218e591a8aa5c57479c
3 files changed
+17
-4
advice.c
+15
-2
@@ -79,7 +79,20 @@ int git_default_advice_config(const char *var, const char *value)
79
80
int error_resolve_conflict(const char *me)
81
{
82
- error("%s is not possible because you have unmerged files.", me);
82
+ if (!strcmp(me, "cherry-pick"))
83
+ error(_("Cherry-picking is not possible because you have unmerged files."));
84
+ else if (!strcmp(me, "commit"))
85
+ error(_("Committing is not possible because you have unmerged files."));
86
+ else if (!strcmp(me, "merge"))
87
+ error(_("Merging is not possible because you have unmerged files."));
88
+ else if (!strcmp(me, "pull"))
89
+ error(_("Pulling is not possible because you have unmerged files."));
90
+ else if (!strcmp(me, "revert"))
91
+ error(_("Reverting is not possible because you have unmerged files."));
92
+ else
93
+ error(_("It is not possible to %s because you have unmerged files."),
94
+ me);
95
+
96
if (advice_resolve_conflict)
97
/*
98
* Message used both when 'git commit' fails and when
@@ -93,7 +106,7 @@ int error_resolve_conflict(const char *me)
106
void NORETURN die_resolve_conflict(const char *me)
107
{
108
error_resolve_conflict(me);
96
- die("Exiting because of an unresolved conflict.");
109
+ die(_("Exiting because of an unresolved conflict."));
110
}
111
112
void NORETURN die_conclude_merge(void)
builtin/pull.c
+1
-1
@@ -852,7 +852,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
852
git_config(git_pull_config, NULL);
853
854
if (read_cache_unmerged())
855
- die_resolve_conflict("Pull");
855
+ die_resolve_conflict("pull");
856
857
if (file_exists(git_path("MERGE_HEAD")))
858
die_conclude_merge();
t/t5520-pull.sh
+1
-1
@@ -211,7 +211,7 @@ test_expect_success 'fail if the index has unresolved entries' '
211
test -n "$(git ls-files -u)" &&
212
cp file expected &&
213
test_must_fail git pull . second 2>err &&
214
- test_i18ngrep "Pull is not possible because you have unmerged files" err &&
214
+ test_i18ngrep "Pulling is not possible because you have unmerged files." err &&
215
test_cmp expected file &&
216
git add file &&
217
test -z "$(git ls-files -u)" &&