]> git.wh0rd.org - tt-rss.git/blame - utils/update-js-translations.sh
automatically extract i18n data from .js files
[tt-rss.git] / utils / update-js-translations.sh
CommitLineData
10bccf7d
AD
1#!/bin/sh
2
3if [ ! -f localized_js.php ]; then
4 echo "please run this script from tt-rss directory"
5 exit 1
6fi
7
8cat >localized_js.php <<HEADER
9<?php
10error_reporting(E_ERROR | E_WARNING | E_PARSE);
11define('DISABLE_SESSIONS', true);
12
13require "functions.php";
14header("Content-Type: text/plain; charset=UTF-8");
15
16function T_js_decl(\$s1) {
17
18 if (!\$s1) return;
19
20// \$T_s1 = __(\$s1);
21
22// if (\$T_s1 != \$s1) {
23 return "T_messages[\"\$s1\"] = \"".__(\$s1)."\";\n";
24// } else {
25// return "";
26// }
27}
28?>
29
30var T_messages = new Object();
31
32function __(msg) {
33 if (T_messages[msg]) {
34 return T_messages[msg];
35 } else {
36 debug('[gettext] not found: ' + msg);
37 return msg;
38 }
39}
40
41<?php
42HEADER
43
44cat *js | ./utils/extract-i18n-js.pl | sort | uniq >> localized_js.php
45
46cat >>localized_js.php <<FOOTER
47?>
48FOOTER