ttrss/localized_js.php

43 lines
772 B
PHP
Raw Normal View History

2010-01-13 11:11:16 +00:00
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
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";
}
}
2007-03-06 06:11:28 +00:00
?>
var T_messages = new Object();
function __(msg) {
if (T_messages[msg]) {
return T_messages[msg];
} else {
return msg;
}
}
<?php
2010-01-13 11:11:16 +00:00
$l10n = _get_reader();
for ($i = 0; $i < $l10n->total; $i++) {
$orig = $l10n->get_original_string($i);
$translation = __($orig);
print T_js_decl($orig, $translation);
}
2007-03-06 06:54:47 +00:00
?>