1 |
d4e021f3
|
Amos Benari
|
#
|
2 |
792d601d
|
Bryan Kearney
|
# Makefile for PO merging and MO generation. More info in the README.
|
3 |
d4e021f3
|
Amos Benari
|
#
|
4 |
792d601d
|
Bryan Kearney
|
# make all-mo (default) - generate MO files
|
5 |
|
|
# make check - check translations using translate-tool
|
6 |
|
|
# make tx-update - download and merge translations from Transifex
|
7 |
|
|
# make clean - clean everything
|
8 |
|
|
#
|
9 |
|
|
DOMAIN = foreman_docker
|
10 |
|
|
VERSION = $(shell ruby -e 'require "rubygems";spec = Gem::Specification::load(Dir.glob("../*.gemspec")[0]);puts spec.version')
|
11 |
|
|
POTFILE = $(DOMAIN).pot
|
12 |
|
|
MOFILE = $(DOMAIN).mo
|
13 |
|
|
POFILES = $(shell find . -name '$(DOMAIN).po')
|
14 |
|
|
MOFILES = $(patsubst %.po,%.mo,$(POFILES))
|
15 |
|
|
POXFILES = $(patsubst %.po,%.pox,$(POFILES))
|
16 |
|
|
EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
|
17 |
|
|
|
18 |
|
|
%.mo: %.po
|
19 |
|
|
mkdir -p $(shell dirname $@)/LC_MESSAGES
|
20 |
|
|
msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<
|
21 |
|
|
|
22 |
|
|
# Generate MO files from PO files
|
23 |
|
|
all-mo: $(MOFILES)
|
24 |
|
|
|
25 |
|
|
# Check for malformed strings
|
26 |
|
|
%.pox: %.po
|
27 |
|
|
msgfmt -c $<
|
28 |
|
|
pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines \
|
29 |
|
|
-t endwhitespace -t endpunc -t puncspacing -t options -t printf -t validchars --gnome $< > $@
|
30 |
|
|
cat $@
|
31 |
|
|
! grep -q msgid $@
|
32 |
|
|
|
33 |
|
|
%.edit.po:
|
34 |
|
|
touch $@
|
35 |
|
|
|
36 |
|
|
check: $(POXFILES)
|
37 |
|
|
|
38 |
|
|
# Unify duplicate translations
|
39 |
|
|
uniq-po:
|
40 |
|
|
for f in $(shell find ./ -name "*.po") ; do \
|
41 |
|
|
msguniq $$f -o $$f ; \
|
42 |
|
|
done
|
43 |
|
|
|
44 |
|
|
tx-pull: $(EDITFILES)
|
45 |
|
|
tx pull -f
|
46 |
|
|
for f in $(EDITFILES) ; do \
|
47 |
|
|
sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
|
48 |
|
|
done
|
49 |
|
|
|
50 |
|
|
tx-update: tx-pull
|
51 |
|
|
@echo
|
52 |
|
|
@echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation, then make -C locale mo-files to finish
|
53 |
|
|
@echo
|
54 |
|
|
|
55 |
|
|
mo-files: $(MOFILES)
|
56 |
|
|
git add $(POFILES) $(POTFILE) ../locale/*/LC_MESSAGES
|
57 |
|
|
git commit -m "i18n - pulling from tx"
|
58 |
|
|
@echo
|
59 |
|
|
@echo Changes commited!
|
60 |
|
|
@echo |