Skip to content

Commit fbb3d32

Browse files
jiangxingitster
authored andcommitted
Makefile: add "po-update" rule to update po/XX.po
Since there is no longer a "po/git.pot" file in tree, a l10n team leader has to run several commands to update their "po/XX.po" file: $ make pot $ msgmerge --add-location --backup=off -U po/XX.po po/git.pot To make this process easier, add a new rule so that l10n team leaders can update their "po/XX.po" with one command. E.g.: $ make po-update PO_FILE=po/zh_CN.po Signed-off-by: Jiang Xin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5377abc commit fbb3d32

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ TCLTK_PATH = wish
571571
XGETTEXT = xgettext
572572
MSGCAT = msgcat
573573
MSGFMT = msgfmt
574+
MSGMERGE = msgmerge
574575
CURL_CONFIG = curl-config
575576
GCOV = gcov
576577
STRIP = strip
@@ -2715,6 +2716,7 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \
27152716
--keyword=gettextln --keyword=eval_gettextln
27162717
XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
27172718
--keyword=__ --keyword=N__ --keyword="__n:1,2"
2719+
MSGMERGE_FLAGS = --add-location --backup=off --update
27182720
LOCALIZED_C = $(sort $(FOUND_C_SOURCES) $(FOUND_H_SOURCES) $(SCALAR_SOURCES) \
27192721
$(GENERATED_H))
27202722
LOCALIZED_SH = $(sort $(SCRIPT_SH) git-sh-setup.sh)
@@ -2792,6 +2794,22 @@ po/git.pot: .build/pot/git.header $(LOCALIZED_ALL_GEN_PO)
27922794
.PHONY: pot
27932795
pot: po/git.pot
27942796

2797+
define check_po_file_envvar
2798+
$(if $(PO_FILE), \
2799+
$(if $(filter po/%.po,$(PO_FILE)), , \
2800+
$(error PO_FILE should match pattern: "po/%.po")), \
2801+
$(error PO_FILE is not defined))
2802+
endef
2803+
2804+
.PHONY: po-update
2805+
po-update: po/git.pot
2806+
$(check_po_file_envvar)
2807+
@if test ! -e $(PO_FILE); then \
2808+
echo >&2 "error: $(PO_FILE) does not exist"; \
2809+
exit 1; \
2810+
fi
2811+
$(QUIET_MSGMERGE)$(MSGMERGE) $(MSGMERGE_FLAGS) $(PO_FILE) po/git.pot
2812+
27952813
.PHONY: check-pot
27962814
check-pot: $(LOCALIZED_ALL_GEN_PO)
27972815

shared.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ ifndef V
6363
QUIET_LNCP = @echo ' ' LN/CP $@;
6464
QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
6565
QUIET_MSGFMT = @echo ' ' MSGFMT $@;
66+
QUIET_MSGMERGE = @echo ' ' MSGMERGE $@;
6667
QUIET_GCOV = @echo ' ' GCOV $@;
6768
QUIET_SP = @echo ' ' SP $<;
6869
QUIET_HDR = @echo ' ' HDR $(<:hcc=h);

0 commit comments

Comments
 (0)