git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Teng Long <dyroneteng@gmail.com>
Cc: derrickstolee@github.com, git@vger.kernel.org, gitster@pobox.com,
	me@ttaylorr.com, tenglong.tl@alibaba-inc.com,
	git@jeffhostetler.com
Subject: Re: [PATCH v5 4/5] pack-bitmap.c: retrieve missing i18n translations
Date: Tue, 28 Jun 2022 10:58:56 +0200	[thread overview]
Message-ID: <220628.86sfnpf96x.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <065b7c9ccb5a412526a934f9b67c8be64a40fc7f.1656403084.git.dyroneteng@gmail.com>


On Tue, Jun 28 2022, Teng Long wrote:

> In pack-bitmap.c, some printed texts are translated,some are not.
> Let's support the translations of the bitmap related output.

Usually we don't go for cleanup-while-at-it, but in this case we're
marking messages that don't conform to our CodingGudielines for
translation, mostly because they're error messages that start with an
upper-case letter.

So I think we should fix those issues first, to avoid double-work for
translators (well, a bit less, since they're the translation memory, but
it's quite a bit of churn...).

> -		error("Failed to load bitmap index (corrupted?)");
> +		error(_("Failed to load bitmap index (corrupted?)"));

e.g. here.

> -		return error("Corrupted bitmap index (too small)");
> +		return error(_("Corrupted bitmap index (too small)"));

..and here, etc. etc.

> -		return error("Unsupported version for bitmap index file (%d)", index->version);
> +		return error(_("Unsupported version for bitmap index file (%d)"), index->version);

Let's say "unsupported version '%d' for ..." instead?

> -			return error("Unsupported options for bitmap index file "
> -				"(Git requires BITMAP_OPT_FULL_DAG)");
> +			return error(_("Unsupported options for bitmap index file "
> +				"(Git requires BITMAP_OPT_FULL_DAG)"));

I'm not sure, but shouldn't this be a BUG()?

> -		error("Duplicate entry in bitmap index: %s", oid_to_hex(oid));
> +		error(_("Duplicate entry in bitmap index: %s"), oid_to_hex(oid));

Ditto upper-case, but add '%s' while at it.

>  	if (!strip_suffix(p->pack_name, ".pack", &len))
> -		BUG("pack_name does not end in .pack");
> +		BUG(_("pack_name does not end in .pack"));

Do not translate BUG() messages.

> -		warning("ignoring extra bitmap file: %s", buf.buf);
> +		warning(_("ignoring extra bitmap file: %s"), buf.buf);

Quote the name.

> -		warning("ignoring extra bitmap file: %s", packfile->pack_name);
> +		warning(_("ignoring extra bitmap file: %s"), packfile->pack_name);

ditto.

>  		if (prepare_revision_walk(revs))
> -			die("revision walk setup failed");
> +			die(_("revision walk setup failed"));

Looks good, but aside from this we should really have a tree-wide
xprepare_revision_walk() or something, we have this copy/pasted all over
the place...


> -		BUG("filter_bitmap_tree_depth given non-zero limit");
> +		BUG(_("filter_bitmap_tree_depth given non-zero limit"));

Ditto BUG.
>  
>  	filter_bitmap_exclude_type(bitmap_git, tip_objects, to_filter,
>  				   OBJ_TREE);
> @@ -1148,7 +1148,7 @@ static void filter_bitmap_object_type(struct bitmap_index *bitmap_git,
>  				      enum object_type object_type)
>  {
>  	if (object_type < OBJ_COMMIT || object_type > OBJ_TAG)
> -		BUG("filter_bitmap_object_type given invalid object");
> +		BUG(_("filter_bitmap_object_type given invalid object"));
>  
>  	if (object_type != OBJ_TAG)
>  		filter_bitmap_exclude_type(bitmap_git, tip_objects, to_filter, OBJ_TAG);
> @@ -1304,14 +1304,14 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
>  		revs->ignore_missing_links = 0;
>  
>  		if (haves_bitmap == NULL)
> -			BUG("failed to perform bitmap walk");
> +			BUG(_("failed to perform bitmap walk"));
>  	}

etc. etc.

>  
>  	wants_bitmap = find_objects(bitmap_git, revs, wants, haves_bitmap,
>  				    filter);
>  
>  	if (!wants_bitmap)
> -		BUG("failed to perform bitmap walk");
> +		BUG(_("failed to perform bitmap walk"));
>  
>  	if (haves_bitmap)
>  		bitmap_and_not(wants_bitmap, haves_bitmap);
> @@ -1432,7 +1432,7 @@ uint32_t midx_preferred_pack(struct bitmap_index *bitmap_git)
>  {
>  	struct multi_pack_index *m = bitmap_git->midx;
>  	if (!m)
> -		BUG("midx_preferred_pack: requires non-empty MIDX");
> +		BUG(_("midx_preferred_pack: requires non-empty MIDX"));

etc. etc.

>  	return nth_midxed_pack_int_id(m, pack_pos_to_midx(bitmap_git->midx, 0));
>  }
>  
> @@ -1629,15 +1629,15 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
>  	}
>  
>  	if (bitmap_type == OBJ_NONE)
> -		die("object %s not found in type bitmaps",
> +		die(_("object %s not found in type bitmaps"),
>  		    oid_to_hex(&obj->oid));
>  
>  	if (bitmaps_nr > 1)
> -		die("object %s does not have a unique type",
> +		die(_("object %s does not have a unique type"),
>  		    oid_to_hex(&obj->oid));
>  
>  	if (bitmap_type != obj->type)
> -		die("object %s: real type %s, expected: %s",
> +		die(_("object %s: real type %s, expected: %s"),
>  		    oid_to_hex(&obj->oid),
>  		    type_name(obj->type),
>  		    type_name(bitmap_type));

quote %s for these.

> @@ -1651,7 +1651,7 @@ static void test_show_object(struct object *object, const char *name,
>  
>  	bitmap_pos = bitmap_position(tdata->bitmap_git, &object->oid);
>  	if (bitmap_pos < 0)
> -		die("Object not in bitmap: %s\n", oid_to_hex(&object->oid));
> +		die(_("Object not in bitmap: %s\n"), oid_to_hex(&object->oid));

Lose the \n here, in addition to lower-case & quote %s.

>  	test_bitmap_type(tdata, object, bitmap_pos);
>  
>  	bitmap_set(tdata->base, bitmap_pos);
> @@ -1666,7 +1666,7 @@ static void test_show_commit(struct commit *commit, void *data)
>  	bitmap_pos = bitmap_position(tdata->bitmap_git,
>  				     &commit->object.oid);
>  	if (bitmap_pos < 0)
> -		die("Object not in bitmap: %s\n", oid_to_hex(&commit->object.oid));
> +		die(_("Object not in bitmap: %s\n"), oid_to_hex(&commit->object.oid));

Ditto.

>  	test_bitmap_type(tdata, &commit->object, bitmap_pos);
>  
>  	bitmap_set(tdata->base, bitmap_pos);
> @@ -1683,26 +1683,26 @@ void test_bitmap_walk(struct rev_info *revs)
>  	struct ewah_bitmap *bm;
>  
>  	if (!(bitmap_git = prepare_bitmap_git(revs->repo)))
> -		die("failed to load bitmap indexes");
> +		die(_("failed to load bitmap indexes"));
>  
>  	if (revs->pending.nr != 1)
> -		die("you must specify exactly one commit to test");
> +		die(_("you must specify exactly one commit to test"));
>  
> -	fprintf(stderr, "Bitmap v%d test (%d entries loaded)\n",
> +	fprintf(stderr, _("Bitmap v%d test (%d entries loaded)\n"),
>  		bitmap_git->version, bitmap_git->entry_count);
>  
>  	root = revs->pending.objects[0].item;
>  	bm = bitmap_for_commit(bitmap_git, (struct commit *)root);
>  
>  	if (bm) {
> -		fprintf(stderr, "Found bitmap for %s. %d bits / %08x checksum\n",
> +		fprintf(stderr, _("Found bitmap for %s. %d bits / %08x checksum\n"),
>  			oid_to_hex(&root->oid), (int)bm->bit_size, ewah_checksum(bm));
>  
>  		result = ewah_to_bitmap(bm);
>  	}
>  
>  	if (result == NULL)
> -		die("Commit %s doesn't have an indexed bitmap", oid_to_hex(&root->oid));
> +		die(_("Commit %s doesn't have an indexed bitmap"), oid_to_hex(&root->oid));
>  
>  	revs->tag_objects = 1;
>  	revs->tree_objects = 1;
> @@ -1711,7 +1711,7 @@ void test_bitmap_walk(struct rev_info *revs)
>  	result_popcnt = bitmap_popcount(result);
>  
>  	if (prepare_revision_walk(revs))
> -		die("revision walk setup failed");
> +		die(_("revision walk setup failed"));
>  
>  	tdata.bitmap_git = bitmap_git;
>  	tdata.base = bitmap_new();
> @@ -1719,7 +1719,7 @@ void test_bitmap_walk(struct rev_info *revs)
>  	tdata.trees = ewah_to_bitmap(bitmap_git->trees);
>  	tdata.blobs = ewah_to_bitmap(bitmap_git->blobs);
>  	tdata.tags = ewah_to_bitmap(bitmap_git->tags);
> -	tdata.prg = start_progress("Verifying bitmap entries", result_popcnt);
> +	tdata.prg = start_progress(_("Verifying bitmap entries"), result_popcnt);

Good catch!
>  	tdata.seen = 0;
>  
>  	traverse_commit_list(revs, &test_show_commit, &test_show_object, &tdata);
> @@ -1727,9 +1727,9 @@ void test_bitmap_walk(struct rev_info *revs)
>  	stop_progress(&tdata.prg);
>  
>  	if (bitmap_equals(result, tdata.base))
> -		fprintf(stderr, "OK!\n");
> +		fprintf(stderr, _("OK!\n"));

Ditto don't include \n.
>  	else
> -		die("mismatch in bitmap results");
> +		die(_("mismatch in bitmap results"));
>  
>  	bitmap_free(result);
>  	bitmap_free(tdata.base);
> @@ -1747,7 +1747,7 @@ int test_bitmap_commits(struct repository *r)
>  	MAYBE_UNUSED void *value;
>  
>  	if (!bitmap_git)
> -		die("failed to load bitmap indexes");
> +		die(_("failed to load bitmap indexes"));
>  
>  	kh_foreach(bitmap_git->bitmaps, oid, value, {
>  		printf("%s\n", oid_to_hex(&oid));
> @@ -1825,8 +1825,8 @@ uint32_t *create_bitmap_mapping(struct bitmap_index *bitmap_git,
>  	if (!bitmap_is_midx(bitmap_git))
>  		load_reverse_index(bitmap_git);
>  	else if (load_midx_revindex(bitmap_git->midx) < 0)
> -		BUG("rebuild_existing_bitmaps: missing required rev-cache "
> -		    "extension");
> +		BUG(_("rebuild_existing_bitmaps: missing required rev-cache "
> +		    "extension"));
>  

Ditto don't translate BUG().

  reply	other threads:[~2022-06-28  9:09 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 11:43 [PATCH v1 0/3] trace2 output for bitmap decision path Teng Long
2022-03-24 11:43 ` [PATCH v1 1/3] pack-bitmap.c: use "ret" in "open_midx_bitmap()" Teng Long
2022-03-24 19:11   ` Taylor Blau
2022-03-28  7:59     ` [PATCH v1 1/3] pack-bitmap.c: use "ret" in "open_midx_bitmap() Teng Long
2022-03-30  2:39       ` Taylor Blau
2022-03-24 11:44 ` [PATCH v1 2/3] pack-bitmap.c: add "break" statement in "open_pack_bitmap()" Teng Long
2022-03-24 18:40   ` Junio C Hamano
2022-03-24 19:06     ` Taylor Blau
2022-03-24 19:03   ` Taylor Blau
2022-03-29  2:49     ` Teng Long
2022-03-30  2:55       ` Taylor Blau
2022-03-30  7:32         ` Teng Long Teng Long
2022-03-30 13:17           ` Ævar Arnfjörð Bjarmason
2022-03-24 11:44 ` [PATCH v1 3/3] bitmap: add trace outputs during open "bitmap" file Teng Long
2022-03-24 18:42   ` Junio C Hamano
2022-03-24 13:22 ` [PATCH v1 0/3] trace2 output for bitmap decision path Ævar Arnfjörð Bjarmason
2022-03-29  7:38   ` Teng Long Teng Long
2022-03-29  8:54     ` Ævar Arnfjörð Bjarmason
2022-04-21 13:26 ` [PATCH v2 0/5] trace2 output for bitmap decision path Teng Long
2022-04-21 13:26   ` [PATCH v2 1/5] pack-bitmap.c: continue looping when first MIDX bitmap is found Teng Long
2022-05-11 21:31     ` Taylor Blau
2022-04-21 13:26   ` [PATCH v2 2/5] pack-bitmap.c: rename "idx_name" to "bitmap_name" Teng Long
2022-05-11 21:31     ` Taylor Blau
2022-04-21 13:26   ` [PATCH v2 3/5] pack-bitmap.c: make warnings more detailed when opening bitmap Teng Long
2022-04-21 17:25     ` Taylor Blau
2022-05-06  9:08       ` Teng Long
2022-04-21 13:26   ` [PATCH v2 4/5] bitmap: add trace2 outputs during open "bitmap" file Teng Long
2022-04-21 15:51     ` Ævar Arnfjörð Bjarmason
2022-05-06 11:27       ` Teng Long
2022-05-06 11:53       ` Teng Long
2022-04-21 16:32     ` Jeff Hostetler
2022-05-06 12:43       ` Teng Long
2022-05-10 20:47         ` Jeff Hostetler
2022-04-21 13:26   ` [PATCH v2 5/5] pack-bitmap.c: using error() instead of silently returning -1 Teng Long
2022-04-21 15:41     ` Ævar Arnfjörð Bjarmason
2022-05-06 12:55       ` Teng Long
2022-06-12  7:44   ` [PATCH v3 0/5] Teng Long
2022-06-12  7:44     ` [PATCH v3 1/5] pack-bitmap.c: continue looping when first MIDX bitmap is found Teng Long
2022-06-12  7:44     ` [PATCH v3 2/5] pack-bitmap.c: rename "idx_name" to "bitmap_name" Teng Long
2022-06-12  7:44     ` [PATCH v3 3/5] pack-bitmap.c: make warnings support i18N when opening bitmap Teng Long
2022-06-12  7:44     ` [PATCH v3 4/5] pack-bitmap.c: using error() instead of silently returning -1 Teng Long
2022-06-14  1:15       ` Taylor Blau
2022-06-20 13:17         ` Teng Long
2022-06-12  7:44     ` [PATCH v3 5/5] bitmap: add trace2 outputs during open "bitmap" file Teng Long
2022-06-13 20:59       ` Junio C Hamano
2022-06-20 13:32         ` Teng Long
2022-06-14  1:40       ` Taylor Blau
2022-06-21  6:58         ` Teng Long
2022-06-22 12:51       ` Jeff Hostetler
2022-06-23  9:38         ` Teng Long
2022-06-23 15:14           ` Jeff Hostetler
2022-06-24  8:27             ` [PATCH v3 5/5] bitmap: add trace2 outputs during open "bitmap" Teng Long
2022-06-21 13:25     ` [PATCH v3 0/5] trace2 output for bitmap decision path Teng Long
2022-06-21 13:25       ` [PATCH v3 1/5] pack-bitmap.c: continue looping when first MIDX bitmap is found Teng Long
2022-06-21 13:25       ` [PATCH v3 2/5] pack-bitmap.c: rename "idx_name" to "bitmap_name" Teng Long
2022-06-21 13:25       ` [PATCH v3 3/5] pack-bitmap.c: make warnings support i18N when opening bitmap Teng Long
2022-06-21 13:25       ` [PATCH v3 4/5] pack-bitmap.c: using error() instead of silently returning -1 Teng Long
2022-06-21 13:25       ` [PATCH v3 5/5] bitmap: add trace2 outputs during open "bitmap" file Teng Long
2022-06-22 13:04         ` Jeff Hostetler
2022-06-22 15:12           ` Junio C Hamano
2022-06-28  8:17       ` [PATCH v5 0/5] tr2: avoid to print "interesting" config repeatedly Teng Long
2022-06-28  8:17         ` [PATCH v5 1/5] pack-bitmap.c: continue looping when first MIDX bitmap is found Teng Long
2022-06-28  8:17         ` [PATCH v5 2/5] pack-bitmap.c: rename "idx_name" to "bitmap_name" Teng Long
2022-06-28  8:17         ` [PATCH v5 3/5] pack-bitmap.c: using error() instead of silently returning -1 Teng Long
2022-06-28 18:04           ` Junio C Hamano
2022-07-05  9:04             ` Teng Long
2022-07-05 18:23               ` Junio C Hamano
2022-06-28  8:17         ` [PATCH v5 4/5] pack-bitmap.c: retrieve missing i18n translations Teng Long
2022-06-28  8:58           ` Ævar Arnfjörð Bjarmason [this message]
2022-06-28 17:28             ` Eric Sunshine
2022-07-06 14:19               ` Teng Long
2022-07-06 14:06             ` Teng Long
2022-06-28 18:07           ` Junio C Hamano
2022-07-07 11:59             ` Teng Long
2022-07-07 16:45               ` Junio C Hamano
2022-07-11 11:04                 ` Teng Long
2022-06-28  8:17         ` [PATCH v5 5/5] tr2: avoid to print "interesting" config repeatedly Teng Long
2022-06-28  9:13           ` Ævar Arnfjörð Bjarmason
2022-06-28 18:12             ` Junio C Hamano
2022-07-01 14:31               ` Jeff Hostetler
2022-07-11  4:11                 ` Teng Long
2022-07-11  3:51             ` Teng Long
2022-07-11 12:43         ` [PATCH v6 0/7] trace2: dump scope when print "interesting" config Teng Long
2022-07-11 12:43           ` [PATCH v6 1/7] clean: fixed issues related to text output format Teng Long
2022-07-11 21:08             ` Junio C Hamano
2022-07-13 11:44               ` Teng Long
2022-07-11 12:43           ` [PATCH v6 2/7] pack-bitmap.c: mark more strings for translations Teng Long
2022-07-11 12:43           ` [PATCH v6 3/7] pack-bitmap.c: rename "idx_name" to "bitmap_name" Teng Long
2022-07-11 12:44           ` [PATCH v6 4/7] pack-bitmap.c: don't ignore ENOENT silently Teng Long
2022-07-11 14:38             ` Ævar Arnfjörð Bjarmason
2022-07-13 14:14               ` Teng Long
2022-07-11 21:22             ` Junio C Hamano
2022-07-14 15:25               ` Teng Long
2022-07-11 12:44           ` [PATCH v6 5/7] pack-bitmap.c: using error() instead of silently returning -1 Teng Long
2022-07-11 14:53             ` Ævar Arnfjörð Bjarmason
2022-07-15  2:34               ` Teng Long
2022-07-11 12:44           ` [PATCH v6 6/7] pack-bitmap.c: continue looping when first MIDX bitmap is found Teng Long
2022-07-11 12:44           ` [PATCH v6 7/7] tr2: dump names if config exist in multiple scopes Teng Long
2022-07-11 14:40             ` Ævar Arnfjörð Bjarmason
2022-07-11 19:19             ` Jeff Hostetler
2022-07-11 14:59           ` [PATCH v6 0/7] trace2: dump scope when print "interesting" config Ævar Arnfjörð Bjarmason
2022-07-18  8:36             ` Teng Long
2022-07-18 16:45           ` [PATCH v7 " Teng Long
2022-07-18 16:46             ` [PATCH v7 1/7] pack-bitmap.c: fix formatting of error messages Teng Long
2022-07-18 16:46             ` [PATCH v7 2/7] pack-bitmap.c: mark more strings for translations Teng Long
2022-07-18 16:46             ` [PATCH v7 3/7] pack-bitmap.c: rename "idx_name" to "bitmap_name" Teng Long
2022-07-18 16:46             ` [PATCH v7 4/7] pack-bitmap.c: do not ignore error when opening a bitmap file Teng Long
2022-07-18 16:46             ` [PATCH v7 5/7] pack-bitmap.c: using error() instead of silently returning -1 Teng Long
2022-07-18 16:46             ` [PATCH v7 6/7] pack-bitmap.c: continue looping when first MIDX bitmap is found Teng Long
2022-07-18 16:46             ` [PATCH v7 7/7] tr2: dump names if config exist in multiple scopes Teng Long
2022-07-18 20:13               ` Jeff Hostetler
2022-07-19  7:40                 ` tenglong.tl
2022-07-19 21:03               ` Junio C Hamano
2022-07-20 12:48                 ` tenglong.tl
2022-07-18 18:57             ` [PATCH v7 0/7] trace2: dump scope when print "interesting" config Junio C Hamano
2022-07-18 19:07               ` Ævar Arnfjörð Bjarmason
2022-07-19 11:26                 ` tenglong.tl
2022-07-19 11:42                   ` Ævar Arnfjörð Bjarmason
2022-07-19 12:34                     ` tenglong.tl
2022-07-21  9:05             ` [PATCH v8 0/6] pack-bitmap.c: optimize error messages tenglong.tl
2022-07-21  9:05               ` [PATCH v8 1/6] pack-bitmap.c: fix formatting of " tenglong.tl
2022-07-21  9:05               ` [PATCH v8 2/6] pack-bitmap.c: mark more strings for translations tenglong.tl
2022-07-21  9:05               ` [PATCH v8 3/6] pack-bitmap.c: rename "idx_name" to "bitmap_name" tenglong.tl
2022-07-21  9:05               ` [PATCH v8 4/6] pack-bitmap.c: do not ignore error when opening a bitmap file tenglong.tl
2022-07-21  9:05               ` [PATCH v8 5/6] pack-bitmap.c: using error() instead of silently returning -1 tenglong.tl
2022-07-21  9:05               ` [PATCH v8 6/6] pack-bitmap.c: continue looping when first MIDX bitmap is found tenglong.tl
2022-07-21 23:01               ` [PATCH v8 0/6] pack-bitmap.c: optimize error messages Junio C Hamano
2022-07-22  6:17                 ` tenglong.tl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220628.86sfnpf96x.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=derrickstolee@github.com \
    --cc=dyroneteng@gmail.com \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=tenglong.tl@alibaba-inc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).