1 # Makefile for various po files.
8 #CATALOGS = $(addsuffix .po, LINGUAS)
10 MO_FILES = $(addsuffix .mo, $(LINGUAS))
19 all: $(TEXTDOMAIN).pot update-po update-mo install
22 @echo "Available targets:"
23 @echo " pot - remake master catalog"
24 @echo " update-po - merge po files"
25 @echo " update-mo - regenerate mo files"
26 @echo " install - install mo files"
27 @echo " all - all of the above"
29 POTFILES = $(srcdir)/POTFILES.in \
30 $(shell cat $(srcdir)/POTFILES.in)
32 pot: $(TEXTDOMAIN).pot
37 # FIXME: The parameter --from-code is only needed if your sources contain
38 # any 8 bit data (even in comments). UTF-8 is only a guess here, but it
39 # will at least accept any 8 bit data.
41 # The parameter "--language=perl" is not strictly needed because the
42 # source language of all our files will be auto-detected by xgettext
43 # by their filename extension. You should even avoid this parameter
44 # if you want to extract strings from multiple source languages.
45 $(TEXTDOMAIN).pot: $(POTFILES)
46 $(XGETTEXT) --output=$(srcdir)/$(TEXTDOMAIN).pox --from-code=utf-8 \
47 --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \
48 --copyright-holder="$(COPYRIGHT_HOLDER)" \
49 --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
50 --keyword --keyword='$$__' --keyword=__ --keyword=__x \
51 --keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \
52 --keyword=N__ --language=perl && \
53 rm -f $@ && mv $(TEXTDOMAIN).pox $@
57 targetdir='$(libdir)/LocaleData'; \
58 languages='$(LINGUAS)'; \
59 for lang in $$languages; do \
60 mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \
61 dest="$$targetdir/$$lang/LC_MESSAGES/$(TEXTDOMAIN).mo"; \
63 echo "installing $$cat as $$dest"; \
64 cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \
67 update-mo: $(MO_FILES)
70 $(MAKE) $(TEXTDOMAIN).pot
72 catalogs='$(CATALOGS)'; \
73 for cat in $$catalogs; do \
74 cat=`basename $$cat`; \
75 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
76 mv $$lang.po $$lang.old.po; \
78 if $(MSGMERGE) $$lang.old.po $(TEXTDOMAIN).pot -o $$lang.po; then \
79 rm -f $$lang.old.po; \
81 echo "msgmerge for $$cat failed!"; \
83 mv $$lang.old.po $$lang.po; \
91 $(MSGFMT) --check --statistics --verbose -o $@ $<