diff mbox series

[v3,1/9] Makefile: sort "po/git.pot" by file location

Message ID 20220523012531.4505-2-worldhello.net@gmail.com (mailing list archive)
State Superseded
Headers show
Series Incremental po/git.pot update and new l10n workflow | expand

Commit Message

Jiang Xin May 23, 2022, 1:25 a.m. UTC
From: Jiang Xin <zhiyou.jx@alibaba-inc.com>

We will feed xgettext with more C souce files and in different order in
subsequent commit. To generate a stable "po/git.pot" regardless of the
number and order of input source files, we add a new option
"--sort-by-file" to xgettext program.

With this update, the newly generated "po/git.pot" will has the same
entries while in a different order.

With the help of a custom diff driver as shown below,

    git config --global diff.gettext-fmt.textconv \
        "msgcat --no-location --sort-by-file"

and appending a new entry "*.po diff=gettext-fmt" to git attributes,
we can see that there are no substantial changes in "po/git.pot".

We won't checkin the newly generated "po/git.pot", because we will
remove it from tree in a later commit.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Junio C Hamano May 23, 2022, 8:05 a.m. UTC | #1
Jiang Xin <worldhello.net@gmail.com> writes:

> From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
>
> We will feed xgettext with more C souce files and in different order in

"source"

> subsequent commit. To generate a stable "po/git.pot" regardless of the
> number and order of input source files, we add a new option
> "--sort-by-file" to xgettext program.

Probably: ... we pass the option "--sort-by-file"

> With this update, the newly generated "po/git.pot" will has the same

"will have"

> entries while in a different order.
>
> With the help of a custom diff driver as shown below,
>
>     git config --global diff.gettext-fmt.textconv \
>         "msgcat --no-location --sort-by-file"
>
> and appending a new entry "*.po diff=gettext-fmt" to git attributes,
> we can see that there are no substantial changes in "po/git.pot".
>
> We won't checkin the newly generated "po/git.pot", because we will
> remove it from tree in a later commit.
>
> Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

This has no input from me (yet), so technically it is a bit
premature to add my sign-off here.  It wouldn't make a difference to
the end result, though ;-)

> ---
>  Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index f8bccfab5e..83e968e2a4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2706,6 +2706,7 @@ XGETTEXT_FLAGS = \
>  	--force-po \
>  	--add-comments=TRANSLATORS: \
>  	--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
> +	--sort-by-file \
>  	--from-code=UTF-8
>  XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
>  	--keyword=_ --keyword=N_ --keyword="Q_:1,2"
Jiang Xin May 23, 2022, 8:50 a.m. UTC | #2
On Mon, May 23, 2022 at 4:05 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Jiang Xin <worldhello.net@gmail.com> writes:
>
> > From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
> >
> > We will feed xgettext with more C souce files and in different order in
>
> "source"
>
> > subsequent commit. To generate a stable "po/git.pot" regardless of the
> > number and order of input source files, we add a new option
> > "--sort-by-file" to xgettext program.
>
> Probably: ... we pass the option "--sort-by-file"
>
> > With this update, the newly generated "po/git.pot" will has the same
>
> "will have"
>
> > entries while in a different order.
> >
> > With the help of a custom diff driver as shown below,
> >
> >     git config --global diff.gettext-fmt.textconv \
> >         "msgcat --no-location --sort-by-file"
> >
> > and appending a new entry "*.po diff=gettext-fmt" to git attributes,
> > we can see that there are no substantial changes in "po/git.pot".
> >
> > We won't checkin the newly generated "po/git.pot", because we will
> > remove it from tree in a later commit.
> >
> > Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
> > Signed-off-by: Junio C Hamano <gitster@pobox.com>
>
> This has no input from me (yet), so technically it is a bit
> premature to add my sign-off here.  It wouldn't make a difference to
> the end result, though ;-)

I started reroll v3 on your branch, forgot to remove your signature.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index f8bccfab5e..83e968e2a4 100644
--- a/Makefile
+++ b/Makefile
@@ -2706,6 +2706,7 @@  XGETTEXT_FLAGS = \
 	--force-po \
 	--add-comments=TRANSLATORS: \
 	--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
+	--sort-by-file \
 	--from-code=UTF-8
 XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
 	--keyword=_ --keyword=N_ --keyword="Q_:1,2"