Sha256: 59c90544ff0b20064728305f5be93c9152aa38ab82c607cbd6a32097894fb327

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 KB

Contents

#
# Makefile for PO merging and MO generation. More info in the README.
#
# make all-mo (default) - generate MO files
# make check - check translations using translate-tool
# make tx-update - download and merge translations from Transifex
# make clean - clean everything
#
DOMAIN = hammer-cli
POTFILE = $(DOMAIN).pot
MOFILE = $(DOMAIN).mo
POFILES = $(shell find . -name '*.po')
MOFILES = $(patsubst %.po,%.mo,$(POFILES))
POXFILES = $(patsubst %.po,%.pox,$(POFILES))

%.mo: %.po
	mkdir -p $(shell dirname $@)/LC_MESSAGES
	msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<

# Generate MO files from PO files
all-mo: $(MOFILES)

# Check for malformed strings
%.pox: %.po
	msgfmt -c $<
	pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines \
		-t endwhitespace -t endpunc -t puncspacing -t options -t printf -t validchars --gnome $< > $@
	cat $@
	! grep -q msgid $@

check: $(POXFILES)
	msgfmt -c ${POTFILE}

# Merge PO files
update-po:
	for f in $(shell find ./ -name "*.po") ; do \
		msgmerge -N --backup=none -U $$f ${POTFILE} ; \
	done

# Unify duplicate translations
uniq-po:
	for f in $(shell find ./ -name "*.po") ; do \
		msguniq $$f -o $$f ; \
	done

tx-pull:
	tx pull -f
	-git commit -a -m "i18n - extracting new, pulling from tx"

extract-strings:
	bundle exec rake locale:find DOMAIN=$(DOMAIN) SKIP_MODEL=1

tx-update: tx-pull extract-strings
	# merging po files is unnecessary when using transifex.com (amend that)
	git checkout -- ../locale/*/*po
	git commit -a --amend -m "i18n - extracting new, pulling from tx"
	-echo Changes commited!

# Remove all MO files
clean:
	-rm -f messages.mo
	find . \( -name "*.mo" -o -name "*.pox" \) -exec rm -f '{}' ';'
	find . -path *LC_MESSAGES | xargs rm -rf

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hammer_cli-0.1.1 locale/Makefile
hammer_cli-0.1.0 locale/Makefile