From 58907e0bffb5a7d2d0bfc05cec28f366432bb3e8 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 22 Jun 2011 20:57:07 +0200 Subject: use php's gettext module Signed-off-by: Florian Pritz --- web/lib/pkgfuncs.inc.php | 86 ++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'web/lib/pkgfuncs.inc.php') diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index 46768f2b..3bf0c7bc 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -288,12 +288,12 @@ function package_details($id=0, $SID="") { $results = db_query($q, $dbh); if (!$results) { - print __("Error retrieving package details.") . "
\n"; + print _("Error retrieving package details.") . "
\n"; } else { $row = mysql_fetch_assoc($results); if (empty($row)) { - print __("Package details could not be found.") . "
\n"; + print _("Package details could not be found.") . "
\n"; } else { @@ -540,8 +540,8 @@ function pkg_search_page($SID="") { $templ_pages = array(); if ($current > 1) { - $templ_pages[__('First')] = 0; - $templ_pages[__('Previous')] = ($current - 2) * $per_page; + $templ_pages[_('First')] = 0; + $templ_pages[_('Previous')] = ($current - 2) * $per_page; } if ($current - 5 > 1) @@ -555,8 +555,8 @@ function pkg_search_page($SID="") { $templ_pages["... "] = false; if ($current < $pages) { - $templ_pages[__('Next')] = $current * $per_page; - $templ_pages[__('Last')] = ($pages - 1) * $per_page; + $templ_pages[_('Next')] = $current * $per_page; + $templ_pages[_('Last')] = ($pages - 1) * $per_page; } include('pkg_search_form.php'); @@ -597,18 +597,18 @@ function sanitize_ids($ids) { function pkg_flag ($atype, $ids, $action = True) { if (!$atype) { if ($action) { - return __("You must be logged in before you can flag packages."); + return _("You must be logged in before you can flag packages."); } else { - return __("You must be logged in before you can unflag packages."); + return _("You must be logged in before you can unflag packages."); } } $ids = sanitize_ids($ids); if (empty($ids)) { if ($action) { - return __("You did not select any packages to flag."); + return _("You did not select any packages to flag."); } else { - return __("You did not select any packages to unflag."); + return _("You did not select any packages to unflag."); } } @@ -648,9 +648,9 @@ function pkg_flag ($atype, $ids, $action = True) { } if ($action) { - return __("The selected packages have been flagged out-of-date."); + return _("The selected packages have been flagged out-of-date."); } else { - return __("The selected packages have been unflagged."); + return _("The selected packages have been unflagged."); } } @@ -664,24 +664,24 @@ function pkg_flag ($atype, $ids, $action = True) { */ function pkg_delete ($atype, $ids) { if (!$atype) { - return __("You must be logged in before you can delete packages."); + return _("You must be logged in before you can delete packages."); } # If they're a TU or dev, can delete if ($atype != "Trusted User" && $atype != "Developer") { - return __("You do have permission to delete packages."); + return _("You do have permission to delete packages."); } $ids = sanitize_ids($ids); if (empty($ids)) { - return __("You did not select any packages to delete."); + return _("You did not select any packages to delete."); } $dbh = db_connect(); $q = "DELETE FROM Packages WHERE ID IN (" . implode(",", $ids) . ")"; $result = db_query($q, $dbh); - return __("The selected packages have been deleted."); + return _("The selected packages have been deleted."); } /** @@ -696,18 +696,18 @@ function pkg_delete ($atype, $ids) { function pkg_adopt ($atype, $ids, $action = True) { if (!$atype) { if ($action) { - return __("You must be logged in before you can adopt packages."); + return _("You must be logged in before you can adopt packages."); } else { - return __("You must be logged in before you can disown packages."); + return _("You must be logged in before you can disown packages."); } } $ids = sanitize_ids($ids); if (empty($ids)) { if ($action) { - return __("You did not select any packages to adopt."); + return _("You did not select any packages to adopt."); } else { - return __("You did not select any packages to disown."); + return _("You did not select any packages to disown."); } } @@ -736,9 +736,9 @@ function pkg_adopt ($atype, $ids, $action = True) { if ($action) { pkg_notify(account_from_sid($_COOKIE["AURSID"]), $ids); - return __("The selected packages have been adopted."); + return _("The selected packages have been adopted."); } else { - return __("The selected packages have been disowned."); + return _("The selected packages have been disowned."); } } @@ -754,18 +754,18 @@ function pkg_adopt ($atype, $ids, $action = True) { function pkg_vote ($atype, $ids, $action = True) { if (!$atype) { if ($action) { - return __("You must be logged in before you can vote for packages."); + return _("You must be logged in before you can vote for packages."); } else { - return __("You must be logged in before you can un-vote for packages."); + return _("You must be logged in before you can un-vote for packages."); } } $ids = sanitize_ids($ids); if (empty($ids)) { if ($action) { - return __("You did not select any packages to vote for."); + return _("You did not select any packages to vote for."); } else { - return __("Your votes have been removed from the selected packages."); + return _("Your votes have been removed from the selected packages."); } } @@ -823,9 +823,9 @@ function pkg_vote ($atype, $ids, $action = True) { } if ($action) { - return __("Your votes have been cast for the selected packages."); + return _("Your votes have been cast for the selected packages."); } else { - return __("Your votes have been removed from the selected packages."); + return _("Your votes have been removed from the selected packages."); } } @@ -838,13 +838,13 @@ function pkg_vote ($atype, $ids, $action = True) { */ function pkg_notify ($atype, $ids, $action = True) { if (!$atype) { -# return __("You must be logged in before you can get notifications on comments."); +# return _("You must be logged in before you can get notifications on comments."); return; } $ids = sanitize_ids($ids); if (empty($ids)) { - return __("Couldn't add to notification list."); + return _("Couldn't add to notification list."); } $dbh = db_connect(); @@ -895,10 +895,10 @@ function pkg_notify ($atype, $ids, $action = True) { } if ($action) { - $output = __("You have been added to the comment notification list for %s.", $output); + $output = sprintf(_("You have been added to the comment notification list for %s."), $output); } else { - $output = __("You have been removed from the comment notification list for %s.", $output); + $output = sprintf(_("You have been removed from the comment notification list for %s."), $output); } return $output; @@ -914,14 +914,14 @@ function pkg_notify ($atype, $ids, $action = True) { */ function pkg_delete_comment($atype) { if (!$atype) { - return __("You must be logged in before you can edit package information."); + return _("You must be logged in before you can edit package information."); } # Get ID of comment to be removed if (isset($_POST["comment_id"])) { $comment_id = $_POST["comment_id"]; } else { - return __("Missing comment ID."); + return _("Missing comment ID."); } $uid = uid_from_sid($_COOKIE["AURSID"]); @@ -932,9 +932,9 @@ function pkg_delete_comment($atype) { $q.= "SET DelUsersID = ".$uid." "; $q.= "WHERE ID = ".intval($comment_id); db_query($q, $dbh); - return __("Comment has been deleted."); + return _("Comment has been deleted."); } else { - return __("You are not allowed to delete this comment."); + return _("You are not allowed to delete this comment."); } } @@ -946,25 +946,25 @@ function pkg_delete_comment($atype) { */ function pkg_change_category($atype) { if (!$atype) { - return __("You must be logged in before you can edit package information."); + return _("You must be logged in before you can edit package information."); } # Get ID of the new category if (isset($_POST["category_id"])) { $category_id = $_POST["category_id"]; } else { - return __("Missing category ID."); + return _("Missing category ID."); } $catArray = pkgCategories(); if (!array_key_exists($category_id, $catArray)) { - return __("Invalid category ID."); + return _("Invalid category ID."); } if (isset($_GET["ID"])) { $pid = $_GET["ID"]; } else { - return __("Missing package ID."); + return _("Missing package ID."); } # Verify package ownership @@ -977,7 +977,7 @@ function pkg_change_category($atype) { $pkg = mysql_fetch_assoc($result); } else { - return __("You are not allowed to change this package category."); + return _("You are not allowed to change this package category."); } $uid = uid_from_sid($_COOKIE["AURSID"]); @@ -987,8 +987,8 @@ function pkg_change_category($atype) { $q.= "SET CategoryID = ".intval($category_id)." "; $q.= "WHERE ID = ".intval($pid); db_query($q, $dbh); - return __("Package category changed."); + return _("Package category changed."); } else { - return __("You are not allowed to change this package category."); + return _("You are not allowed to change this package category."); } } -- cgit v1.2.3-24-g4f1b