From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vasco Almeida Subject: [PATCH v4 03/38] i18n: advice: internationalize message for conflicts Date: Tue, 7 Jun 2016 11:52:02 +0000 Message-ID: <1465300357-7557-4-git-send-email-vascomalmeida@sapo.pt> References: <1465300357-7557-1-git-send-email-vascomalmeida@sapo.pt> Cc: Vasco Almeida , Jiang Xin , =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= , Sunshine , Junio C Hamano To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Tue Jun 07 13:55:16 2016 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bAFav-0007al-AB for gcvg-git-2@plane.gmane.org; Tue, 07 Jun 2016 13:54:53 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161133AbcFGLys (ORCPT ); Tue, 7 Jun 2016 07:54:48 -0400 Received: from relay5.ptmail.sapo.pt ([212.55.154.25]:57696 "EHLO sapo.pt" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752515AbcFGLxj (ORCPT ); Tue, 7 Jun 2016 07:53:39 -0400 Received: (qmail 32606 invoked from network); 7 Jun 2016 11:53:37 -0000 Received: (qmail 9586 invoked from network); 7 Jun 2016 11:53:37 -0000 Received: from unknown (HELO localhost.localdomain) (vascomalmeida@sapo.pt@[85.246.157.91]) (envelope-sender ) by ptmail-mta-auth02 (qmail-ptmail-1.0.0) with ESMTPA for ; 7 Jun 2016 11:53:35 -0000 X-PTMail-RemoteIP: 85.246.157.91 X-PTMail-AllowedSender-Action: X-PTMail-Service: default X-Mailer: git-send-email 2.7.3 In-Reply-To: <1465300357-7557-1-git-send-email-vascomalmeida@sapo.pt> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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 --- advice.c | 17 +++++++++++++++-- builtin/pull.c | 2 +- t/t5520-pull.sh | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/advice.c b/advice.c index cb445a7..b84ae49 100644 --- 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) diff --git a/builtin/pull.c b/builtin/pull.c index 1d7333c..a980dcf 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -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(); diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 739c089..45e44ca 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -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)" && -- 2.7.3