Git fork

Makefile: add "po-init" rule to initialize po/XX.po

The core translation is the minimum set of work that must be done for a
new language translation.

There are over 5000 messages in the template message file "po/git.pot"
that need to be translated. It is not a piece of cake for such a huge
workload. So we used to define a small set of messages called "core
translation" that a new l10n contributor must complete before sending
pull request to the l10n coordinator.

By pulling in some parts of the git-po-helper[^1] logic, we add a new
rule to create this core translation message "po/git-core.pot":

make po/git-core.pot

To help new l10n contributors to initialized their "po/XX.pot" from
"po/git-core.pot", we also add new rules "po-init":

make po-init PO_FILE=po/XX.po

[^1]: https://github.com/git-l10n/git-po-helper/

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Ævar Arnfjörð Bjarmason and committed by
Junio C Hamano
b9832f7e fbb3d323

+41 -1
+39 -1
Makefile
··· 2806 2806 $(check_po_file_envvar) 2807 2807 @if test ! -e $(PO_FILE); then \ 2808 2808 echo >&2 "error: $(PO_FILE) does not exist"; \ 2809 + echo >&2 'To create an initial po file, use: "make po-init PO_FILE=po/XX.po"'; \ 2809 2810 exit 1; \ 2810 2811 fi 2811 2812 $(QUIET_MSGMERGE)$(MSGMERGE) $(MSGMERGE_FLAGS) $(PO_FILE) po/git.pot ··· 2813 2814 .PHONY: check-pot 2814 2815 check-pot: $(LOCALIZED_ALL_GEN_PO) 2815 2816 2817 + ### TODO FIXME: Translating everything in these files is a bad 2818 + ### heuristic for "core", as we'll translate obscure error() messages 2819 + ### along with commonly seen i18n messages. A better heuristic would 2820 + ### be to e.g. use spatch to first remove error/die/warning 2821 + ### etc. messages. 2822 + LOCALIZED_C_CORE = 2823 + LOCALIZED_C_CORE += builtin/checkout.c 2824 + LOCALIZED_C_CORE += builtin/clone.c 2825 + LOCALIZED_C_CORE += builtin/index-pack.c 2826 + LOCALIZED_C_CORE += builtin/push.c 2827 + LOCALIZED_C_CORE += builtin/reset.c 2828 + LOCALIZED_C_CORE += remote.c 2829 + LOCALIZED_C_CORE += wt-status.c 2830 + 2831 + LOCALIZED_C_CORE_GEN_PO = $(LOCALIZED_C_CORE:%=.build/pot/po/%.po) 2832 + 2833 + .build/pot/git-core.header: $(LOCALIZED_C_CORE_GEN_PO) 2834 + $(call mkdir_p_parent_template) 2835 + $(QUIET_GEN)$(gen_pot_header) 2836 + 2837 + po/git-core.pot: .build/pot/git-core.header $(LOCALIZED_C_CORE_GEN_PO) 2838 + $(QUIET_GEN)$(MSGCAT) $^ >$@ 2839 + 2840 + .PHONY: po-init 2841 + po-init: po/git-core.pot 2842 + $(check_po_file_envvar) 2843 + @if test -e $(PO_FILE); then \ 2844 + echo >&2 "error: $(PO_FILE) exists already"; \ 2845 + exit 1; \ 2846 + fi 2847 + $(QUIET_MSGINIT)msginit \ 2848 + --input=$< \ 2849 + --output=$(PO_FILE) \ 2850 + --no-translator \ 2851 + --locale=$(PO_FILE:po/%.po=%) 2852 + 2853 + ## po/*.po files & their rules 2816 2854 ifdef NO_GETTEXT 2817 2855 POFILES := 2818 2856 MOFILES := ··· 3348 3386 3349 3387 clean: profile-clean coverage-clean cocciclean 3350 3388 $(RM) -r .build 3351 - $(RM) po/git.pot 3389 + $(RM) po/git.pot po/git-core.pot 3352 3390 $(RM) *.res 3353 3391 $(RM) $(OBJECTS) 3354 3392 $(RM) $(LIB_FILE) $(XDIFF_LIB) $(REFTABLE_LIB) $(REFTABLE_TEST_LIB)
+1
po/.gitignore
··· 1 1 /build 2 2 /git.pot 3 + /git-core.pot
+1
shared.mak
··· 62 62 QUIET_BUILT_IN = @echo ' ' BUILTIN $@; 63 63 QUIET_LNCP = @echo ' ' LN/CP $@; 64 64 QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; 65 + QUIET_MSGINIT = @echo ' ' MSGINIT $@; 65 66 QUIET_MSGFMT = @echo ' ' MSGFMT $@; 66 67 QUIET_MSGMERGE = @echo ' ' MSGMERGE $@; 67 68 QUIET_GCOV = @echo ' ' GCOV $@;