[Libguestfs] [v2v PATCH 10/14] po: extract again messages from C sources

Pino Toscano ptoscano at redhat.com
Thu Aug 13 12:10:51 UTC 2020


There are C sources (mostly in libguestfs-common) with user messages,
and at least some of them may actually be shown by virt-v2v.

Hence, extract them again, so they can be translated.
---
 Makefile.am    | 14 +++++++++++++-
 po/Makefile.am |  8 ++++++--
 po/POTFILES    | 24 ++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 3 deletions(-)
 create mode 100644 po/POTFILES

diff --git a/Makefile.am b/Makefile.am
index 06e12a3c..e316f88c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -98,9 +98,10 @@ EXTRA_DIST = \
 # When doing 'make dist' update a few files automatically.
 #
 #  ChangeLog      - changelog (created from git)
+#  po/POTFILES    - files with ordinary extensions, but not OCaml files
 #  po/POTFILES-ml - OCaml files, which need a special tool to translate
 
-dist-hook: ChangeLog po/POTFILES-ml
+dist-hook: ChangeLog po/POTFILES po/POTFILES-ml
 	cp ChangeLog $(distdir)/ChangeLog
 
 ChangeLog: configure.ac
@@ -108,6 +109,17 @@ ChangeLog: configure.ac
 	git log --decorate=false > $@-t
 	mv $@-t $@
 
+# For more information about translations, see po/Makefile.am.
+po/POTFILES: configure.ac
+	rm -f $@ $@-t
+	cd $(srcdir); \
+	find $(DIST_SUBDIRS) -name '*.c' | \
+	grep -v -E '^(gnulib|po-docs|tests|test-data|bundled)/' | \
+	grep -v -E '/(dummy\.c)$$' | \
+	grep -v -E '.*-(tests)\.c$$' | \
+	LC_ALL=C sort -u > $@-t
+	mv $@-t $@
+
 po/POTFILES-ml: configure.ac
 	rm -f $@ $@-t
 	cd $(srcdir); \
diff --git a/po/Makefile.am b/po/Makefile.am
index 8d981d91..f1509d60 100644
--- a/po/Makefile.am
+++ b/po/Makefile.am
@@ -25,13 +25,14 @@ MSGID_BUGS_ADDRESS = https://bugzilla.redhat.com/enter_bug.cgi?component=libgues
 # Don't use LINGUAS (uppercase) as Gentoo defines it (RHBZ#804464).
 linguas     := $(shell cat $(srcdir)/LINGUAS)
 
+POTFILES    := $(shell $(SED) 's,^,$(top_srcdir)/,' $(srcdir)/POTFILES)
 POTFILES_ML := $(shell $(SED) 's,^,$(top_srcdir)/,' $(srcdir)/POTFILES-ml)
 POFILES     := $(linguas:%=%.po)
 GMOFILES    := $(linguas:%=%.gmo)
 
 EXTRA_DIST = \
 	LINGUAS \
-	POTFILES-ml \
+	POTFILES POTFILES-ml \
 	$(DOMAIN).pot \
 	$(POFILES) \
 	$(GMOFILES)
@@ -59,7 +60,7 @@ XGETTEXT_ARGS = \
 FIX_CHARSET = \
 	$(SED) -i 's|text/plain; charset=CHARSET|text/plain; charset=utf-8|g'
 
-$(DOMAIN).pot: Makefile POTFILES-ml $(POTFILES_ML)
+$(DOMAIN).pot: Makefile POTFILES $(POTFILES) POTFILES-ml $(POTFILES_ML)
 	rm -f $@-t
 	touch $@-t
 if HAVE_OCAML_GETTEXT
@@ -67,6 +68,9 @@ if HAVE_OCAML_GETTEXT
 	 \
 	$(FIX_CHARSET) $@-t
 endif
+	$(XGETTEXT) -j -o $@-t $(XGETTEXT_ARGS) \
+	  --files-from=$(abs_srcdir)/POTFILES
+	$(FIX_CHARSET) $@-t
 	mv $@-t $@
 
 .po.gmo:
diff --git a/po/POTFILES b/po/POTFILES
new file mode 100644
index 00000000..02a410d7
--- /dev/null
+++ b/po/POTFILES
@@ -0,0 +1,24 @@
+common/mlpcre/pcre-c.c
+common/mltools/JSON_parser-c.c
+common/mltools/getopt-c.c
+common/mltools/tools_utils-c.c
+common/mltools/uri-c.c
+common/mlutils/c_utils-c.c
+common/mlutils/unix_utils-c.c
+common/mlxml/xml-c.c
+common/options/config.c
+common/options/decrypt.c
+common/options/display-options.c
+common/options/domain.c
+common/options/inspect.c
+common/options/keys.c
+common/options/options.c
+common/options/uri.c
+common/qemuopts/qemuopts.c
+common/utils/cleanups.c
+common/utils/gnulib-cleanups.c
+common/utils/libxml2-cleanups.c
+common/utils/stringlists-utils.c
+common/utils/utils.c
+v2v/libosinfo-c.c
+v2v/qemuopts-c.c
-- 
2.26.2




More information about the Libguestfs mailing list