more I18N work

This commit is contained in:
Andrew Dolgov 2007-03-05 10:04:55 +01:00
parent d1db26aa1c
commit 1025ad8763
10 changed files with 45 additions and 49 deletions

View file

@ -22,6 +22,7 @@
require_once "functions.php"; require_once "functions.php";
no_cache_incantation(); no_cache_incantation();
startup_gettext();
$script_started = getmicrotime(); $script_started = getmicrotime();

View file

@ -1,4 +1,5 @@
<?php <?php
$ERRORS[0] = __("Unknown error"); $ERRORS[0] = __("Unknown error");
$ERRORS[1] = __("This program requires XmlHttpRequest " . $ERRORS[1] = __("This program requires XmlHttpRequest " .

View file

@ -6,6 +6,11 @@
define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE); define('DEFAULT_ERROR_LEVEL', E_ERROR | E_WARNING | E_PARSE);
} */ } */
require_once "accept-to-gettext.php";
require_once "gettext/gettext.inc";
startup_gettext();
require_once 'config.php'; require_once 'config.php';
require_once 'db-prefs.php'; require_once 'db-prefs.php';
require_once 'compat.php'; require_once 'compat.php';
@ -18,9 +23,6 @@
require_once "magpierss/rss_fetch.inc"; require_once "magpierss/rss_fetch.inc";
require_once 'magpierss/rss_utils.inc'; require_once 'magpierss/rss_utils.inc';
require_once "accept-to-gettext.php";
require_once "gettext/gettext.inc";
function purge_feed($link, $feed_id, $purge_interval, $debug = false) { function purge_feed($link, $feed_id, $purge_interval, $debug = false) {
$rows = -1; $rows = -1;
@ -2752,28 +2754,24 @@
<ul class=\"headlineDropdownMenu\"> <ul class=\"headlineDropdownMenu\">
<li class=\"top2\"> <li class=\"top2\">
Select: Select:
<a href=\"$sel_all_link\">All</a>, <a href=\"$sel_all_link\">".__('All')."</a>,
<a href=\"$sel_unread_link\">Unread</a>, <a href=\"$sel_unread_link\">".__('Unread')."</a>,
<a href=\"$sel_none_link\">None</a></li> <a href=\"$sel_none_link\">".__('None')."</a></li>
<li class=\"vsep\">&nbsp;</li> <li class=\"vsep\">&nbsp;</li>
<li class=\"top\">Selection<ul> <li class=\"top\">Selection<ul>
<li onclick=\"$tog_unread_link\">Toggle unread</li> <li onclick=\"$tog_unread_link\">".__('Toggle unread')."</li>
<li onclick=\"$tog_marked_link\">Toggle starred</li></ul></li> <li onclick=\"$tog_marked_link\">".__('Toggle starred')."</li></ul></li>
<li class=\"vsep\">&nbsp;</li> <li class=\"vsep\">&nbsp;</li>
<li class=\"top\"><a href=\"$catchup_page_link\">Mark as read</a><ul> <li class=\"top\"><a href=\"$catchup_page_link\">".__('Mark as read')."</a><ul>
<li onclick=\"$catchup_page_link\">This page</li> <li onclick=\"$catchup_page_link\">".__('This page')."</li>
<li onclick=\"$catchup_feed_link\">Entire feed</li></ul></li> <li onclick=\"$catchup_feed_link\">".__('Entire feed')."</li></ul></li>
<li class=\"vsep\">&nbsp;</li> <li class=\"vsep\">&nbsp;</li>";
<!-- <li class=\"top2\">
Page:
<a href=\"$page_prev_link\">Previous</a>,
<a href=\"$page_next_link\">Next</a></li> -->";
if ($limit != 0) { if ($limit != 0) {
print " print "
<li class=\"top\"><a href=\"$page_next_link\">Next page</a><ul> <li class=\"top\"><a href=\"$page_next_link\">".__('Next page')."</a><ul>
<li onclick=\"$page_prev_link\">Previous page</li> <li onclick=\"$page_prev_link\">".__('Previous page')."</li>
<li onclick=\"$page_first_link\">First page</li></ul></li> <li onclick=\"$page_first_link\">".__('First page')."</li></ul></li>
</ul>"; </ul>";
} }
@ -2785,16 +2783,16 @@
print "<td class=\"headlineActions$rtl_cpart\">". print "<td class=\"headlineActions$rtl_cpart\">".
__('Select:')." __('Select:')."
<a href=\"$sel_all_link\">All</a>, <a href=\"$sel_all_link\">".__('All')."</a>,
<a href=\"$sel_unread_link\">Unread</a>, <a href=\"$sel_unread_link\">".__('Unread')."</a>,
<a href=\"$sel_none_link\">None</a> <a href=\"$sel_none_link\">".__('None')."</a>
&nbsp;&nbsp;". &nbsp;&nbsp;".
__('Toggle:')." <a href=\"$tog_unread_link\">Unread</a>, __('Toggle:')." <a href=\"$tog_unread_link\">".__('Unread')."</a>,
<a href=\"$tog_marked_link\">Starred</a> <a href=\"$tog_marked_link\">".__('Starred')."</a>
&nbsp;&nbsp;". &nbsp;&nbsp;".
__('Mark as read:')." __('Mark as read:')."
<a href=\"#\" onclick=\"$catchup_page_link\">Page</a>, <a href=\"#\" onclick=\"$catchup_page_link\">".__('Page')."</a>,
<a href=\"#\" onclick=\"$catchup_feed_link\">Feed</a>"; <a href=\"#\" onclick=\"$catchup_feed_link\">".__('Feed')."</a>";
print "</td>"; print "</td>";
} }
@ -2830,7 +2828,7 @@
<a target=\"_new\" <a target=\"_new\"
href=\"backend.php?op=rss&id=$feed_id&is_cat=$is_cat$search_q\"> href=\"backend.php?op=rss&id=$feed_id&is_cat=$is_cat$search_q\">
<img class=\"noborder\" <img class=\"noborder\"
alt=\"Generated feed\" src=\"images/feed-icon-12x12.png\"> alt=\"".__('Generated feed')."\" src=\"images/feed-icon-12x12.png\">
</a>"; </a>";
} }

View file

@ -41,7 +41,7 @@
if (db_num_rows($result) == 0) { if (db_num_rows($result) == 0) {
print "Adding category <b>$cat_title</b>...<br>"; printf(__("Adding category <b>%s</b>...<br>"), $cat_title);
db_query($link, "INSERT INTO ttrss_feed_categories db_query($link, "INSERT INTO ttrss_feed_categories
(title,owner_uid) (title,owner_uid)
@ -86,7 +86,7 @@
(<a target='_new' href=\"$feed_url\">rss</a>)</td>"; (<a target='_new' href=\"$feed_url\">rss</a>)</td>";
if (db_num_rows($result) > 0) { if (db_num_rows($result) > 0) {
print "<td>Already imported.</td>"; print "<td>".__('Already imported.')."</td>";
} else { } else {
if ($cat_id) { if ($cat_id) {
@ -104,7 +104,7 @@
db_query($link, $add_query); db_query($link, $add_query);
print "<td><b>Done.</b></td>"; print "<td><b>".__('Done.')."</b></td>";
} }
print "</tr>"; print "</tr>";
@ -115,11 +115,11 @@
print "</table>"; print "</table>";
} else { } else {
print "<div class=\"error\">Error while parsing document.</div>"; print "<div class=\"error\">".__('Error while parsing document.')."</div>";
} }
} else { } else {
print "<div class=\"error\">Error: please upload OPML file.</div>"; print "<div class=\"error\">".__('Error: please upload OPML file.')."</div>";
} }

View file

@ -43,7 +43,7 @@
if (db_num_rows($result) == 0) { if (db_num_rows($result) == 0) {
printf(_("Adding category <b>%s</b>."), $cat_title); printf(__("Adding category <b>%s</b>."), $cat_title);
print "<br>"; print "<br>";
db_query($link, "INSERT INTO ttrss_feed_categories db_query($link, "INSERT INTO ttrss_feed_categories
@ -89,7 +89,7 @@
(<a target='_new' href=\"$feed_url\">rss</a>)</td>"; (<a target='_new' href=\"$feed_url\">rss</a>)</td>";
if (db_num_rows($result) > 0) { if (db_num_rows($result) > 0) {
print "<td>"._("Already imported.")."</td>"; print "<td>".__("Already imported.")."</td>";
} else { } else {
if ($cat_id) { if ($cat_id) {
@ -107,7 +107,7 @@
db_query($link, $add_query); db_query($link, $add_query);
print "<td><b>"._('Done.')."</b></td>"; print "<td><b>".__('Done.')."</b></td>";
} }
print "</tr>"; print "</tr>";
@ -118,14 +118,14 @@
print "</table>"; print "</table>";
} else { } else {
print "<div class=\"error\">"._("Error: can't find body element.")."</div>"; print "<div class=\"error\">".__("Error: can't find body element.")."</div>";
} }
} else { } else {
print "<div class=\"error\">"._("Error while parsing document.")."</div>"; print "<div class=\"error\">".__("Error while parsing document.")."</div>";
} }
} else { } else {
print "<div class=\"error\">"._("Error: please upload OPML file.")."</div>"; print "<div class=\"error\">".__("Error: please upload OPML file.")."</div>";
} }
} }

View file

@ -100,24 +100,24 @@
print "<html> print "<html>
<head> <head>
<link rel=\"stylesheet\" href=\"utility.css\" type=\"text/css\"> <link rel=\"stylesheet\" href=\"utility.css\" type=\"text/css\">
<title>OPML Utility</title> <title>".__("OPML Utility")."</title>
</head> </head>
<body> <body>
<div class=\"floatingLogo\"><img src=\"images/ttrss_logo.png\"></div> <div class=\"floatingLogo\"><img src=\"images/ttrss_logo.png\"></div>
<h1>".__('OPML Utility')."</h1>"; <h1>".__('OPML Utility')."</h1>";
if (function_exists('domxml_open_file')) { if (function_exists('domxml_open_file')) {
print "<p>Importing OPML (using DOMXML extension)...</p>"; print __("<p>Importing OPML (using DOMXML extension)...</p>");
require_once "modules/opml_domxml.php"; require_once "modules/opml_domxml.php";
opml_import_domxml($link, $owner_uid); opml_import_domxml($link, $owner_uid);
} else { } else {
print "<p>Importing OPML (using DOMDocument extension)...</p>"; print __("<p>Importing OPML (using DOMDocument extension)...</p>");
require_once "modules/opml_domdoc.php"; require_once "modules/opml_domdoc.php";
opml_import_domdoc($link, $owner_uid); opml_import_domdoc($link, $owner_uid);
} }
print "<br><form method=\"GET\" action=\"prefs.php\"> print "<br><form method=\"GET\" action=\"prefs.php\">
<input type=\"submit\" value=\"Return to preferences\"> <input type=\"submit\" value=\"".__("Return to preferences")."\">
</form>"; </form>";
print "</body></html>"; print "</body></html>";

View file

@ -2,9 +2,6 @@
error_reporting(E_ERROR | E_WARNING | E_PARSE); error_reporting(E_ERROR | E_WARNING | E_PARSE);
require_once "functions.php"; require_once "functions.php";
startup_gettext();
require_once "sessions.php"; require_once "sessions.php";
require_once "sanity_check.php"; require_once "sanity_check.php";
require_once "version.php"; require_once "version.php";

View file

@ -1,4 +1,6 @@
<?php <?php
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 5); define('EXPECTED_CONFIG_VERSION', 5);
if (!file_exists("config.php")) { if (!file_exists("config.php")) {

View file

@ -2,9 +2,6 @@
error_reporting(E_ERROR | E_WARNING | E_PARSE); error_reporting(E_ERROR | E_WARNING | E_PARSE);
require_once "functions.php"; require_once "functions.php";
startup_gettext();
require_once "sessions.php"; require_once "sessions.php";
require_once "sanity_check.php"; require_once "sanity_check.php";
require_once "version.php"; require_once "version.php";

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
TEMPLATE=messages.pot TEMPLATE=messages.pot
xgettext -kT_ngettext:1,2 -kT_ -k_ -k__ -L PHP -o $TEMPLATE *.php modules/*.php xgettext -kT_ngettext:1,2 -k__ -L PHP -o $TEMPLATE *.php modules/*.php
if [ "$1" = "-p" ]; then if [ "$1" = "-p" ]; then
msgfmt --statistics $TEMPLATE msgfmt --statistics $TEMPLATE