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