summaryrefslogtreecommitdiffstats
path: root/po/Makefile
blob: 5d260071f67b6c8b865191d047c6f9a9b05bcec2 (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
LANGUAGES=$(basename $(wildcard *.po))
PACKAGE_NAME=mageiawelcome
DESTDIR=$(RPM_BUILD_ROOT)

all: qm


clean:
	@echo " **CLEAN**"
	@rm -rf *.mo *~ tmp/
	@for lang in $(LANGUAGES); do \
		echo " **CLEANDIR** $$lang"; \
		rm -rf $$lang;\
	done


pot:
	cat ../usr/share/applications/$(PACKAGE_NAME).desktop.in | grep _ | cut -d "=" --fields=2 | sed 's|^|_("|g' | sed 's|$$|")|g' > ../usr/share/applications/$(PACKAGE_NAME).desktop.tmp
	xgettext --copyright-holder='Daniel Napora <napcok@gmail.com>' --package-name=mageiawelcome --from-code=UTF-8 --add-comments \
-L Python --msgid-bugs-address=http://bugs.mageia.org -o $(PACKAGE_NAME).pot ../usr/share/mageiawelcome/mageiawelcome.py ../usr/share/mageiawelcome/helpers.py ../usr/share/applications/$(PACKAGE_NAME).desktop.tmp
	rm -f ../usr/share/applications/$(PACKAGE_NAME).desktop.tmp
	sed -i "s|desktop.tmp|desktop.in|g" $(PACKAGE_NAME).pot

po:
	@for lang in $(LANGUAGES); do \
		echo " Updating po for $$lang"; \
		if [ ! -f $$lang.po ]; then \
			msginit --input $(PACKAGE_NAME).pot -o $$lang-old.po;\
		else \
			mv $$lang.po $$lang-old.po; \
		fi ; \
		msgmerge -o $$lang.po $$lang-old.po $(PACKAGE_NAME).pot; \
		rm -f $$lang-old.po; \
	done

gmo:
	@echo " **COMPILING** languages: $(LANGUAGES)"
	@for lang in $(LANGUAGES); do \
		echo " **COMPILEMO** $$lang" ; \
		mkdir -p $$lang/LC_MESSAGES/; \
		msgfmt --verbose -o $$lang/LC_MESSAGES/$(PACKAGE_NAME).mo $$lang.po; \
	done
	
qm:
	@echo " **COMPILING** languages: $(LANGUAGES)"
	@for lang in $(LANGUAGES); do \
		echo " **COMPILEMO** $$lang" ; \
		lconvert -o $$lang.ts $$lang.po ; \
		lrelease $$lang.ts ; \
	done

install:
	@echo " **INSTALL** languages: $(LANGUAGES)"
	mkdir -p $(DESTDIR)/share/mageiawelcome/translations/
	@for lang in $(LANGUAGES); do \
		echo " **INSTALLMO** $$lang" ; \
		cp $$lang.qm $(DESTDIR)/share/mageiawelcome/translations/mageiawelcome_$$lang.qm; \
	done