Skip to content

Commit ea3f639

Browse files
jiangxingitster
authored andcommitted
Makefile: sort source files before feeding to xgettext
We will feed xgettext with more C source 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 sort the c, perl, and shell source files in groups before feeding them to xgettext. Ævar suggested that we should not pass the option "--sort-by-file" to xgettext to sort the translatable strings, as it will mix the three groups of source files (c, perl and shell) in the file "po/git.pot", and change the order of translatable strings in the same line of a file. With this update, the newly generated "po/git.pot" will have 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 "*.pot 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. Suggested-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Jiang Xin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6cd33dc commit ea3f639

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,10 +2713,9 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
27132713
--keyword=gettextln --keyword=eval_gettextln
27142714
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
27152715
--keyword=__ --keyword=N__ --keyword="__n:1,2"
2716-
LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
2717-
LOCALIZED_SH = $(SCRIPT_SH)
2718-
LOCALIZED_SH += git-sh-setup.sh
2719-
LOCALIZED_PERL = $(SCRIPT_PERL)
2716+
LOCALIZED_C = $(sort $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H))
2717+
LOCALIZED_SH = $(sort $(SCRIPT_SH) git-sh-setup.sh)
2718+
LOCALIZED_PERL = $(sort $(SCRIPT_PERL))
27202719

27212720
ifdef XGETTEXT_INCLUDE_TESTS
27222721
LOCALIZED_C += t/t0200/test.c

0 commit comments

Comments
 (0)