mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 20:13:32 +01:00
71 lines
1.9 KiB
Makefile
71 lines
1.9 KiB
Makefile
GETTEXT_LOCALE ?= $(notdir $(shell pwd))
|
|
|
|
include $(MODDIR)/make/defs.mk
|
|
include $(MODDIR)/make/rules.mk
|
|
|
|
GETTEXT_POT ?= $(PROJECT).pot
|
|
GETTEXT_PO ?= $(PROJECT).po
|
|
GETTEXT_MO ?= $(PROJECT).mo
|
|
GETTEXT_INPUT_DIRS ?= $(wildcard $(TOPDIR)/tools $(TOPDIR)/src)
|
|
GETTEXT_INPUT_FILES ?= $(foreach d,$(GETTEXT_INPUT_DIRS),\
|
|
$(shell find $d -name '*.php' -o -name '*.cpp'))
|
|
GETTEXT_KEYWORDS ?= htr ehtr
|
|
|
|
all: $(GETTEXT_MO)
|
|
clean: clean-mo
|
|
rm -rf *~ .*.swp
|
|
install: install_MO
|
|
distclean: clean
|
|
|
|
extract: $(GETTEXT_POT)
|
|
clean-mo:
|
|
rm -f *.mo *.tmp
|
|
|
|
$(GETTEXT_POT): $(GETTEXT_INPUT_FILES)
|
|
xgettext --from-code=utf-8 --package-name $(PROJECT) --package-version $(DIST_VERSION) \
|
|
--default-domain $(PROJECT) $(addprefix -k,$(GETTEXT_KEYWORDS)) \
|
|
--output $@.tmp $(XGETTEXT_EXTRA_OPTS) $(GETTEXT_INPUT_FILES)
|
|
mv $@.tmp $@
|
|
|
|
init: $(GETTEXT_POT)
|
|
msginit --no-translator --locale $(GETTEXT_LOCALE) \
|
|
--output-file $(GETTEXT_PO).tmp --input $<
|
|
sed -i 's/charset=ASCII/charset=UTF-8/' $(GETTEXT_PO).tmp
|
|
mv $(GETTEXT_PO).tmp $(GETTEXT_PO)
|
|
|
|
merge: $(GETTEXT_POT)
|
|
msgmerge -v --lang $(GETTEXT_LOCALE) --output-file $(GETTEXT_PO).tmp \
|
|
$(wildcard $(GETTEXT_PO)) $<
|
|
mv $(GETTEXT_PO).tmp $(GETTEXT_PO)
|
|
|
|
edit: merge $(GETTEXT_POT)
|
|
poedit $(GETTEXT_PO)
|
|
|
|
$(GETTEXT_MO): $(GETTEXT_PO)
|
|
msgfmt --check --verbose --output-file $@.tmp $<
|
|
mv $@.tmp $@
|
|
|
|
#msginit --no-translator --locale es_MX --output-file $(PROJECT)_spanish.po --input $(PROJECT).pot
|
|
#sed --in-place $(PROJECT)_spanish.po --expression='/"hello, world!"/,/#: / s/""/"hola mundo"/'
|
|
#mkdir --parents ./es_MX.utf8/LC_MESSAGES
|
|
#msgfmt --check --verbose --output-file ./es_MX.utf8/LC_MESSAGES/$(PROJECT).mo $(PROJECT)_spanish.po
|
|
|
|
GETTEXT_TMP = $(patsubst %.php,%.htr,$(GETTEXT_PREPROCESS))
|
|
GETTEXT_INPUT_FILES += $(GETTEXT_TMP)
|
|
|
|
all: htr
|
|
clean: htr-tmp-clean
|
|
|
|
htr: $(GETTEXT_TMP)
|
|
|
|
htr-tmp-clean:
|
|
rm -f *.htr
|
|
|
|
define copy_rule
|
|
./%.htr.tmp: $(1)/%.php
|
|
cp $$< $$@
|
|
endef
|
|
|
|
$(foreach d, $(HTR_SOURCE_DIRS), $(eval $(call copy_rule,$(d))))
|
|
|
|
|