blob: 15170662b6e161c9ab7dbe0ebcfca3b10cfe72fc (
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
#
# This Makefile will download the translations from our translation server (if
# they don't exist yet) and compile them. Try target help for more information
#
################################################################################
### Download ###
################################################################################
DOWNLOAD_SERVER := translations.cacert.org
PO_URL_TEMPLATE := http://$(DOWNLOAD_SERVER)/export/cacert/%/messages.po
# Only use languages that have 10% or more of translated strings
AUTO_LANGS := \
en \
de \
nl \
pt_BR \
fr \
sv \
it \
es \
hu \
fi \
ja \
bg \
pt \
da \
pl \
zh_CN \
ru \
lv \
cs \
zh_TW \
el \
tr \
ar \
LANGS := \
ar \
bg \
cs \
da \
de \
el \
en \
es \
fa \
fi \
fr \
he \
hr \
hu \
id \
is \
it \
ja \
ka \
ko \
lv \
nb \
nl \
pl \
pt \
pt_BR \
ro \
ru \
sl \
sv \
th \
tr \
uk \
zh_CN \
zh_TW \
PO_FILE_TEMPLATE := %/messages.po
MO_FILE_TEMPLATE := %/LC_MESSAGES/messages.mo
# target: all - Build locales downloading po files
.PHONY: all
all: $(AUTO_LANGS)
# target: help - Display callable targets
.PHONY: help
help:
@egrep "^# target:" [Mm]akefile
# target: clean - remove the build directories
RM := rm -rf
.PHONY: clean
clean:
-$(RM) $(LANGS:%=%/)
# target: <lang> - build this particular language
.PHONY: $(LANGS)
$(LANGS): %: $(MO_FILE_TEMPLATE)
$(LANGS:%=$(MO_FILE_TEMPLATE)): $(MO_FILE_TEMPLATE): $(PO_FILE_TEMPLATE)
mkdir -p $(@D)
#filter obsolete translations
grep --invert-match '^#~ ' $< | \
msgfmt --check --output-file $@ -
.PHONY: $(LANGS:%=$(PO_FILE_TEMPLATE))
$(LANGS:%=$(PO_FILE_TEMPLATE)):
mkdir -p $(@D)
wget --output-document - '$(@:$(PO_FILE_TEMPLATE)=$(PO_URL_TEMPLATE))' | \
php -f escape_special_chars.php \
> $@
################################################################################
### Upload ###
################################################################################
UPLOAD_SERVER := $(DOWNLOAD_SERVER)
SSH_USER := critical
SSH_OPTIONS :=
SCP_OPTIONS := $(SSH_OPTIONS)
FILE_OWNER := www-data
POT_UPLOAD_PATH := /var/www/Pootle/po/cacert/templates/messages.pot
MANAGE_PY := /var/www/Pootle/manage.py
VERSION := Production
DESCRITPION := LibreSSL - CAcert web application (localisation files)
COPYRIGHT_YEAR := 2004-$(shell date +\%Y)
PACKAGE := LibreSSL
GETTEXT_FILE_PATTERN := \
../CommModule/client.pl \
../includes/*.php \
../includes/*/*.php \
../pages/*/*.php \
../scripts/*.php \
../www/*.php \
../www/*/*.php \
# ../tverify/*.php \
# ../tverify/*/*.php \
GETTEXT_FILES := $(wildcard $(GETTEXT_FILE_PATTERN))
# target: template - create the gettext template file, if you want to upload it
# target: onto the translation server you can directly use the
# target: target "upload"
.PHONY: template
template: messages.pot
# target: template.clean - remove anything that was created during the build of
# target: the template file
.PHONY: template.clean
template.clean:
-$(RM) messages.pot
# target: upload - upload the template to the translation server
.PHONY: upload
upload: messages.pot
scp $(SCP_OPTIONS) messages.pot $(SSH_USER)@$(UPLOAD_SERVER):$(POT_UPLOAD_PATH)
ssh $(SSH_OPTIONS) $(SSH_USER)@$(UPLOAD_SERVER) "sudo -u $(FILE_OWNER) pootle-update cacert"
# target: upload.clean - remove anything that was created during the upload
.PHONY: upload.clean
upload.clean: template.clean
messages.pot: $(GETTEXT_FILES)
xgettext --output - --sort-by-file --copyright-holder "CAcert Inc." \
--package-name "CAcert" --package-version "$(VERSION)" \
--msgid-bugs-address "translations-admin@cacert.org" $^ | \
# replace place holders in the lines before the first msgid\
sed '1,/^msgid/ { s/SOME DESCRIPTIVE TITLE/$(DESCRITPION)/; s/YEAR/$(COPYRIGHT_YEAR)/; s/PACKAGE/$(PACKAGE)/ }' \
> $@
|