summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2007-11-05 11:15:46 +0100
committerJonas Smedegaard <dr@jones.dk>2007-11-05 11:15:46 +0100
commitd1edd0ef291fe4bbac81c5895aebbe6b56e3c9dd (patch)
treee146dae6e0ae939b213325c190097e14639f4709 /Makefile
parent878d9fe80a619e8427c14a9296e60c1820a5d225 (diff)
Add make rule to generate l10n files. Tighten variables (rename underlay to masterdir when used not as token but as dir).
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 26 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 22779aa..a4ca54a 100644
--- a/Makefile
+++ b/Makefile
@@ -14,11 +14,19 @@ underlays = $(foreach source, $(sources), $(underlays_$(source))) $(underlays_l1
#potfiles = $(foreach source, $(sources), $(patsubst %,po/%.pot,$(underlays_$(source))))
potfiles = $(foreach source, $(sources), $(patsubst %,po/%.pot,$(filter-out templates,$(underlays_$(source)))))
pofiles = $(foreach source, $(sources), $(foreach locale, $(locales_$(source)), $(patsubst %.pot,%.$(locale).po,$(potfiles))))
+l10nfiles = $(foreach source, $(sources), $(foreach locale, $(locales_$(source)), $(foreach underlay,$(patsubst po/%.$(locale).po,%,$(pofiles)), $(patsubst %,$(l10ndir)/%,$(l10nfiles_in_underlay)))))
source_of_underlay = $(firstword $(foreach source, $(sources), $(if $(filter $(underlay),$(underlays_$(source))),$(source))))
origin = $(origin_$(source_of_underlay))
master = $(master_$(source_of_underlay))
+masterdir = $(underlay)
+l10ndir = $(underlay)_l10n/$(locale)
+# FIXME: The po4a plugin for HTML::Template needs to be written...
+fileformat = $(if $(filter templates,$(underlay)),htmltemplate,text)
+filetype = $(if $(filter templates,$(underlay)),tmpl,mdwn)
+l10nfiles_in_underlay = $(shell cd "$(masterdir)" && find * -type f -name '*.$(filetype)')
+
all: $(underlays) $(dummies)
$(underlays): locale=$(if $(filter l10n/,$(lastword $(subst _, ,$(dir $@)))),$(notdir $@))
@@ -38,28 +46,34 @@ $(underlays):
pot: $(potfiles)
po: pot $(pofiles)
+translations: po $(l10nfiles)
-# FIXME: The po4a plugin for HTML::Template needs to be written...
$(potfiles): underlay=$(patsubst po/%.pot,%,$@)
-$(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 %,$(srcfiles)) -p $(CURDIR)/$@
+ cd "$(masterdir)" && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(l10nfiles_in_underlay)) -p $(CURDIR)/$@
+$(pofiles): underlay=$(basename $(patsubst po/%.po,%,$@))
+$(pofiles): locale=$(patsubst .%,%,$(suffix $(patsubst po/%.po,%,$@)))
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)) ) \
+# cd "$(masterdir)" && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(l10nfiles_in_underlay)) $(patsubst %,-l $(CURDIR)/$(l10ndir)/%,$(l10nfiles_in_underlay)) -p $(CURDIR)/$@
+ ( cd "$(masterdir)" && po4a-gettextize -M UTF-8 -L UTF-8 -f $(fileformat) $(patsubst %,-m %,$(l10nfiles_in_underlay)) $(patsubst %,-l $(CURDIR)/$(l10ndir)/%,$(l10nfiles_in_underlay)) ) \
| grep -v '#, fuzzy' \
> $@
else
$(pofiles):
- cd "$(underlay)" && po4a-updatepo -M UTF-8 -f $(fileformat) $(patsubst %,-m %,$(srcfiles)) -p $(CURDIR)/$@
+ cd "$(masterdir)" && po4a-updatepo -M UTF-8 -f $(fileformat) $(patsubst %,-m %,$(l10nfiles_in_underlay)) -p $(CURDIR)/$@
+endif
+
+#$(error $(l10nfiles):)
+$(l10nfiles): underlay=$(patsubst %_l10n,%,$(firstword $(subst /, ,$@)))
+$(l10nfiles): locale=$(patsubst %_l10n,%,$(word 2,$(subst /, ,$@)))
+$(l10nfiles):
+ mkdir -p $(l10ndir)
+ifeq ($(translation_mode),init)
+ cd "$(l10ndir)" && po4a-translate -M UTF-8 -L UTF-8 -k 0 -f $(fileformat) -m $(CURDIR)/$(patsubst $(l10ndir)/%,$(masterdir)/%,$@) -p $(CURDIR)/po/$(underlay).$(locale).po -l $(CURDIR)/$@
+else
+ cd "$(l10ndir)" && po4a-translate -M UTF-8 -L UTF-8 -k 100 -f $(fileformat) -m $(CURDIR)/$(patsubst $(l10ndir)/%,$(masterdir)/%,$@) -p $(CURDIR)/po/$(underlay).$(locale).po -l $(CURDIR)/$@
endif
$(dummies):