]> git.wh0rd.org - tt-rss.git/blob - localized_js.php
localized_js: update automatically
[tt-rss.git] / localized_js.php
1 <?php
2 error_reporting(E_ERROR | E_WARNING | E_PARSE);
3 define('DISABLE_SESSIONS', true);
4
5 require "functions.php";
6 header("Content-Type: text/plain; charset=UTF-8");
7
8 function T_js_decl($s1, $s2) {
9 if ($s1 && $s2) {
10 $s1 = preg_replace("/\n/", "", $s1);
11 $s2 = preg_replace("/\n/", "", $s2);
12
13 $s1 = preg_replace("/\"/", "\\\"", $s1);
14 $s2 = preg_replace("/\"/", "\\\"", $s2);
15
16 return "T_messages[\"$s1\"] = \"$s2\";\n";
17 }
18 }
19 ?>
20
21 var T_messages = new Object();
22
23 function __(msg) {
24 if (T_messages[msg]) {
25 return T_messages[msg];
26 } else {
27 return msg;
28 }
29 }
30
31 <?php
32
33 $l10n = _get_reader();
34
35 for ($i = 0; $i < $l10n->total; $i++) {
36 $orig = $l10n->get_original_string($i);
37 $translation = __($orig);
38
39 print T_js_decl($orig, $translation);
40 }
41
42 ?>