summaryrefslogtreecommitdiffstats
path: root/po/Makefile
blob: bad2c1d49d93107789f7076be6d457896744dc9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
INSTALL= /usr/bin/install -c
INSTALL_PROGRAM= ${INSTALL}
INSTALL_DATA= ${INSTALL} -m 644
PREFIX=$(DESTDIR)/
INSTALLNLSDIR=usr/share/locale

MSGMERGE = msgmerge -v

NLSPACKAGE = anaconda

POS = $(wildcard *.po)
FMTCATALOGS = $(patsubst %.po,%.mo,$(POS))

POTFILES = ../*.py ../iw/*.py ../textw/*.py \
           ../installclasses/*.py \
           ../libfdisk/*.c ../loader/*.c \
           ../gnome-map/*.c \

NONPOTFILES = ../comps/comps-master \
	   /usr/share/zoneinfo/zone.tab \
	   ../lang-table


all: $(FMTCATALOGS)

$(NLSPACKAGE).pot: $(POTFILES) $(NONPOTFILES)
	xgettext --default-domain=$(NLSPACKAGE) \
		--add-comments --keyword=_ --keyword=N_ $(POTFILES)
	./compsgettext ../comps/comps-master >> $(NLSPACKAGE).po
	cat /usr/share/zoneinfo/zone.tab | cut -f4 | grep "^[a-zA-Z]" | sort | uniq -u | while read line; do echo -e "\n#. generated from zone.tab\nmsgid \"$$line\"\nmsgstr \"\""; done >> $(NLSPACKAGE).po
	cat ../lang-table | cut -f1 | while read line; do echo -e "\n#. generated from lang-table\nmsgid \"$$line\"\nmsgstr \"\""; done >> $(NLSPACKAGE).po
	if cmp -s $(NLSPACKAGE).po $(NLSPACKAGE).pot; then \
	    rm -f $(NLSPACKAGE).po; \
	else \
	    mv $(NLSPACKAGE).po $(NLSPACKAGE).pot; \
	fi


update-po: Makefile $(NLSPACKAGE).pot refresh-po

refresh-po: Makefile
	for cat in $(POS); do \
		lang=`basename $$cat .po`; \
		if $(MSGMERGE) $$lang.po $(NLSPACKAGE).pot > $$lang.pot ; then \
			mv -f $$lang.pot $$lang.po ; \
			echo "$(MSGMERGE) of $$lang succeeded" ; \
		else \
			echo "$(MSGMERGE) of $$lang failed" ; \
			rm -f $$lang.pot ; \
		fi \
	done

report:
	@for cat in $(POS); do \
		echo -n "$$cat: "; \
		msgfmt -v --statistics -o /dev/null $$cat; \
	done

clean:
	rm -f *mo $(NLSPACKAGE).pot

distclean: clean
	rm -f .depend Makefile

depend:

install:	$(FMTCARALOGS) all 
	mkdir -p $(PREFIX)/$(INSTALLNLSDIR)
	for n in $(FMTCATALOGS); do \
	    l=`basename $$n .mo`; \
	    $(INSTALL) -m 755 -d $(PREFIX)/$(INSTALLNLSDIR)/$$l; \
	    $(INSTALL) -m 755 -d $(PREFIX)/$(INSTALLNLSDIR)/$$l/LC_MESSAGES; \
	    $(INSTALL) -m 644 $$n \
		$(PREFIX)/$(INSTALLNLSDIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
	done

.PHONY: missing

missing:
	mkdir -p missing; \
	for n in $(FMTCATALOGS); do \
	    msghack -w 999999 --missing $$n > missing/$$n-; \
            msghack -w 999999 --empty missing/$$n- | grep -v "^#," > missing/$$n; \
	    rm missing/$$n-; \
	done

missing-mixed:
	mkdir -p missing-mixed; \
	for n in $(FMTCATALOGS); do \
	    msghack -w 999999 --missing $$n > missing-mixed/$$n; \
	done

%.mo: %.po
	cat $< timeconfig/$< | msgfmt -o $@ -

depend: