forked from ansible/workshops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (42 loc) · 1.53 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
########################################################
# Makefile for ansible/workshops
#
# useful targets
# make show-translated-folder -- show list of exercises with localization enabled
# make generate-po ------------- generate language specific po file
# make needs-translation ------- generate list of file with untranslated or fuzzy string for a specific language
# make apply-translation ------- Take PO file as entry and generate a localized README.<locale>.md file
# make clean-translation ------- Removes the locales/ folder in each exercise folder
#
########################################################
BASE_PATH ?= '.'
TRANSLATED_FOLDERS := $(shell find $(BASE_PATH) -name 'po4a.cfg' -exec dirname {} \;)
EXISTING_PO_FILES := $(shell find $(BASE_PATH) -name '*.po')
show-translated-folders:
@echo $(TRANSLATED_FOLDERS)
.SILENT:
generate-po:
for translated_folder in $(TRANSLATED_FOLDERS); do \
pushd 2>&1>/dev/null $$translated_folder && \
po4a po4a.cfg --no-translations 2>&1>/dev/null && \
popd 2>&1>/dev/null ; \
done
.SILENT:
needs-translation:
for file in $(EXISTING_PO_FILES); do \
python pooneliner.py $$file ; \
done
.SILENT:
apply-translation:
for translated_folder in $(TRANSLATED_FOLDERS); do \
pushd 2>&1>/dev/null $$translated_folder && \
po4a po4a.cfg --no-update 2>&1>/dev/null && \
popd 2>&1>/dev/null ; \
done
.SILENT:
clean-translation:
for translated_folder in $(TRANSLATED_FOLDERS); do \
pushd 2>&1>/dev/null $$translated_folder && \
rm -rf locales && \
popd 2>&1>/dev/null ; \
done