]> git.wh0rd.org - tt-rss.git/blob - localized_js.php
Make the Penny Arcade plugin pull in news posts as well as comics
[tt-rss.git] / localized_js.php
1 <?php
2 set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
3 get_include_path());
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 function ngettext(msg1, msg2, n) {
34 return (parseInt(n) > 1) ? msg2 : msg1;
35 }
36
37 <?php
38 $l10n = _get_reader();
39
40 for ($i = 0; $i < $l10n->total; $i++) {
41 $orig = $l10n->get_original_string($i);
42 $translation = __($orig);
43
44 print T_js_decl($orig, $translation);
45 }
46 ?>