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/html/account.php | 24 ++++++++++++------------ web/html/addvote.php | 28 ++++++++++++++-------------- web/html/index.php | 16 ++++++++-------- web/html/packages.php | 8 ++++---- web/html/passreset.php | 32 ++++++++++++++++---------------- web/html/pkgsubmit.php | 44 ++++++++++++++++++++++---------------------- web/html/tu.php | 22 +++++++++++----------- 7 files changed, 87 insertions(+), 87 deletions(-) (limited to 'web/html') diff --git a/web/html/account.php b/web/html/account.php index ca05d1ac..fe1a45fc 100644 --- a/web/html/account.php +++ b/web/html/account.php @@ -8,12 +8,12 @@ include_once('acctfuncs.inc.php'); # access Account specific functions set_lang(); # this sets up the visitor's language check_sid(); # see if they're still logged in -html_header(__('Accounts')); +html_header(_('Accounts')); # Main page processing here # echo "
\n"; -echo "
".__("Accounts")."
\n"; +echo "
"._("Accounts")."
\n"; echo "
\n"; $action = in_request("Action"); @@ -38,7 +38,7 @@ if (isset($_COOKIE["AURSID"])) { } else { # a non-privileged user is trying to access the search page # - print __("You are not allowed to access this area.")."
\n"; + print _("You are not allowed to access this area.")."
\n"; } } elseif ($action == "DisplayAccount") { @@ -50,7 +50,7 @@ if (isset($_COOKIE["AURSID"])) { $q.= "AND Users.ID = ".intval(in_request("ID")); $result = db_query($q, $dbh); if (!mysql_num_rows($result)) { - print __("Could not retrieve information for the specified user."); + print _("Could not retrieve information for the specified user."); } else { $row = mysql_fetch_assoc($result); @@ -58,7 +58,7 @@ if (isset($_COOKIE["AURSID"])) { # double check to make sure logged in user can edit this account # if ($atype == "User" || ($atype == "Trusted User" && $row["AccountType"] == "Developer")) { - print __("You do not have permission to edit this account."); + print _("You do not have permission to edit this account."); } else { display_account_form($atype, "UpdateAccount", $row["Username"], @@ -77,7 +77,7 @@ if (isset($_COOKIE["AURSID"])) { $q.= "AND Users.ID = ".intval(in_request("ID")); $result = db_query($q, $dbh); if (!mysql_num_rows($result)) { - print __("Could not retrieve information for the specified user."); + print _("Could not retrieve information for the specified user."); } else { $row = mysql_fetch_assoc($result); display_account_info($row["Username"], @@ -99,7 +99,7 @@ if (isset($_COOKIE["AURSID"])) { if ($atype == "Trusted User" || $atype == "Developer") { # display the search page if they're a TU/dev # - print __("Use this form to search existing accounts.")."
\n"; + print _("Use this form to search existing accounts.")."
\n"; search_accounts_form(); } else { @@ -114,16 +114,16 @@ if (isset($_COOKIE["AURSID"])) { $q.= mysql_real_escape_string($_COOKIE["AURSID"])."'"; $result = db_query($q, $dbh); if (!mysql_num_rows($result)) { - print __("Could not retrieve information for the specified user."); + print _("Could not retrieve information for the specified user."); } else { $row = mysql_fetch_assoc($result); # don't need to check if they have permissions, this is a # normal user editing themselves. # - print __("Use this form to update your account."); + print _("Use this form to update your account."); print "
"; - print __("Leave the password fields blank to keep your same password."); + print _("Leave the password fields blank to keep your same password."); display_account_form($atype, "UpdateAccount", $row["Username"], $row["AccountType"], $row["Suspended"], $row["Email"], "", "", $row["RealName"], $row["LangPreference"], @@ -136,7 +136,7 @@ if (isset($_COOKIE["AURSID"])) { # visitor is not logged in # if ($action == "AccountInfo") { - print __("You must log in to view user information."); + print _("You must log in to view user information."); } elseif ($action == "NewAccount") { # process the form input for creating a new account # @@ -148,7 +148,7 @@ if (isset($_COOKIE["AURSID"])) { } else { # display the account request form # - print __("Use this form to create an account."); + print _("Use this form to create an account."); display_account_form("", "NewAccount"); } } diff --git a/web/html/addvote.php b/web/html/addvote.php index fe3037d5..bde0f19d 100644 --- a/web/html/addvote.php +++ b/web/html/addvote.php @@ -30,7 +30,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } if ($check == 0) { - $error.= __("Username does not exist."); + $error.= _("Username does not exist."); } else { $qcheck = "SELECT * FROM TU_VoteInfo WHERE User = '" . mysql_real_escape_string($_POST['user']) . "'"; $qcheck.= " AND End > UNIX_TIMESTAMP()"; @@ -43,16 +43,16 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } if ($check != 0) { - $error.= __("%s already has proposal running for them.", htmlentities($_POST['user'])); + $error.= sprintf(_("%s already has proposal running for them."), htmlentities($_POST['user'])); } } } if (!empty($_POST['length'])) { if (!is_numeric($_POST['length'])) { - $error.= __("Length must be a number.") ; + $error.= _("Length must be a number.") ; } else if ($_POST['length'] < 1) { - $error.= __("Length must be at least 1."); + $error.= _("Length must be at least 1."); } else { $len = (60*60*24)*$_POST['length']; } @@ -61,7 +61,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { } if (empty($_POST['agenda'])) { - $error.= __("Proposal cannot be empty."); + $error.= _("Proposal cannot be empty."); } } @@ -73,7 +73,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $q.= ", " . uid_from_sid($_COOKIE["AURSID"]) . ")"; db_query($q, $dbh); - print "

" . __("New proposal submitted.") . "

\n"; + print "

" . _("New proposal submitted.") . "

\n"; } else { ?> @@ -82,24 +82,24 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
-
+

- + ' /> - +

- + ' /> - +

-
+

-' /> +' />

@@ -107,7 +107,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
-AUR +AUR

', '', @@ -36,7 +36,7 @@ echo __(
', '', '', @@ -46,9 +46,9 @@ echo __(

- +
- +

@@ -72,8 +72,8 @@ general_stats_table($dbh);
'; -echo __('Unsupported packages are user produced content. Any use of the provided files is at your own risk.'); +echo _('DISCLAIMER') . ':
'; +echo _('Unsupported packages are user produced content. Any use of the provided files is at your own risk.'); ?>
diff --git a/web/html/packages.php b/web/html/packages.php index 4a1fa881..26fe84be 100644 --- a/web/html/packages.php +++ b/web/html/packages.php @@ -11,9 +11,9 @@ check_sid(); # see if they're still logged in if (isset($_GET['ID']) && ($pkgname = pkgname_from_id($_GET['ID']))) { $title = $pkgname; } else if (!empty($_GET['K'])) { - $title = __("Search Criteria") . ": " . $_GET['K']; + $title = _("Search Criteria") . ": " . $_GET['K']; } else { - $title = __("Packages"); + $title = _("Packages"); } # Retrieve account type @@ -54,7 +54,7 @@ if (current_action("do_Flag")) { unset($_GET['ID']); } else { - $output = __("The selected packages have not been deleted, check the confirmation checkbox."); + $output = _("The selected packages have not been deleted, check the confirmation checkbox."); } } elseif (current_action("do_Notify")) { $output = pkg_notify($atype, $ids); @@ -77,7 +77,7 @@ html_header($title); if (isset($_GET['ID'])) { include('pkg_search_form.php'); if (!$_GET['ID'] = intval($_GET['ID'])) { - print __("Error trying to retrieve package details.")."
\n"; + print _("Error trying to retrieve package details.")."
\n"; } else { if (isset($_COOKIE["AURSID"])) { package_details($_GET['ID'], $_COOKIE["AURSID"]); diff --git a/web/html/passreset.php b/web/html/passreset.php index ed5d4d31..90878319 100644 --- a/web/html/passreset.php +++ b/web/html/passreset.php @@ -22,11 +22,11 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir $uid = uid_from_email($email); if (empty($email) || empty($password)) { - $error = __('Missing a required field.'); + $error = _('Missing a required field.'); } elseif ($password != $confirm) { - $error = __('Password fields do not match.'); + $error = _('Password fields do not match.'); } elseif ($uid == NULL || $uid == 'None') { - $error = __('Invalid e-mail.'); + $error = _('Invalid e-mail.'); } if (empty($error)) { @@ -44,7 +44,7 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir AND Email = '".mysql_real_escape_string($email)."'"; $result = db_query($q, $dbh); if (!mysql_affected_rows($dbh)) { - $error = __('Invalid e-mail and reset key combination.'); + $error = _('Invalid e-mail and reset key combination.'); } else { header('Location: passreset.php?step=complete'); exit(); @@ -62,7 +62,7 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir WHERE ID = " . $uid; db_query($q, $dbh); # Send email with confirmation link - $body = __('A password reset request was submitted for the account '. + $body = _('A password reset request was submitted for the account '. 'associated with your e-mail address. If you wish to reset '. 'your password follow the link below, otherwise ignore '. 'this message and nothing will happen.'). @@ -80,13 +80,13 @@ if (isset($_GET['resetkey'], $_POST['email'], $_POST['password'], $_POST['confir $step = isset($_GET['step']) ? $_GET['step'] : NULL; -html_header(__("Password Reset")); +html_header(_("Password Reset")); ?>
- +
- + - + - +

- + -

', ''); ?>

-

+

- +
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index b5fe3b7e..5a83c215 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -29,7 +29,7 @@ if ($uid): # Before processing, make sure we even have a file if ($_FILES['pfile']['size'] == 0){ - $error = __("Error - No file uploaded"); + $error = _("Error - No file uploaded"); } # Check whether the file is gzip'ed @@ -39,7 +39,7 @@ if ($uid): list(, $magic) = unpack('v', fread($fh, 2)); if ($magic != 0x8b1f) { - $error = __("Error - unsupported file format (please submit gzip'ed tarballs generated by makepkg(8) only)."); + $error = _("Error - unsupported file format (please submit gzip'ed tarballs generated by makepkg(8) only)."); } } @@ -49,7 +49,7 @@ if ($uid): list(, $filesize_uncompressed) = unpack('V', fread($fh, 4)); if ($filesize_uncompressed > $MAX_FILESIZE_UNCOMPRESSED) { - $error = __("Error - uncompressed file size too large."); + $error = _("Error - uncompressed file size too large."); } } @@ -70,22 +70,22 @@ if ($uid): } elseif (preg_match('/^[^\/]+\/$/', $tar_file['filename'])) { if (++$dircount > 1) { - $error = __("Error - source tarball may not contain more than one directory."); + $error = _("Error - source tarball may not contain more than one directory."); break; } } elseif (preg_match('/^[^\/]+$/', $tar_file['filename'])) { - $error = __("Error - source tarball may not contain files outside a directory."); + $error = _("Error - source tarball may not contain files outside a directory."); break; } elseif (preg_match('/^[^\/]+\/[^\/]+\//', $tar_file['filename'])) { - $error = __("Error - source tarball may not contain nested subdirectories."); + $error = _("Error - source tarball may not contain nested subdirectories."); break; } } if (!$error && empty($pkgbuild_raw)) { - $error = __("Error trying to unpack upload - PKGBUILD does not exist."); + $error = _("Error trying to unpack upload - PKGBUILD does not exist."); } } @@ -179,7 +179,7 @@ if ($uid): $req_vars = array("url", "pkgdesc", "license", "pkgrel", "pkgver", "arch", "pkgname"); foreach ($req_vars as $var) { if (!array_key_exists($var, $pkgbuild)) { - $error = __('Missing %s variable in PKGBUILD.', $var); + $error = sprintf(_('Missing %s variable in PKGBUILD.', $var); break; } } @@ -195,7 +195,7 @@ if ($uid): if (!$error) { $parsed_url = parse_url($pkgbuild['url']); if (!$parsed_url['scheme']) { - $error = __("Package URL is missing a protocol (ie. http:// ,ftp://)"); + $error = _("Package URL is missing a protocol (ie. http:// ,ftp://)"); } } @@ -251,7 +251,7 @@ if ($uid): $presult = preg_match("/^[a-z0-9][a-z0-9\.+_-]*$/", $pkg_name); if (!$presult) { - $error = __("Invalid name: only lowercase letters are allowed."); + $error = _("Invalid name: only lowercase letters are allowed."); } } @@ -269,17 +269,17 @@ if ($uid): } if (!@mkdir($incoming_pkgdir)) { - $error = __( "Could not create directory %s.", $incoming_pkgdir); + $error = sprintf(_( "Could not create directory %s."), $incoming_pkgdir); } } else { - $error = __( "You are not allowed to overwrite the %h%s%h package.", "", $pkg_name, ""); + $error = sprintf(_( "You are not allowed to overwrite the %h%s%h package."), "", $pkg_name, ""); } if (!$error) { # Check if package name is blacklisted. if (!$pkg_exists && pkgname_is_blacklisted($pkg_name)) { if (!canSubmitBlacklisted(account_from_sid($_COOKIE["AURSID"]))) { - $error = __( "%s is on the package blacklist, please check if it's available in the official repos.", $pkg_name); + $error = sprintf(_( "%s is on the package blacklist, please check if it's available in the official repos."), $pkg_name); } } } @@ -287,7 +287,7 @@ if ($uid): if (!$error) { if (!@chdir($incoming_pkgdir)) { - $error = __("Could not change directory to %s.", $incoming_pkgdir); + $error = sprintf(_("Could not change directory to %s."), $incoming_pkgdir); } file_put_contents('PKGBUILD', $pkgbuild_raw); @@ -407,10 +407,10 @@ html_header("Submit");
- +
-

+

- + - +
::
::
- +
@@ -457,7 +457,7 @@ html_header("Submit");
@@ -467,7 +467,7 @@ html_header("Submit"); endif; else: # Visitor is not logged in - print __("You must create an account before you can upload packages."); + print _("You must create an account before you can upload packages."); exit(); ?> diff --git a/web/html/tu.php b/web/html/tu.php index 6e202c80..c16ca5e6 100644 --- a/web/html/tu.php +++ b/web/html/tu.php @@ -29,7 +29,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $row = mysql_fetch_assoc($results); if (empty($row)) { - print __("Could not retrieve proposal details."); + print _("Could not retrieve proposal details."); } else { $isrunning = $row['End'] > time() ? 1 : 0; @@ -62,13 +62,13 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $errorvote = ""; if ($isrunning == 0) { $canvote = 0; - $errorvote = __("Voting is closed for this proposal."); + $errorvote = _("Voting is closed for this proposal."); } else if ($row['User'] == username_from_sid($_COOKIE["AURSID"])) { $canvote = 0; - $errorvote = __("You cannot vote in an proposal about you."); + $errorvote = _("You cannot vote in an proposal about you."); } else if ($hasvoted != 0) { $canvote = 0; - $errorvote = __("You've already voted for this proposal."); + $errorvote = _("You've already voted for this proposal."); } if ($canvote == 1) { @@ -89,7 +89,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { # Can't vote anymore # $canvote = 0; - $errorvote = __("You've already voted for this proposal."); + $errorvote = _("You've already voted for this proposal."); # Update if they voted $result = db_query($qvoted, $dbh); if ($result) { @@ -105,7 +105,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { include("tu_details.php"); } } else { - print __("Vote ID not valid."); + print _("Vote ID not valid."); } } else { @@ -137,7 +137,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $q = "SELECT * FROM TU_VoteInfo WHERE End > " . time() . " ORDER BY Submitted " . $order; $result = db_query($q, $dbh); - $type = __("Current Votes"); + $type = _("Current Votes"); include("tu_list.php"); ?> @@ -145,21 +145,21 @@ if ($atype == "Trusted User" OR $atype == "Developer") { $q = "SELECT * FROM TU_VoteInfo WHERE End < " . time() . " ORDER BY Submitted " . $order . $lim; $result = db_query($q, $dbh); - $type = __("Past Votes"); + $type = _("Past Votes"); include("tu_list.php"); $qnext = "SELECT ID FROM TU_VoteInfo"; $nextresult = db_query($qnext, $dbh); ?>
-

+

- + - +
-- cgit v1.2.3-24-g4f1b