]> git.wh0rd.org - tt-rss.git/blobdiff - localized_js.php
tinyfeedicon: fix vertical align
[tt-rss.git] / localized_js.php
index b46ba83b3e25b53176446da205fd91072d9903f3..46dbe2961131e3ce93904731a344d3cce7ebfc87 100644 (file)
@@ -1,10 +1,23 @@
-<?php 
-require "functions.php";
-header("Content-Type: text/plain; charset=UTF-8");
+<?php
+       set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
+               get_include_path());
 
-function js_decl($s1, $s2) {
-       return "T_messages[\"$s1\"] = \"$s2\";\n";
-}
+       define('DISABLE_SESSIONS', true);
+
+       require "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();
@@ -18,9 +31,12 @@ function __(msg) {
 }
 
 <?php
+       $l10n = _get_reader();
 
-print js_decl("display feeds", __("display feeds"));
-print js_decl("display tags", __("display tags"));
+       for ($i = 0; $i < $l10n->total; $i++) {
+               $orig = $l10n->get_original_string($i);
+               $translation = __($orig);
 
+               print T_js_decl($orig, $translation);
+       }
 ?>
-