git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 17, 2016, 15:14 UTC
Message-ID
<2296423d1c46365f1fdeaa12cd1917bc859ff8d9.1458227678.git.git@drmicha.warpmail.net>
In-Reply-To
<56EAC47F.6000708@drmicha.warpmail.net>

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@drmicha.warpmail.net>
---
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
Previous: Michael J GruberNext: Junio C Hamano
Message 14 of 22 in “[ANNOUNCE] Git v2.8.0-rc2”
  1. Junio C HamanoMar 10, 2016
  2. Max HornMar 12, 2016
  3. Junio C HamanoMar 14, 2016
  4. Michael J GruberMar 14, 2016
  5. wt-status: allow "ahead " to be picked up by l10nMichael J Gruber, Mar 14, 2016
  6. Junio C HamanoMar 14, 2016
  7. Junio C HamanoMar 14, 2016
  8. Junio C HamanoMar 14, 2016
  9. Michael J GruberMar 16, 2016
  10. Duy NguyenMar 16, 2016
  11. Michael J GruberMar 16, 2016
  12. Junio C HamanoMar 16, 2016
  13. Michael J GruberMar 17, 2016
  14. Makefile: allow po generation through po targetMichael J Gruber, Mar 17, 2016
  15. Junio C HamanoMar 17, 2016
  16. Junio C HamanoMar 17, 2016
  17. Jiang XinMar 20, 2016
  18. Michael J GruberMar 20, 2016
  19. Junio C HamanoMar 21, 2016
  20. Michael J GruberMar 22, 2016
  21. Junio C HamanoMar 22, 2016
  22. Jiang XinMar 15, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.