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

[PATCH 4/4] Makefile: add xgettext target for *.sh files

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 8, 2011, 12:10 UTC
Message-ID
<1304856659-10672-5-git-send-email-avarab@gmail.com>
In-Reply-To
<1304856659-10672-1-git-send-email-avarab@gmail.com>

Change the "pot" target to also extract strings from our $(SCRIPT_SH) files with xgettext(1).

Note that due to Jonathan Nieder's trick of doing "mv $@+ $@" at the end of the target the "pot" target will now warn:

    $ make pot
        XGETTEXT po/git.pot
    po/git.pot+: warning: Charset "CHARSET" is not a portable encoding name.
                          Message conversion to user's charset might not work.

This warnings is emitted because xgettext is writing into a non-*.pot file, it's harmless however. The content that's written out is equivalent to what it would be if we were writing directly into an existing POT file with --join-existing.

As part of this change I've eliminated the && chain between xgettext calls, this is incompatible with $(QUIET_XGETTEXT), if the && is left in it'll emit:

    /bin/sh: @echo: not found

Since it's redundant (the Makefile will stop if there's an error) I've removed it altogether.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 83889f3..10252d5 100644
--- a/Makefile
+++ b/Makefile
@@ -2065,10 +2065,14 @@ XGETTEXT_FLAGS = \
 	--from-code=UTF-8
 XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \
 	--keyword=_ --keyword=N_ --keyword="Q_:1,2"
+XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell
 LOCALIZED_C := $(C_OBJ:o=c)
+LOCALIZED_SH := $(SCRIPT_SH)
 
 po/git.pot: $(LOCALIZED_C)
-	$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) && \
+	$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C)
+	$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \
+		$(LOCALIZED_SH)
 	mv $@+ $@
 
 pot: po/git.pot
-- 
1.7.4.4
Previous: Ævar Arnfjörð BjarmasonNext: Sverre Rabbelier
Message 9 of 13 in “i18n: Add shell script translation infrastructure”
  1. 0/4 i18n: Add shell script translation infrastructureÆvar Arnfjörð Bjarmason, May 8, 2011
  2. 1/4 git-sh-i18n--envsubst: our own envsubst(1) for eval_gettext()Ævar Arnfjörð Bjarmason, May 8, 2011
  3. Junio C HamanoMay 8, 2011
  4. Ævar Arnfjörð BjarmasonMay 8, 2011
  5. Junio C HamanoMay 9, 2011
  6. Ævar Arnfjörð BjarmasonMay 9, 2011
  7. 2/4 git-sh-i18n.sh: add no-op gettext() and eval_gettext() wrappersÆvar Arnfjörð Bjarmason, May 8, 2011
  8. 3/4 git-sh-i18n.sh: add GIT_GETTEXT_POISON supportÆvar Arnfjörð Bjarmason, May 8, 2011
  9. 4/4 Makefile: add xgettext target for *.sh filesÆvar Arnfjörð Bjarmason, May 8, 2011
  10. Sverre RabbelierMay 8, 2011
  11. Ævar Arnfjörð BjarmasonMay 8, 2011
  12. Sverre RabbelierMay 8, 2011
  13. Ævar Arnfjörð BjarmasonMay 8, 2011

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.