]> git.wh0rd.org Git - tt-rss.git/blob - localized_js.php
update eclipse .settings
[tt-rss.git] / localized_js.php
1 <?php
2         set_include_path(get_include_path() . PATH_SEPARATOR . "include");
3
4         define('DISABLE_SESSIONS', true);
5
6         require "functions.php";
7         header("Content-Type: text/plain; charset=UTF-8");
8
9         function T_js_decl($s1, $s2) {
10                 if ($s1 && $s2) {
11                         $s1 = preg_replace("/\n/", "", $s1);
12                         $s2 = preg_replace("/\n/", "", $s2);
13
14                         $s1 = preg_replace("/\"/", "\\\"", $s1);
15                         $s2 = preg_replace("/\"/", "\\\"", $s2);
16
17                         return "T_messages[\"$s1\"] = \"$s2\";\n";
18                 }
19         }
20 ?>
21
22 var T_messages = new Object();
23
24 function __(msg) {
25         if (T_messages[msg]) {
26                 return T_messages[msg];
27         } else {
28                 return msg;
29         }
30 }
31
32 <?php
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 ?>