#
# To migrate one of the existing HTML based translations to .po based
# translation, make sure this command work:
#   po4a-gettextize -M UTF-8 -f xhtml -m index.html.en -L UTF-8 -l index.html.XX -p XX.po
# For this to work, the index.html.XX need to be valid XHTML, and have the same structure
# as the english original.  xmllint can be used to find XML errors.

WEBPAGES = \
  index.html.de \
  index.html.en \
  index.html.es \
  index.html.nl \
  index.html.nb \
  index.html.fr \
  index.html.it \
  index.html.ru \
  index.html.zh

all: index.pot $(WEBPAGES)

%.po: index.pot
	msgmerge $@ index.pot > $@.new && mv $@.new $@

index.html.de: index.html.en de.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p de.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.html.es: index.html.en es.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p es.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.html.fr: index.html.en fr.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p fr.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.html.it: index.html.en it.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p it.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.html.nl: index.html.en nl.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p nl.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.html.nb: index.html.en nb.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p nb.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.html.ru: index.html.en ru.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p ru.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.html.zh: index.html.en zh.po
	po4a-translate -f xhtml -M UTF-8 -m index.html.en -p zh.po -l $@.new -o attributes='<html><head><meta>content'
	mv $@.new $@

index.pot: index.html.en
	po4a-gettextize -M UTF-8 -f xhtml -m index.html.en -p $@

stats:
	for f in *.po; do printf "$$f: " ; msgfmt --statistics -o /dev/null $$f; done

clean:
