summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2007-11-04 21:05:25 +0100
committerJonas Smedegaard <dr@jones.dk>2007-11-04 21:05:25 +0100
commit878d9fe80a619e8427c14a9296e60c1820a5d225 (patch)
tree858da221f7bf6fa5d35d8d484bf4a66848ae3b16 /Makefile
parent313bce6e443b2938846208a7a8c058ada82bd72e (diff)
Add make rule to generate po files.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 21 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index df8a840..22779aa 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ underlays = $(foreach source, $(sources), $(underlays_$(source))) $(underlays_l1
# FIXME: Handle translation of templates (needs po4a parser for HTML::Template markup)
#potfiles = $(foreach source, $(sources), $(patsubst %,po/%.pot,$(underlays_$(source))))
potfiles = $(foreach source, $(sources), $(patsubst %,po/%.pot,$(filter-out templates,$(underlays_$(source)))))
-pofiles = $(foreach locale, $(locales_$(source)), $(patsubst %.pot/%.$(locale).po,$(locale)))
+pofiles = $(foreach source, $(sources), $(foreach locale, $(locales_$(source)), $(patsubst %.pot,%.$(locale).po,$(potfiles))))
source_of_underlay = $(firstword $(foreach source, $(sources), $(if $(filter $(underlay),$(underlays_$(source))),$(source))))
origin = $(origin_$(source_of_underlay))
@@ -37,13 +37,30 @@ $(underlays):
fi
pot: $(potfiles)
+po: pot $(pofiles)
# FIXME: The po4a plugin for HTML::Template needs to be written...
$(potfiles): underlay=$(patsubst po/%.pot,%,$@)
-$(potfiles): fileformat=$(if $(filter templates,$(underlay)),htmltemplate,text)
-$(potfiles): filetype=$(if $(filter templates,$(underlay)),tmpl,mdwn)
+$(pofiles): underlay=$(basename $(patsubst po/%.po,%,$@))
+$(pofiles): locale=$(patsubst .%,%,$(suffix $(patsubst po/%.po,%,$@)))
+$(pofiles): underlay_l10n=$(underlay)_l10n/$(locale)
+$(potfiles) $(pofiles): fileformat = $(if $(filter templates,$(underlay)),htmltemplate,text)
+$(potfiles) $(pofiles): filetype = $(if $(filter templates,$(underlay)),tmpl,mdwn)
+$(potfiles) $(pofiles): srcfiles = $(shell cd "$(underlay)" && find * -type f -name '*.$(filetype)')
+
$(potfiles):
- cd $(underlay) && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(shell cd "$(underlay)" && find * -type f -name '*.$(filetype)')) -p $(CURDIR)/$@
+ cd $(underlay) && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(srcfiles)) -p $(CURDIR)/$@
+
+ifeq ($(translation_mode),init)
+$(pofiles):
+# cd $(underlay) && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(srcfiles)) $(patsubst %,-l $(CURDIR)/$(underlay_l10n)/%,$(srcfiles)) -p $(CURDIR)/$@
+ ( cd "$(underlay)" && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(srcfiles)) $(patsubst %,-l $(CURDIR)/$(underlay_l10n)/%,$(srcfiles)) ) \
+ | grep -v '#, fuzzy' \
+ > $@
+else
+$(pofiles):
+ cd "$(underlay)" && po4a-updatepo -M UTF-8 -f $(fileformat) $(patsubst %,-m %,$(srcfiles)) -p $(CURDIR)/$@
+endif
$(dummies):
mkdir -p $@