Andrew Dolgov 17 роки тому
батько
коміт
1025ad8763
10 змінених файлів з 45 додано та 49 видалено
  1. 1 0
      backend.php
  2. 1 0
      errors.php
  3. 25 27
      functions.php
  4. 5 5
      modules/opml_domdoc.php
  5. 6 6
      modules/opml_domxml.php
  6. 4 4
      opml.php
  7. 0 3
      prefs.php
  8. 2 0
      sanity_check.php
  9. 0 3
      tt-rss.php
  10. 1 1
      update-translations.sh

+ 1 - 0
backend.php

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

+ 1 - 0
errors.php

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

+ 25 - 27
functions.php

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

+ 5 - 5
modules/opml_domdoc.php

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

+ 6 - 6
modules/opml_domxml.php

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

+ 4 - 4
opml.php

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

+ 0 - 3
prefs.php

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

+ 2 - 0
sanity_check.php

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

+ 0 - 3
tt-rss.php

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

+ 1 - 1
update-translations.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 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
 	msgfmt --statistics $TEMPLATE