virt-viewer/po/Makefile.am
Pino Toscano 9957a6d6d8 po: use custom ITS rules when extracting messages
This way the custom rules for translating MIME types are used, and thus
the MIME type XML files are properly extracted.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-25 06:54:28 +02:00

79 lines
1.8 KiB
Makefile

DOMAIN = $(PACKAGE_NAME)
COPYRIGHT_HOLDER = The Virt Viewer authors
MSGID_BUGS_ADDRESS = https://gitlab.com/virt-viewer/virt-viewer/-/issues
MAINTAINERCLEANFILES = $(GMOFILES) $(POTFILE) $(POFILES)
LANGS := $(shell cat $(srcdir)/LINGUAS)
POTFILE := $(srcdir)/$(DOMAIN).pot
POFILES := $(LANGS:%=%.po)
GMOFILES := $(LANGS:%=%.gmo)
EXTRA_DIST = \
POTFILES \
LINGUAS \
$(POTFILE) \
$(POFILES)
if HAVE_GNU_GETTEXT_TOOLS
XGETTEXT_ARGS = \
--default-domain=$(DOMAIN) \
--from-code=utf-8 \
--add-comments=TRANSLATORS: \
--keyword=_ --keyword=N_ \
--keyword=C_:1c,2 \
--add-comments=translators: \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--package-name="$(PACKAGE_NAME)" \
--package-version="$(PACKAGE_VERSION)" \
--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
--directory=$(top_srcdir) \
--sort-output \
$(NULL)
SED_PO_FIXUP_ARGS = \
-e "s|text/plain; charset=CHARSET|text/plain; charset=UTF-8|g" \
-e "s|SOME DESCRIPTIVE TITLE|Virt Viewer package strings|g" \
-e "s|Copyright (C) YEAR|Copyright (C) $$(date +'%Y')|" \
$(NULL)
virt-viewer.pot:
GETTEXTDATADIR=$(top_srcdir)/data/gettext \
$(XGETTEXT) -o $(POTFILE)-t $(XGETTEXT_ARGS) \
--files-from=$(abs_srcdir)/POTFILES
$(SED) $(SED_PO_FIXUP_ARGS) < $(POTFILE)-t > $(POTFILE)
rm -f $(POTFILE)-t
%.gmo: %.po
rm -f $@ $@-t
$(MSGFMT) -c -o $@-t $<
mv $@-t $@
endif HAVE_GNU_GETTEXT_TOOLS
if ENABLE_NLS
# Cannot use 'localedir' since this conflicts with autoconf.
langinstdir = $(datadir)/locale
install-data-hook: $(GMOFILES)
mkdir -p $(DESTDIR)$(langinstdir)
for lang in $(LANGS); do \
d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \
mkdir -p $$d; \
install -m 0644 $$lang.gmo $$d/$(DOMAIN).mo; \
done
uninstall-hook:
for lang in $(LANGS); do \
d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \
rm -f $$d/$(DOMAIN).mo; \
done
endif ENABLE_NLS
-include $(top_srcdir)/git.mk