i18n: advice: internationalize message for conflicts
authorVasco Almeida <vascomalmeida@sapo.pt>
Fri, 17 Jun 2016 20:20:52 +0000 (20:20 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 17 Jun 2016 22:45:48 +0000 (15:45 -0700)
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>
advice.c
builtin/pull.c
t/t5520-pull.sh
index cb445a7e94d9b78e5a247b6fe65f85b96be5c650..b84ae4960f11af10d01667d01eb0bb27f52ecb14 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -79,7 +79,20 @@ int git_default_advice_config(const char *var, const char *value)
 
 int error_resolve_conflict(const char *me)
 {
-       error("%s is not possible because you have unmerged files.", me);
+       if (!strcmp(me, "cherry-pick"))
+               error(_("Cherry-picking is not possible because you have unmerged files."));
+       else if (!strcmp(me, "commit"))
+               error(_("Committing is not possible because you have unmerged files."));
+       else if (!strcmp(me, "merge"))
+               error(_("Merging is not possible because you have unmerged files."));
+       else if (!strcmp(me, "pull"))
+               error(_("Pulling is not possible because you have unmerged files."));
+       else if (!strcmp(me, "revert"))
+               error(_("Reverting is not possible because you have unmerged files."));
+       else
+               error(_("It is not possible to %s because you have unmerged files."),
+                       me);
+
        if (advice_resolve_conflict)
                /*
                 * Message used both when 'git commit' fails and when
@@ -93,7 +106,7 @@ int error_resolve_conflict(const char *me)
 void NORETURN die_resolve_conflict(const char *me)
 {
        error_resolve_conflict(me);
-       die("Exiting because of an unresolved conflict.");
+       die(_("Exiting because of an unresolved conflict."));
 }
 
 void NORETURN die_conclude_merge(void)
index 1d7333c8a11f7aedf244c99f5ac67bea7fccaab4..a980dcfe9b28e40402be6227e6fb5531f77e6a77 100644 (file)
@@ -852,7 +852,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
        git_config(git_pull_config, NULL);
 
        if (read_cache_unmerged())
-               die_resolve_conflict("Pull");
+               die_resolve_conflict("pull");
 
        if (file_exists(git_path("MERGE_HEAD")))
                die_conclude_merge();
index 739c089d500f76cbf726f0083062420a51874fc1..45e44cac6be8d8f719893853719882774f07432d 100755 (executable)
@@ -211,7 +211,7 @@ test_expect_success 'fail if the index has unresolved entries' '
        test -n "$(git ls-files -u)" &&
        cp file expected &&
        test_must_fail git pull . second 2>err &&
-       test_i18ngrep "Pull is not possible because you have unmerged files" err &&
+       test_i18ngrep "Pulling is not possible because you have unmerged files." err &&
        test_cmp expected file &&
        git add file &&
        test -z "$(git ls-files -u)" &&