-
Notifications
You must be signed in to change notification settings - Fork 5
/
buildLocales.php
43 lines (34 loc) · 1.43 KB
/
buildLocales.php
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
<?php
// preclude browser access
if (php_sapi_name() !== 'cli') {
exit;
}
$output = array();
$fd = fopen('locale/js.pot', 'w');
fputs($fd, 'msgid ""' ."\n"
. 'msgstr ""' . "\n"
. '"Project-Id-Version: PACKAGE VERSION\n"' . "\n"
. '"Report-Msgid-Bugs-To: \n"' . "\n"
. '"POT-Creation-Date: ' . date('Y-m-md H:i') .'+0200\n"' . "\n"
. '"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"' . "\n"
. '"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"' . "\n"
. '"Language-Team: LANGUAGE <[email protected]>\n"' . "\n"
. '"Language: \n"' . "\n"
. '"MIME-Version: 1.0\n"' . "\n"
. '"Content-Type: text/plain; charset=ISO-8859-1\n"' . "\n"
. '"Content-Transfer-Encoding: 8bit\n"' ."\n\n");
// collect translatable texts
exec("for i in blocks/*/templates/*mustache; do iconv -c -f cp1252 \$i | awk '{if (match($0, /i18n}}([^{]*){{/)) {print substr($0, RSTART+6, RLENGTH-8)}}'; done | sort -u", $output);
exec("for i in blocks/*/*/*js; do iconv -c -f utf-8 \$i | awk '{if (match($0, /i18n.*'\'')/)) {print substr($0, RSTART+6, RLENGTH-8)}}'; done | sort -u", $output);
$output[] = 'Bestätigung';
$output[] = 'Diskussion';
$output[] = 'Evaluationen';
$output[] = 'Freitext';
foreach ($output as $entry) {
if (strlen($entry)) {
fputs($fd, 'msgid "'. str_replace('"', '\\"', utf8_decode($entry)) .'"' . "\n");
fputs($fd, 'msgstr ""' ."\n\n");
}
}
fclose($fd);
exec('make -f locale/Makefile');