Web lists-archives.com

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




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@xxxxxxxxx>
---
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