# $Horde: horde/po/Makefile,v 1.2.2.3 2002/05/20 17:36:22 jan Exp $
#
-APPLICATION = banana
-MSGFMT = msgfmt --statistics -c -v -o
-MSGFMTSOL = msgfmt -v -o
-MSGMERGE = msgmerge -U
-XGETTEXT = xgettext --from-code=iso-8859-15 -j -k_b_ -o
-PHPFILES = find banana -name "*.php"
+LANGS:=$(shell ls *.po|sed -e s/\.po$$//)
+all: banana.pot ${LANGS:=.lang}
-all: install
+clean:
+ rm -f *.po~ *.lang
-xgettext:
- cd .. && ${XGETTEXT} po/${APPLICATION}.pot `${PHPFILES}`
+banana.pot:
+ @echo Parsing Tree for new messages
+ @echo
+ @echo "<?php " > template.php
+ @grep "|b" ../banana/templates/*.tpl | sed 's/\(.*\)\("[^"]*"\)|b\(.*\)/$var = _b_(\2);/g' >> template.php
+ @echo "?>" >> template.php
+ @xgettext --from-code=UTF-8 -j -k_b_ -o banana.pot ../banana/*.php ./template.php
+ @rm template.php
+
+%.lang: banana.pot ../banana/*.php %.po
+ @echo Generating $(@:.lang=.po)
+ @echo -n ' '
+ @mkdir -p ../locale/$(@:.lang=)/LC_MESSAGES/
+ @msgmerge -U $(@:lang=po) $< 2> /dev/null
+ @msgfmt --statistics -c -v -o ../locale/$(@:.lang=)/LC_MESSAGES/banana.mo $(@:lang=po)
+ @echo
+ @rm -f $(@:lang=po~)
+ @touch $@
-%.po: ${APPLICATION}.pot
- @echo "Updating .po files from .pot:"
- ${MSGMERGE} $@ $<
-install: *.po
- @echo "Checking for os ... ${OSTYPE}"; \
- if test "${OSTYPE}" = "solaris"; then \
- echo "You'll probably get some warnings on Solaris. This is normal."; \
- fi; \
- for LOCALE in `ls *.po | sed 's/\.[^.]*$$//g'`; do \
- if test $${LOCALE}.po = "messages.po"; then \
- continue; \
- fi; \
- echo "Compiling locale $${LOCALE}:"; \
- if ./shtool mkdir -p ../locale/$${LOCALE}/LC_MESSAGES; then \
- if test "${OSTYPE}" = "solaris"; then \
- if ${MSGFMTSOL} ../locale/$${LOCALE}/LC_MESSAGES/${APPLICATION}.mo $${LOCALE}.po; then \
- echo " ... done"; \
- echo; \
- else \
- echo " ... FAILED"; \
- echo; \
- fi \
- else \
- if ${MSGFMT} ../locale/$${LOCALE}/LC_MESSAGES/${APPLICATION}.mo $${LOCALE}.po; then \
- echo " ... done"; \
- echo; \
- else \
- echo " ... FAILED"; \
- echo; \
- fi \
- fi; \
- else \
- echo "Could not create locale directory for $${LOCALE}."; \
- fi \
- done;