-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
99 lines (84 loc) · 3.84 KB
/
Makefile
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
97
98
99
VERSION = 4.3
# Don't forget to also update, .htaccess, index.php and gcompris.py when updating this list
ALL_LINGUAS = ar be bg br ca ca@valencia cs de el eo es et eu fi fr gd gl he hr hu id it ko lt mk ml nl nn pl pt pt_BR ro ru sk sl sq sv sw tr uk zh_CN zh_TW
#ALL_LINGUAS = fr
GCOMPRIS_DIR="gcompris-qt-$(VERSION)"
HTML := $(ALL_LINGUAS:%=index-%.html)
LCONVERT := $(shell { command -v lconvert || command -v lconvert-qt5 || command -v lconvert-qt6; } 2>/dev/null)
%.LCONVERT: %
$(LCONVERT) $< >$@
LRELEASE := $(shell { command -v lrelease || command -v lrelease-qt5 || command -v lrelease-qt6; } 2>/dev/null)
%.LRELEASE: %
$(LRELEASE) $< >$@
sources = \
gcompris.py \
template/base.html \
template/christmas.html \
template/donate.html \
template/downloads.html \
template/faq.html \
template/index.html \
template/news.html \
template/newsall.html \
template/onenews.html \
template/schools.html \
template/screenshot.html \
template/screenshots.html \
template/singlenews.html
i18_sources = template/base.html \
template/donate.html \
template/downloads.html \
template/faq.html \
template/index.html \
template/screenshot.html \
template/schools.html
downloadGComprisSrc:
if [ ! -d "$(GCOMPRIS_DIR)" ]; then \
wget "https://gcompris.net/download/qt/src/gcompris-qt-$(VERSION).tar.xz"; \
tar -xf "gcompris-qt-$(VERSION).tar.xz"; \
rm -f "gcompris-qt-$(VERSION).tar.xz"; \
fi;
all: $(HTML) mobile-privacy-policy.html
PYTHONPATH="${PYTHONPATH}:./$(GCOMPRIS_DIR)/tools/python" ./gcompris.py $(VERSION) en "$(ALL_LINGUAS)" $(GCOMPRIS_DIR); \
mobile-privacy-policy.html: template/mobile-privacy-policy.html
cp $< $@
index-%.html: $(sources)
lang=`echo $@ | sed 's/index-\([^.]*\).html/\1/g'`; \
PYTHONPATH="${PYTHONPATH}:./$(GCOMPRIS_DIR)/tools/python" ./gcompris.py $(VERSION) $$lang "$(ALL_LINGUAS)" $(GCOMPRIS_DIR); \
#
# Run it to update the translation.
# 1) Download the corresponding GCompris source version if not already present.
# 2) We convert the po files from the GCompris source folder to .qm files to be read by PyQt (to get the ActivityInfo.qml translated).
# 3) The second for loop is to retrieve the gcompris-net po files and convert them to .mo files to be used by Jinja2.
update: downloadGComprisSrc
linguas="$(ALL_LINGUAS)"; \
for lang in $$linguas; do \
translationFolder="po/$$lang/LC_MESSAGES"; \
outTsFile="$$translationFolder/gcompris_qt.ts"; \
outQmFile="$$translationFolder/gcompris_qt.qm"; \
mkdir -p $$translationFolder; \
if [ -f "$(GCOMPRIS_DIR)/poqm/$$lang/gcompris_qt.po" ]; then \
msgattrib --no-obsolete $(GCOMPRIS_DIR)/poqm/$$lang/gcompris_qt.po -o $$outTsFile; \
${LCONVERT} -if po -of ts -i $$outTsFile -o $$outTsFile; \
${LRELEASE} -compress -nounfinished $$outTsFile -qm $$outQmFile; \
fi; \
done; \
for lang in $$linguas; do \
if [ -f po/$$lang/gcompris-net.po ]; then \
cp po/$$lang/gcompris-net.po po/$$lang/LC_MESSAGES/gcompris.po; \
msgfmt --use-fuzzy po/$$lang/LC_MESSAGES/gcompris.po -o po/$$lang/LC_MESSAGES/gcompris.mo; \
python3 tools/convertPoToNews.py $$lang po/$$lang/LC_MESSAGES/gcompris.po; \
fi; \
done;
#
# Run this when new strings are added in the templates
extract: $(i18_sources)
pybabel extract -F babel.cfg -o po/messages.pot ./
if test $(shell git diff po/messages.pot | grep "^+[^+]" | wc -l) -eq 1; then \
git checkout po/messages.pot; \
touch po/messages.pot; \
fi
online:
rsync -az --copy-unsafe-links --exclude "*.py" --exclude ".git" --exclude ".gitignore" --exclude ".directory" --exclude ".htaccess" --exclude ".rcc" --exclude ".emacs.d" --exclude "__pycache__" --exclude "babel.cfg" --exclude "Makefile" --exclude "Messages.sh" --exclude "po" --exclude "tools" --exclude "newsTemplate" --exclude "template" --exclude "gcompris-qt-*" --exclude "fonts" . [email protected]:/var/www/
clean:
rm -Rf *.html feed-*.xml *.pyc news/*.html po/*/LC_MESSAGES/