summaryrefslogtreecommitdiff
path: root/po/Makefile
blob: 2d34c6fe8f65155976b594a33a45abced9084340 (plain)
  1. # List here all source files with translatable strings.
  2. POTFILES=$(sort $(shell find ../IkiWiki -type f -name \*.pm)) \
  3. ../ikiwiki.in ../IkiWiki.pm
  4. POFILES=$(wildcard *.po)
  5. MOFILES=$(POFILES:.po=.mo)
  6. all: ikiwiki.pot $(MOFILES)
  7. install: all
  8. for file in $(MOFILES); do \
  9. lang=`echo $$file | sed 's/\.mo//'`; \
  10. install -d $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/; \
  11. install -m 0644 $$file $(DESTDIR)$(PREFIX)/share/locale/$$lang/LC_MESSAGES/ikiwiki.mo; \
  12. done
  13. ikiwiki.pot: $(POTFILES)
  14. @echo "Rebuilding the pot file"
  15. xgettext $(POTFILES) -o ikiwiki.pot -Lperl --add-comments=translators
  16. clean:
  17. rm -f ikiwiki.pot $(MOFILES) messages messages.mo
  18. %.mo: %.po
  19. msgfmt -o $@ $<
  20. %.po: ikiwiki.pot
  21. @echo -n "Merging ikiwiki.pot and $@"
  22. @msgmerge $@ ikiwiki.pot -o $@.new 2>&1
  23. # Typically all that changes was a date. I'd prefer not to commit such
  24. # changes, so detect and ignore them.
  25. @if [ "`diff $@ $@.new | grep '[<>]' | wc -l`" -ne 2 ]; then \
  26. mv -f $@.new $@; \
  27. else \
  28. rm -f $@.new; \
  29. fi
  30. @msgfmt --statistics $@ 2>&1
  31. check:
  32. @for file in $(POFILES); do \
  33. lang=`echo $$file | sed 's/\.po//'`; \
  34. printf "$$lang: "; \
  35. msgfmt -o /dev/null -c -v --statistics $$lang.po;\
  36. done