git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] submodule: avoid sentence-lego in translated string

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Oct 8, 2017, 08:48 UTC
Message-ID
<20171008084824.5331-1-martin.agren@gmail.com>
In-Reply-To
<CANYiYbGHBDGMEjbrvX_ayXkXkciT3GgL4seM_X1NmWtud2upcg@mail.gmail.com>

We currently build an error message like "entry is a %s, not a commit", where the placeholder will be replaced with "blob", "tag" or "tree". Apart from those three placeholder words not being translated, in some languages it might be awkward or impossible to ensure a grammatically correct end result.

Shorten the error message to "entry is not a commit". We will still error out, we will still give a hint about what is wrong, but we will not be as explicit as before.

Alternatively, we could have different switch-cases for the different types and pick one of three different error messages. We might still want a `default` and maybe more tests. So go for this simpler approach instead.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
I browsed the diff of the .pot and found an addition that looked a bit
translation-unfriendly. Maybe something like this?
 submodule.c                    | 4 ++--
 t/t5531-deep-submodule-push.sh | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/submodule.c b/submodule.c
index 63e7094e1..3d91dbfd5 100644
--- a/submodule.c
+++ b/submodule.c
@@ -796,8 +796,8 @@ static int check_has_commit(const struct object_id *oid, void *data)
 		cb->result = 0;
 		return 0;
 	default:
-		die(_("submodule entry '%s' (%s) is a %s, not a commit"),
-		    cb->path, oid_to_hex(oid), typename(type));
+		die(_("submodule entry '%s' (%s) is not a commit"),
+		    cb->path, oid_to_hex(oid));
 	}
 }
 
diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh
index 39cb2c1c3..e4c98bbc5 100755
--- a/t/t5531-deep-submodule-push.sh
+++ b/t/t5531-deep-submodule-push.sh
@@ -305,7 +305,7 @@ test_expect_success 'submodule entry pointing at a tag is error' '
 	git -C work commit -m "bad commit" &&
 	test_when_finished "git -C work reset --hard HEAD^" &&
 	test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git master 2>err &&
-	test_i18ngrep "is a tag, not a commit" err
+	test_i18ngrep "is not a commit" err
 '
 
 test_expect_success 'push fails if recurse submodules option passed as yes' '
-- 
2.15.0.rc0.37.gd35688db1
Previous: Jiang XinNext: Philip Oakley
Message 2 of 13 in “[L10N] Kickoff of translation for Git 2.15.0 round 1”
  1. Jiang XinOct 8, 2017
  2. submodule: avoid sentence-lego in translated stringMartin Ågren, Oct 8, 2017
  3. Philip OakleyOct 8, 2017
  4. Martin ÅgrenOct 8, 2017
  5. brian m. carlsonOct 9, 2017
  6. Junio C HamanoOct 9, 2017
  7. Martin ÅgrenOct 9, 2017
  8. Stefan BellerOct 9, 2017
  9. Jean-Noël AVILAOct 9, 2017
  10. Junio C HamanoOct 10, 2017
  11. Changwoo RyuOct 10, 2017
  12. Martin ÅgrenOct 10, 2017
  13. i18n: add a missing space in messageJean-Noel Avila, Oct 8, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.