[RFC/PATCH] Makefile: allow po generation through po target

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The main Makefile has a "pot" target that recreates the git.pot file of
strings which are marked for translation.

Add a "po" target that recreates the $(LANGUAGE).po files which contain
the translations (or stubs).

Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
---

Notes:
    This makes it easier to recreate po (and mo) without reading po/README.
    Alternatively, one may think about a Makefile in po/ which does both pot
    and po updates, just like we have makefiles in t/ and Ducumentation/.
    
    This doesn't give you proper before-after diffs yet, but at least the after
    state.

 Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Makefile b/Makefile
index 24bef8d..bb60a34 100644
--- a/Makefile
+++ b/Makefile
@@ -445,6 +445,7 @@ TCL_PATH = tclsh
 TCLTK_PATH = wish
 XGETTEXT = xgettext
 MSGFMT = msgfmt
+MSGMERGE = msgmerge
 CURL_CONFIG = curl-config
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
@@ -1514,6 +1515,7 @@ ifndef V
 	QUIET_LNCP     = @echo '   ' LN/CP $@;
 	QUIET_XGETTEXT = @echo '   ' XGETTEXT $@;
 	QUIET_MSGFMT   = @echo '   ' MSGFMT $@;
+	QUIET_MSGMERGE = @echo '   ' MSGMERGE $@;
 	QUIET_GCOV     = @echo '   ' GCOV $@;
 	QUIET_SP       = @echo '   ' SP $<;
 	QUIET_RC       = @echo '   ' RC $@;
@@ -2088,6 +2090,9 @@ pot: po/git.pot
 POFILES := $(wildcard po/*.po)
 MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))
 
+.PHONY: po
+po: $(POFILES)
+
 ifndef NO_GETTEXT
 all:: $(MOFILES)
 endif
@@ -2095,6 +2100,9 @@ endif
 po/build/locale/%/LC_MESSAGES/git.mo: po/%.po
 	$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<
 
+po/%.po: po/git.pot
+	$(QUIET_MSGMERGE)$(MSGMERGE) --add-location --backup=off -q -U $@ $<
+
 FIND_SOURCE_FILES = ( git ls-files '*.[hcS]' 2>/dev/null || \
 			$(FIND) . \( -name .git -type d -prune \) \
 				-o \( -name '*.[hcS]' -type f -print \) )
-- 
2.8.0.rc2.197.g3b88641.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]