summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-25 12:45:27 +0400
committerAndrew Dolgov <[email protected]>2013-03-25 12:45:27 +0400
commitbcbb2ec7927849117bfedac87a3726808890d19c (patch)
tree6056fa61160132a60934c8178f361bf9223077fd
parent90856743c3f792594fb6b69e7caef03aa960331e (diff)
remove localized_js.php; integrate with other startup JS stuff
-rw-r--r--include/functions.php38
-rw-r--r--index.php2
-rw-r--r--localized_js.php45
-rw-r--r--prefs.php2
4 files changed, 40 insertions, 47 deletions
diff --git a/include/functions.php b/include/functions.php
index 5582c2b0b..32fc5ae2a 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -4090,4 +4090,42 @@
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);
+ }
+ }
+
?>
diff --git a/index.php b/index.php
index f94d361d7..f2b035d47 100644
--- 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
index dcb2159ca..000000000
--- a/localized_js.php
+++ /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);
- }
-?>
diff --git a/prefs.php b/prefs.php
index 0715f26e4..324968753 100644
--- 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>