]> git.wh0rd.org Git - tt-rss.git/commitdiff
remove localized_js.php; integrate with other startup JS stuff
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Mar 2013 08:45:27 +0000 (12:45 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Mar 2013 08:45:27 +0000 (12:45 +0400)
include/functions.php
index.php
localized_js.php [deleted file]
prefs.php

index 5582c2b0b0a177b3120c8f6b4f7d92797e18ff6c..32fc5ae2ad67f2c9ba1af18360a0a6a840bfe6fa 100644 (file)
                return $max_ts;
        }
 
+       function T_js_decl($s1, $s2) {
+               if ($s1 && $s2) {
+                       $s1 = preg_replace("/\n/", "", $s1);
+                       $s2 = preg_replace("/\n/", "", $s2);
+
+                       $s1 = preg_replace("/\"/", "\\\"", $s1);
+                       $s2 = preg_replace("/\"/", "\\\"", $s2);
+
+                       return "T_messages[\"$s1\"] = \"$s2\";\n";
+               }
+       }
+
+       function init_js_translations() {
+
+       print 'var T_messages = new Object();
+
+               function __(msg) {
+                       if (T_messages[msg]) {
+                               return T_messages[msg];
+                       } else {
+                               return msg;
+                       }
+               }
+
+               function ngettext(msg1, msg2, n) {
+                       return (parseInt(n) > 1) ? msg2 : msg1;
+               }';
+
+               $l10n = _get_reader();
+
+               for ($i = 0; $i < $l10n->total; $i++) {
+                       $orig = $l10n->get_original_string($i);
+                       $translation = __($orig);
+
+                       print T_js_decl($orig, $translation);
+               }
+       }
+
 ?>
index f94d361d73bc724b1101563fc061d381a457b362..f2b035d47db9253bb7da635440fe5b102fd059da 100644 (file)
--- a/index.php
+++ b/index.php
@@ -77,7 +77,6 @@
                                "lib/dojo/dojo.js",
                                "lib/dijit/dijit.js",
                                "lib/dojo/tt-rss-layer.js",
-                               "localized_js.php",
                                "errors.php?mode=js") as $jsfile) {
 
                echo javascript_tag($jsfile);
@@ -99,6 +98,7 @@
                print get_minified_js(array("tt-rss",
                        "functions", "feedlist", "viewfeed", "FeedTree"));
 
+               init_js_translations();
        ?>
        </script>
 
diff --git a/localized_js.php b/localized_js.php
deleted file mode 100644 (file)
index dcb2159..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-       set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
-               get_include_path());
-
-       require_once "sessions.php";
-       require_once "functions.php";
-       header("Content-Type: text/plain; charset=UTF-8");
-
-       function T_js_decl($s1, $s2) {
-               if ($s1 && $s2) {
-                       $s1 = preg_replace("/\n/", "", $s1);
-                       $s2 = preg_replace("/\n/", "", $s2);
-
-                       $s1 = preg_replace("/\"/", "\\\"", $s1);
-                       $s2 = preg_replace("/\"/", "\\\"", $s2);
-
-                       return "T_messages[\"$s1\"] = \"$s2\";\n";
-               }
-       }
-?>
-
-var T_messages = new Object();
-
-function __(msg) {
-       if (T_messages[msg]) {
-               return T_messages[msg];
-       } else {
-               return msg;
-       }
-}
-
-function ngettext(msg1, msg2, n) {
-       return (parseInt(n) > 1) ? msg2 : msg1;
-}
-
-<?php
-       $l10n = _get_reader();
-
-       for ($i = 0; $i < $l10n->total; $i++) {
-               $orig = $l10n->get_original_string($i);
-               $translation = __($orig);
-
-               print T_js_decl($orig, $translation);
-       }
-?>
index 0715f26e48aa73a82411649932df4054b3ac8ed9..3249687532f94f31f88bf73556afa39de3307a62 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -39,7 +39,6 @@
                                "lib/dojo/dojo.js",
                                "lib/dijit/dijit.js",
                                "lib/dojo/tt-rss-layer.js",
-                               "localized_js.php",
                                "errors.php?mode=js") as $jsfile) {
 
                echo javascript_tag($jsfile);
@@ -60,6 +59,7 @@
 
                print get_minified_js(array("functions", "deprecated", "prefs"));
 
+               init_js_translations();
        ?>
        </script>