foreman/locale/Makefile @ develop
6668049d | Lukas Zapletal | #
|
|
a924ba8f | Lukas Zapletal | # Makefile for PO merging and MO generation. More info in the README.
|
|
6668049d | Lukas Zapletal | #
|
|
# make all-mo (default) - generate MO files
|
|||
# make check - check translations using translate-tool
|
|||
a924ba8f | Lukas Zapletal | # make tx-update - download and merge translations from Transifex
|
|
6668049d | Lukas Zapletal | # make clean - clean everything
|
|
#
|
|||
40b31d27 | Tomas Strachota | DOMAIN = foreman
|
|
POTFILE = $(DOMAIN).pot
|
|||
MOFILE = $(DOMAIN).mo
|
|||
4406f5af | Dominic Cleal | POFILES = $(shell find . -name '$(DOMAIN).po')
|
|
6668049d | Lukas Zapletal | MOFILES = $(patsubst %.po,%.mo,$(POFILES))
|
|
POXFILES = $(patsubst %.po,%.pox,$(POFILES))
|
|||
4406f5af | Dominic Cleal | EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
|
|
6668049d | Lukas Zapletal | ||
%.mo: %.po
|
|||
40b31d27 | Tomas Strachota | mkdir -p $(shell dirname $@)/LC_MESSAGES
|
|
msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<
|
|||
6668049d | Lukas Zapletal | ||
# 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 $< > $@
|
|||
6a7658b9 | Lukas Zapletal | cat $@
|
|
6668049d | Lukas Zapletal | ! grep -q msgid $@
|
|
check: $(POXFILES)
|
|||
# Unify duplicate translations
|
|||
uniq-po:
|
|||
for f in $(shell find ./ -name "*.po") ; do \
|
|||
msguniq $$f -o $$f ; \
|
|||
done
|
|||
4406f5af | Dominic Cleal | tx-pull: $(EDITFILES)
|
|
f3a73bb4 | Griffin Sullivan | cd .. && tx pull -f
|
|
9dc10019 | Lukas Zapletal | ||
4406f5af | Dominic Cleal | # Extract strings and update the .pot, prepare .edit.po files
|
|
9dc10019 | Lukas Zapletal | extract-strings:
|
|
4406f5af | Dominic Cleal | bundle exec rake locale:find DOMAIN=$(DOMAIN) SKIP_MODEL=1
|
|
# Merge .edit.po into .po
|
|||
update-po:
|
|||
bundle exec rake locale:find locale:po_to_json DOMAIN=$(DOMAIN) SKIP_MODEL=1
|
|||
9dc10019 | Lukas Zapletal | ||
4406f5af | Dominic Cleal | tx-update: extract-strings tx-pull update-po
|
|
git commit -m "i18n - extracting new, pulling from tx" . ../app/assets/javascripts/locale
|
|||
9dc10019 | Lukas Zapletal | -echo Changes commited!
|
|
a924ba8f | Lukas Zapletal | ||
6668049d | Lukas Zapletal | # Remove all MO files
|
|
clean:
|
|||
-rm -f messages.mo
|
|||
find . \( -name "*.mo" -o -name "*.pox" \) -exec rm -f '{}' ';'
|
|||
40b31d27 | Tomas Strachota | find . -path *LC_MESSAGES | xargs rm -rf
|